* 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:
parent
907e89c6e8
commit
5891799085
@ -413,17 +413,19 @@ BRegion &
|
||||
BRegion::operator=(const BRegion ®ion)
|
||||
{
|
||||
if (®ion != this) {
|
||||
free(data);
|
||||
bound = region.bound;
|
||||
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)
|
||||
data_size = 1;
|
||||
|
||||
data = (clipping_rect *)malloc(data_size * sizeof(clipping_rect));
|
||||
|
||||
memcpy(data, region.data, count * sizeof(clipping_rect));
|
||||
if (data)
|
||||
memcpy(data, region.data, count * sizeof(clipping_rect));
|
||||
}
|
||||
|
||||
return *this;
|
||||
|
Loading…
Reference in New Issue
Block a user