app_server: add Squash method in DrawState
* New method DrawState::Squash() uses the combined scale, origin and transform as the state's own scale, origin, transform. This can be used when making copies of DrawStates which have previous states below them in the state stack. The top of stack DrawState can be copied, squashed and then used just like the original one with the whole stack below it (except of course when trying to pop off any earlier state).
This commit is contained in:
@@ -370,6 +370,19 @@ DrawState::SetTransform(BAffineTransform transform)
|
||||
}
|
||||
|
||||
|
||||
DrawState*
|
||||
DrawState::Squash()
|
||||
{
|
||||
DrawState* const squashedState = new DrawState(*this);
|
||||
|
||||
squashedState->fOrigin = fCombinedOrigin;
|
||||
squashedState->fScale = fCombinedScale;
|
||||
squashedState->fTransform = fCombinedTransform;
|
||||
|
||||
return squashedState;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DrawState::SetClippingRegion(const BRegion* region)
|
||||
{
|
||||
|
||||
@@ -69,6 +69,8 @@ public:
|
||||
BAffineTransform CombinedTransform() const
|
||||
{ return fCombinedTransform; }
|
||||
|
||||
DrawState* Squash();
|
||||
|
||||
// additional clipping as requested by client
|
||||
void SetClippingRegion(const BRegion* region);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user