* this should improve the performance of operator=
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16658 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -413,17 +413,19 @@ BRegion &
|
|||||||
BRegion::operator=(const BRegion ®ion)
|
BRegion::operator=(const BRegion ®ion)
|
||||||
{
|
{
|
||||||
if (®ion != this) {
|
if (®ion != this) {
|
||||||
free(data);
|
|
||||||
bound = region.bound;
|
bound = region.bound;
|
||||||
count = region.count;
|
count = region.count;
|
||||||
data_size = region.data_size;
|
|
||||||
|
// handle reallocation if we're too small to contain
|
||||||
|
// the other region
|
||||||
|
set_size(region.data_size);
|
||||||
|
|
||||||
|
// TODO: what is this supposed to do??
|
||||||
if (data_size <= 0)
|
if (data_size <= 0)
|
||||||
data_size = 1;
|
data_size = 1;
|
||||||
|
|
||||||
data = (clipping_rect *)malloc(data_size * sizeof(clipping_rect));
|
if (data)
|
||||||
|
memcpy(data, region.data, count * sizeof(clipping_rect));
|
||||||
memcpy(data, region.data, count * sizeof(clipping_rect));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
|||||||
Reference in New Issue
Block a user