* 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:
Stephan Aßmus
2006-03-08 19:03:44 +00:00
parent 907e89c6e8
commit 5891799085
+8 -6
View File
@@ -413,17 +413,19 @@ BRegion &
BRegion::operator=(const BRegion &region) BRegion::operator=(const BRegion &region)
{ {
if (&region != this) { if (&region != 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;