diff options
Diffstat (limited to 'libs/hwui/DamageAccumulator.cpp')
| -rw-r--r-- | libs/hwui/DamageAccumulator.cpp | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/libs/hwui/DamageAccumulator.cpp b/libs/hwui/DamageAccumulator.cpp index 15bed58..054a164 100644 --- a/libs/hwui/DamageAccumulator.cpp +++ b/libs/hwui/DamageAccumulator.cpp @@ -14,8 +14,6 @@ * limitations under the License. */ -#define LOG_TAG "DamageAccumulator" - #include "DamageAccumulator.h" #include <cutils/log.h> @@ -26,12 +24,6 @@ namespace android { namespace uirenderer { -NullDamageAccumulator NullDamageAccumulator::sInstance; - -NullDamageAccumulator* NullDamageAccumulator::instance() { - return &sInstance; -} - enum TransformType { TransformInvalid = 0, TransformRenderNode, @@ -60,6 +52,30 @@ DamageAccumulator::DamageAccumulator() { mHead->type = TransformNone; } +static void computeTransformImpl(const DirtyStack* currentFrame, Matrix4* outMatrix) { + if (currentFrame->prev != currentFrame) { + computeTransformImpl(currentFrame->prev, outMatrix); + } + switch (currentFrame->type) { + case TransformRenderNode: + currentFrame->renderNode->applyViewPropertyTransforms(*outMatrix); + break; + case TransformMatrix4: + outMatrix->multiply(*currentFrame->matrix4); + break; + case TransformNone: + // nothing to be done + break; + default: + LOG_ALWAYS_FATAL("Tried to compute transform with an invalid type: %d", currentFrame->type); + } +} + +void DamageAccumulator::computeCurrentTransform(Matrix4* outMatrix) const { + outMatrix->loadIdentity(); + computeTransformImpl(mHead, outMatrix); +} + void DamageAccumulator::pushCommon() { if (!mHead->next) { DirtyStack* nextFrame = (DirtyStack*) mAllocator.alloc(sizeof(DirtyStack)); |
