the current clipping is the combined user defined clipping from all previous states
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14846 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
d3b27f09af
commit
41f78f7884
@ -66,7 +66,10 @@ DrawState::operator=(const DrawState& from)
|
||||
fScale = from.fScale;
|
||||
|
||||
if (from.fClippingRegion) {
|
||||
SetClippingRegion(*(from.fClippingRegion));
|
||||
if (fClippingRegion)
|
||||
*fClippingRegion = *from.fClippingRegion;
|
||||
else
|
||||
fClippingRegion = new BRegion(*from.fClippingRegion);
|
||||
} else {
|
||||
delete fClippingRegion;
|
||||
fClippingRegion = NULL;
|
||||
@ -302,15 +305,24 @@ DrawState::SetScale(float scale)
|
||||
void
|
||||
DrawState::SetClippingRegion(const BRegion& region)
|
||||
{
|
||||
if (region.Frame().IsValid()) {
|
||||
// reset clipping to that of previous state
|
||||
if (PreviousState() != NULL && PreviousState()->ClippingRegion()) {
|
||||
if (fClippingRegion)
|
||||
*fClippingRegion = region;
|
||||
else
|
||||
fClippingRegion = new BRegion(region);
|
||||
*fClippingRegion = *(PreviousState()->ClippingRegion());
|
||||
else
|
||||
fClippingRegion = new BRegion(*(PreviousState()->ClippingRegion()));
|
||||
} else {
|
||||
delete fClippingRegion;
|
||||
fClippingRegion = NULL;
|
||||
}
|
||||
|
||||
// add the clipping from the passed region
|
||||
if (region.Frame().IsValid()) {
|
||||
if (fClippingRegion)
|
||||
fClippingRegion->IntersectWith(®ion);
|
||||
else
|
||||
fClippingRegion = new BRegion(region);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user