diff options
author | Chris Craik <ccraik@google.com> | 2014-03-11 12:20:17 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-03-12 09:44:41 -0700 |
commit | b79a3e301a8d89b9e1b1f6f3d7fd6aa56610a6f0 (patch) | |
tree | 6b92898b802b665b62127766baa87e8261569062 /libs/hwui/DisplayListOp.h | |
parent | e361ad7ab15fcf4919a56a6293689d968ee8dcff (diff) | |
download | frameworks_base-b79a3e301a8d89b9e1b1f6f3d7fd6aa56610a6f0.zip frameworks_base-b79a3e301a8d89b9e1b1f6f3d7fd6aa56610a6f0.tar.gz frameworks_base-b79a3e301a8d89b9e1b1f6f3d7fd6aa56610a6f0.tar.bz2 |
Fix orthographic shadows projection, simplify shadow reordering
Separate matrix passed to shadow system into two parts, one for
transforming the polygon XY points (using the actual draw matrix) and
a separate one which respects correct 4x4 3d rotations and
translations for determining Z values.
Change-Id: I7e30a84774a8709df6b2241e8f51fc5583648fe8
Diffstat (limited to 'libs/hwui/DisplayListOp.h')
-rw-r--r-- | libs/hwui/DisplayListOp.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h index 65eda29..6ce8317 100644 --- a/libs/hwui/DisplayListOp.h +++ b/libs/hwui/DisplayListOp.h @@ -1534,10 +1534,10 @@ private: const mat4 mTransformFromParent; /** - * Holds the transformation between the 3d root OR projection surface ViewGroup and this - * DisplayList drawing instance. Represents any translations / transformations done within the - * drawing of the compositing ancestor ViewGroup's draw, before the draw of the View represented - * by this DisplayList draw instance. + * Holds the transformation between the projection surface ViewGroup and this DisplayList + * drawing instance. Represents any translations / transformations done within the drawing of + * the compositing ancestor ViewGroup's draw, before the draw of the View represented by this + * DisplayList draw instance. * * Note: doesn't include any transformation recorded within the DisplayList and its properties. */ @@ -1550,19 +1550,20 @@ private: */ class DrawShadowOp : public DrawOp { public: - DrawShadowOp(const mat4& transform, float alpha, const SkPath* outline, + DrawShadowOp(const mat4& transformXY, const mat4& transformZ, float alpha, const SkPath* outline, float fallbackWidth, float fallbackHeight) - : DrawOp(NULL), mTransform(transform), mAlpha(alpha), mOutline(outline), + : DrawOp(NULL), mTransformXY(transformXY), mTransformZ(transformZ), + mAlpha(alpha), mOutline(outline), mFallbackWidth(fallbackWidth), mFallbackHeight(fallbackHeight) {} virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) { - if (!mOutline->isEmpty()) { - return renderer.drawShadow(mTransform, mAlpha, mOutline); + if (mOutline->isEmpty()) { + SkPath fakeOutline; + fakeOutline.addRect(0, 0, mFallbackWidth, mFallbackHeight); + return renderer.drawShadow(mTransformXY, mTransformZ, mAlpha, &fakeOutline); } - SkPath fakeOutline; - fakeOutline.addRect(0, 0, mFallbackWidth, mFallbackHeight); - return renderer.drawShadow(mTransform, mAlpha, &fakeOutline); + return renderer.drawShadow(mTransformXY, mTransformZ, mAlpha, mOutline); } virtual void output(int level, uint32_t logFlags) const { @@ -1572,7 +1573,8 @@ public: virtual const char* name() { return "DrawShadow"; } private: - const mat4 mTransform; + const mat4 mTransformXY; + const mat4 mTransformZ; const float mAlpha; const SkPath* mOutline; const float mFallbackWidth; |