From ccaee9e818cc4ef94f313aa47a0b6c18ff580f57 Mon Sep 17 00:00:00 2001 From: Julian Harnath Date: Wed, 8 Jul 2015 20:07:51 +0200 Subject: [PATCH] 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). --- src/servers/app/DrawState.cpp | 13 +++++++++++++ src/servers/app/DrawState.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/src/servers/app/DrawState.cpp b/src/servers/app/DrawState.cpp index d7f88bc922..9621cfa68e 100644 --- a/src/servers/app/DrawState.cpp +++ b/src/servers/app/DrawState.cpp @@ -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) { diff --git a/src/servers/app/DrawState.h b/src/servers/app/DrawState.h index 392549789f..48a6f371c6 100644 --- a/src/servers/app/DrawState.h +++ b/src/servers/app/DrawState.h @@ -69,6 +69,8 @@ public: BAffineTransform CombinedTransform() const { return fCombinedTransform; } + DrawState* Squash(); + // additional clipping as requested by client void SetClippingRegion(const BRegion* region);