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:
@@ -66,7 +66,10 @@ DrawState::operator=(const DrawState& from)
|
|||||||
fScale = from.fScale;
|
fScale = from.fScale;
|
||||||
|
|
||||||
if (from.fClippingRegion) {
|
if (from.fClippingRegion) {
|
||||||
SetClippingRegion(*(from.fClippingRegion));
|
if (fClippingRegion)
|
||||||
|
*fClippingRegion = *from.fClippingRegion;
|
||||||
|
else
|
||||||
|
fClippingRegion = new BRegion(*from.fClippingRegion);
|
||||||
} else {
|
} else {
|
||||||
delete fClippingRegion;
|
delete fClippingRegion;
|
||||||
fClippingRegion = NULL;
|
fClippingRegion = NULL;
|
||||||
@@ -302,15 +305,24 @@ DrawState::SetScale(float scale)
|
|||||||
void
|
void
|
||||||
DrawState::SetClippingRegion(const BRegion& region)
|
DrawState::SetClippingRegion(const BRegion& region)
|
||||||
{
|
{
|
||||||
if (region.Frame().IsValid()) {
|
// reset clipping to that of previous state
|
||||||
|
if (PreviousState() != NULL && PreviousState()->ClippingRegion()) {
|
||||||
if (fClippingRegion)
|
if (fClippingRegion)
|
||||||
*fClippingRegion = region;
|
*fClippingRegion = *(PreviousState()->ClippingRegion());
|
||||||
else
|
else
|
||||||
fClippingRegion = new BRegion(region);
|
fClippingRegion = new BRegion(*(PreviousState()->ClippingRegion()));
|
||||||
} else {
|
} else {
|
||||||
delete fClippingRegion;
|
delete fClippingRegion;
|
||||||
fClippingRegion = NULL;
|
fClippingRegion = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add the clipping from the passed region
|
||||||
|
if (region.Frame().IsValid()) {
|
||||||
|
if (fClippingRegion)
|
||||||
|
fClippingRegion->IntersectWith(®ion);
|
||||||
|
else
|
||||||
|
fClippingRegion = new BRegion(region);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user