summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-09-24 22:01:01 -0700
committerMathias Agopian <mathias@google.com>2012-09-24 22:15:47 -0700
commita046dd9772cd8da4ead9edc7a89d9992ff0d38cf (patch)
treeb88ff23dc1afefc1f69ebccc13927bf5e86edfaa /services
parente96e9e1093b5700e9f403a6e2479da7dc36d3b71 (diff)
downloadframeworks_native-a046dd9772cd8da4ead9edc7a89d9992ff0d38cf.zip
frameworks_native-a046dd9772cd8da4ead9edc7a89d9992ff0d38cf.tar.gz
frameworks_native-a046dd9772cd8da4ead9edc7a89d9992ff0d38cf.tar.bz2
fix Layer croping in SurfaceFlinger
Bug: 7224628 Change-Id: I9421f0a06b9a27fe00eefaa1dfab8c4309c380c9
Diffstat (limited to 'services')
-rw-r--r--services/surfaceflinger/LayerBase.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index 5ae0ee0..d75dddd 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -232,10 +232,9 @@ void LayerBase::computeGeometry(const sp<const DisplayDevice>& hw, LayerMesh* me
const Layer::State& s(drawingState());
const Transform tr(hw->getTransform() * s.transform);
const uint32_t hw_h = hw->getHeight();
- const Rect& crop(s.active.crop);
Rect win(s.active.w, s.active.h);
- if (!crop.isEmpty()) {
- win.intersect(crop, &win);
+ if (!s.active.crop.isEmpty()) {
+ win.intersect(s.active.crop, &win);
}
if (mesh) {
tr.transform(mesh->mVertices[0], win.left, win.top);
@@ -250,10 +249,9 @@ void LayerBase::computeGeometry(const sp<const DisplayDevice>& hw, LayerMesh* me
Rect LayerBase::computeBounds() const {
const Layer::State& s(drawingState());
- const Rect& crop(s.active.crop);
Rect win(s.active.w, s.active.h);
- if (!crop.isEmpty()) {
- win.intersect(crop, &win);
+ if (!s.active.crop.isEmpty()) {
+ win.intersect(s.active.crop, &win);
}
return s.transform.transform(win);
}
@@ -400,14 +398,15 @@ void LayerBase::drawWithOpenGL(const sp<const DisplayDevice>& hw, const Region&
GLfloat v;
};
- Rect crop(s.active.w, s.active.h);
+ Rect win(s.active.w, s.active.h);
if (!s.active.crop.isEmpty()) {
- crop = s.active.crop;
+ win.intersect(s.active.crop, &win);
}
- GLfloat left = GLfloat(crop.left) / GLfloat(s.active.w);
- GLfloat top = GLfloat(crop.top) / GLfloat(s.active.h);
- GLfloat right = GLfloat(crop.right) / GLfloat(s.active.w);
- GLfloat bottom = GLfloat(crop.bottom) / GLfloat(s.active.h);
+
+ GLfloat left = GLfloat(win.left) / GLfloat(s.active.w);
+ GLfloat top = GLfloat(win.top) / GLfloat(s.active.h);
+ GLfloat right = GLfloat(win.right) / GLfloat(s.active.w);
+ GLfloat bottom = GLfloat(win.bottom) / GLfloat(s.active.h);
TexCoords texCoords[4];
texCoords[0].u = left;