Changed BRegion to use int32 instead of long.
There is no need for fCount and fDataSize to be long, not going to have more than 2^32 rectangles in a region. Thanks Axel for pointing that out.
This commit is contained in:
parent
6d796a84bd
commit
ac4525b2a5
@ -85,7 +85,7 @@ private:
|
||||
BRegion(const clipping_rect& rect);
|
||||
|
||||
void _AdoptRegionData(BRegion& region);
|
||||
bool _SetSize(long newSize);
|
||||
bool _SetSize(int32 newSize);
|
||||
|
||||
clipping_rect _Convert(const BRect& rect) const;
|
||||
clipping_rect _ConvertToInternal(const BRect& rect) const;
|
||||
@ -93,8 +93,8 @@ private:
|
||||
const clipping_rect& rect) const;
|
||||
|
||||
private:
|
||||
long fCount;
|
||||
long fDataSize;
|
||||
int32 fCount;
|
||||
int32 fDataSize;
|
||||
clipping_rect fBounds;
|
||||
clipping_rect* fData;
|
||||
};
|
||||
|
@ -443,7 +443,7 @@ err:
|
||||
status_t
|
||||
LinkReceiver::ReadRegion(BRegion* region)
|
||||
{
|
||||
status_t status = Read(®ion->fCount, sizeof(long));
|
||||
status_t status = Read(®ion->fCount, sizeof(int32));
|
||||
if (status >= B_OK)
|
||||
status = Read(®ion->fBounds, sizeof(clipping_rect));
|
||||
if (status >= B_OK) {
|
||||
|
@ -62,7 +62,7 @@ ServerLink::SetTo(port_id sender, port_id receiver)
|
||||
status_t
|
||||
ServerLink::ReadRegion(BRegion* region)
|
||||
{
|
||||
fReceiver->Read(®ion->fCount, sizeof(long));
|
||||
fReceiver->Read(®ion->fCount, sizeof(int32));
|
||||
if (region->fCount > 0) {
|
||||
fReceiver->Read(®ion->fBounds, sizeof(clipping_rect));
|
||||
if (!region->_SetSize(region->fCount))
|
||||
@ -78,7 +78,7 @@ ServerLink::ReadRegion(BRegion* region)
|
||||
status_t
|
||||
ServerLink::AttachRegion(const BRegion& region)
|
||||
{
|
||||
fSender->Attach(®ion.fCount, sizeof(long));
|
||||
fSender->Attach(®ion.fCount, sizeof(int32));
|
||||
if (region.fCount > 0) {
|
||||
fSender->Attach(®ion.fBounds, sizeof(clipping_rect));
|
||||
return fSender->Attach(region.fData,
|
||||
|
@ -330,9 +330,9 @@ BRegion::PrintToStream() const
|
||||
{
|
||||
Frame().PrintToStream();
|
||||
|
||||
for (long i = 0; i < fCount; i++) {
|
||||
for (int32 i = 0; i < fCount; i++) {
|
||||
clipping_rect *rect = &fData[i];
|
||||
printf("data[%ld] = BRect(l:%" B_PRId32 ".0, t:%" B_PRId32
|
||||
printf("data[%" B_PRId32 "] = BRect(l:%" B_PRId32 ".0, t:%" B_PRId32
|
||||
".0, r:%" B_PRId32 ".0, b:%" B_PRId32 ".0)\n",
|
||||
i, rect->left, rect->top, rect->right - 1, rect->bottom - 1);
|
||||
}
|
||||
@ -361,7 +361,7 @@ BRegion::OffsetBy(int32 x, int32 y)
|
||||
|
||||
if (fCount > 0) {
|
||||
if (fData != &fBounds) {
|
||||
for (long i = 0; i < fCount; i++)
|
||||
for (int32 i = 0; i < fCount; i++)
|
||||
offset_rect(fData[i], x, y);
|
||||
}
|
||||
|
||||
@ -545,7 +545,7 @@ BRegion::_AdoptRegionData(BRegion& region)
|
||||
able to hold.
|
||||
*/
|
||||
bool
|
||||
BRegion::_SetSize(long newSize)
|
||||
BRegion::_SetSize(int32 newSize)
|
||||
{
|
||||
// we never shrink the size
|
||||
newSize = max_c(fDataSize, newSize);
|
||||
|
Loading…
x
Reference in New Issue
Block a user