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:
@@ -85,7 +85,7 @@ private:
|
|||||||
BRegion(const clipping_rect& rect);
|
BRegion(const clipping_rect& rect);
|
||||||
|
|
||||||
void _AdoptRegionData(BRegion& region);
|
void _AdoptRegionData(BRegion& region);
|
||||||
bool _SetSize(long newSize);
|
bool _SetSize(int32 newSize);
|
||||||
|
|
||||||
clipping_rect _Convert(const BRect& rect) const;
|
clipping_rect _Convert(const BRect& rect) const;
|
||||||
clipping_rect _ConvertToInternal(const BRect& rect) const;
|
clipping_rect _ConvertToInternal(const BRect& rect) const;
|
||||||
@@ -93,8 +93,8 @@ private:
|
|||||||
const clipping_rect& rect) const;
|
const clipping_rect& rect) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
long fCount;
|
int32 fCount;
|
||||||
long fDataSize;
|
int32 fDataSize;
|
||||||
clipping_rect fBounds;
|
clipping_rect fBounds;
|
||||||
clipping_rect* fData;
|
clipping_rect* fData;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -443,7 +443,7 @@ err:
|
|||||||
status_t
|
status_t
|
||||||
LinkReceiver::ReadRegion(BRegion* region)
|
LinkReceiver::ReadRegion(BRegion* region)
|
||||||
{
|
{
|
||||||
status_t status = Read(®ion->fCount, sizeof(long));
|
status_t status = Read(®ion->fCount, sizeof(int32));
|
||||||
if (status >= B_OK)
|
if (status >= B_OK)
|
||||||
status = Read(®ion->fBounds, sizeof(clipping_rect));
|
status = Read(®ion->fBounds, sizeof(clipping_rect));
|
||||||
if (status >= B_OK) {
|
if (status >= B_OK) {
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ ServerLink::SetTo(port_id sender, port_id receiver)
|
|||||||
status_t
|
status_t
|
||||||
ServerLink::ReadRegion(BRegion* region)
|
ServerLink::ReadRegion(BRegion* region)
|
||||||
{
|
{
|
||||||
fReceiver->Read(®ion->fCount, sizeof(long));
|
fReceiver->Read(®ion->fCount, sizeof(int32));
|
||||||
if (region->fCount > 0) {
|
if (region->fCount > 0) {
|
||||||
fReceiver->Read(®ion->fBounds, sizeof(clipping_rect));
|
fReceiver->Read(®ion->fBounds, sizeof(clipping_rect));
|
||||||
if (!region->_SetSize(region->fCount))
|
if (!region->_SetSize(region->fCount))
|
||||||
@@ -78,7 +78,7 @@ ServerLink::ReadRegion(BRegion* region)
|
|||||||
status_t
|
status_t
|
||||||
ServerLink::AttachRegion(const BRegion& region)
|
ServerLink::AttachRegion(const BRegion& region)
|
||||||
{
|
{
|
||||||
fSender->Attach(®ion.fCount, sizeof(long));
|
fSender->Attach(®ion.fCount, sizeof(int32));
|
||||||
if (region.fCount > 0) {
|
if (region.fCount > 0) {
|
||||||
fSender->Attach(®ion.fBounds, sizeof(clipping_rect));
|
fSender->Attach(®ion.fBounds, sizeof(clipping_rect));
|
||||||
return fSender->Attach(region.fData,
|
return fSender->Attach(region.fData,
|
||||||
|
|||||||
@@ -330,9 +330,9 @@ BRegion::PrintToStream() const
|
|||||||
{
|
{
|
||||||
Frame().PrintToStream();
|
Frame().PrintToStream();
|
||||||
|
|
||||||
for (long i = 0; i < fCount; i++) {
|
for (int32 i = 0; i < fCount; i++) {
|
||||||
clipping_rect *rect = &fData[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",
|
".0, r:%" B_PRId32 ".0, b:%" B_PRId32 ".0)\n",
|
||||||
i, rect->left, rect->top, rect->right - 1, rect->bottom - 1);
|
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 (fCount > 0) {
|
||||||
if (fData != &fBounds) {
|
if (fData != &fBounds) {
|
||||||
for (long i = 0; i < fCount; i++)
|
for (int32 i = 0; i < fCount; i++)
|
||||||
offset_rect(fData[i], x, y);
|
offset_rect(fData[i], x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -545,7 +545,7 @@ BRegion::_AdoptRegionData(BRegion& region)
|
|||||||
able to hold.
|
able to hold.
|
||||||
*/
|
*/
|
||||||
bool
|
bool
|
||||||
BRegion::_SetSize(long newSize)
|
BRegion::_SetSize(int32 newSize)
|
||||||
{
|
{
|
||||||
// we never shrink the size
|
// we never shrink the size
|
||||||
newSize = max_c(fDataSize, newSize);
|
newSize = max_c(fDataSize, newSize);
|
||||||
|
|||||||
Reference in New Issue
Block a user