diff options
author | Romain Guy <romainguy@google.com> | 2012-10-17 18:18:35 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-10-17 18:18:35 -0700 |
commit | b2e2f2470693e78baed20617f989d9a166864ed4 (patch) | |
tree | c6987b167eba200f405c170e0ddf7e6881aeca3c /libs | |
parent | 9c474738a29f77359a461035855d6e9b3935ade1 (diff) | |
download | frameworks_base-b2e2f2470693e78baed20617f989d9a166864ed4.zip frameworks_base-b2e2f2470693e78baed20617f989d9a166864ed4.tar.gz frameworks_base-b2e2f2470693e78baed20617f989d9a166864ed4.tar.bz2 |
Take into account the texture layer's transform for clipping
Bug #7370212
Change-Id: Ibdc3161306f54a1cfe66e08458f05ee01a13b1df
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/Layer.h | 3 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 26 |
2 files changed, 19 insertions, 10 deletions
diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h index 69be317..448e3da 100644 --- a/libs/hwui/Layer.h +++ b/libs/hwui/Layer.h @@ -209,6 +209,9 @@ struct Layer { } inline void allocateTexture(GLenum format, GLenum storage) { +#if DEBUG_LAYERS + ALOGD(" Allocate layer: %dx%d", getWidth(), getHeight()); +#endif glTexImage2D(renderTarget, 0, format, getWidth(), getHeight(), 0, format, storage, NULL); } diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 406d5e9..b6be5b3 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -895,12 +895,6 @@ void OpenGLRenderer::composeLayer(sp<Snapshot> current, sp<Snapshot> previous) { void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) { float alpha = layer->getAlpha() / 255.0f; - mat4& transform = layer->getTransform(); - if (!transform.isIdentity()) { - save(0); - mSnapshot->transform->multiply(transform); - } - setupDraw(); if (layer->getRenderTarget() == GL_TEXTURE_2D) { setupDrawWithTexture(); @@ -937,10 +931,6 @@ void OpenGLRenderer::drawTextureLayer(Layer* layer, const Rect& rect) { glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount); finishDrawTexture(); - - if (!transform.isIdentity()) { - restore(); - } } void OpenGLRenderer::composeLayerRect(Layer* layer, const Rect& rect, bool swap) { @@ -2792,12 +2782,24 @@ status_t OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* pain return DrawGlInfo::kStatusDone; } + mat4* transform = NULL; + if (layer->isTextureLayer()) { + transform = &layer->getTransform(); + if (!transform->isIdentity()) { + save(0); + mSnapshot->transform->multiply(*transform); + } + } + Rect transformed; Rect clip; const bool rejected = quickRejectNoScissor(x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight(), transformed, clip); if (rejected) { + if (transform && !transform->isIdentity()) { + restore(); + } return DrawGlInfo::kStatusDone; } @@ -2858,6 +2860,10 @@ status_t OpenGLRenderer::drawLayer(Layer* layer, float x, float y, SkPaint* pain } } + if (transform && !transform->isIdentity()) { + restore(); + } + return DrawGlInfo::kStatusDrew; } |