summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-10-17 19:21:20 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-10-17 19:21:20 -0700
commit3786a9b97a5a149c7f8a68a0f6c4cc4c063be7ac (patch)
tree228738ed3d16954b3c6a1c56651c3603be772433 /libs
parent6296d230034999d4d0d5b84fa70c2a120bdea484 (diff)
parent07a9ebd1a01bc2819a90ddc98263a24bd6459768 (diff)
downloadframeworks_base-3786a9b97a5a149c7f8a68a0f6c4cc4c063be7ac.zip
frameworks_base-3786a9b97a5a149c7f8a68a0f6c4cc4c063be7ac.tar.gz
frameworks_base-3786a9b97a5a149c7f8a68a0f6c4cc4c063be7ac.tar.bz2
am 07a9ebd1: am b8460d15: Merge "Take into account the texture layer\'s transform for clipping Bug #7370212" into jb-mr1-dev
* commit '07a9ebd1a01bc2819a90ddc98263a24bd6459768': Take into account the texture layer's transform for clipping Bug #7370212
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/Layer.h3
-rw-r--r--libs/hwui/OpenGLRenderer.cpp26
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;
}