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:
Julian Harnath
2015-07-25 16:31:19 +02:00
parent ad53a0d999
commit ccaee9e818
2 changed files with 15 additions and 0 deletions
+13
View File
@@ -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)
{
+2
View File
@@ -69,6 +69,8 @@ public:
BAffineTransform CombinedTransform() const
{ return fCombinedTransform; }
DrawState* Squash();
// additional clipping as requested by client
void SetClippingRegion(const BRegion* region);