summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-09-13 19:22:41 -0700
committerJeff Brown <jeffbrown@google.com>2012-09-13 19:24:43 -0700
commit6e220a6ce6971555b883f4852c6e5d4c7a617815 (patch)
tree2961331b56b149d1d478fb1f90df20e336c8530d /services
parentae2cfb5746e87f1bf17c446e20274c41ce0a57ce (diff)
downloadframeworks_native-6e220a6ce6971555b883f4852c6e5d4c7a617815.zip
frameworks_native-6e220a6ce6971555b883f4852c6e5d4c7a617815.tar.gz
frameworks_native-6e220a6ce6971555b883f4852c6e5d4c7a617815.tar.bz2
Fix display projections when translated.
There are two different translations to apply in the logical orientation, one before scaling and one after. So translate, scale, translate then rotate. Bug: 7139798 Change-Id: I0726991cadb62988390e77503dbbaed54f07bfe3
Diffstat (limited to 'services')
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp17
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp8
2 files changed, 14 insertions, 11 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 6a9cb3e..2c06a0b 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -309,7 +309,7 @@ void DisplayDevice::setProjection(int orientation,
void DisplayDevice::updateGeometryTransform() {
int w = mDisplayWidth;
int h = mDisplayHeight;
- Transform T, R, S;
+ Transform TL, TP, R, S;
if (DisplayDevice::orientationToTransfrom(
mOrientation, w, h, &R) == NO_ERROR) {
dirtyRegion.set(bounds());
@@ -350,13 +350,12 @@ void DisplayDevice::updateGeometryTransform() {
float src_y = viewport.top;
float dst_x = frame.left;
float dst_y = frame.top;
- float tx = dst_x - src_x;
- float ty = dst_y - src_y;
- T.set(tx, ty);
-
- // The viewport and frame are both in the logical orientation, so the
- // translation is also in that space. So translation must be applied
- // before rotating from logical to physical orientation.
- mGlobalTransform = S * R * T;
+ TL.set(-src_x, -src_y);
+ TP.set(dst_x, dst_y);
+
+ // The viewport and frame are both in the logical orientation.
+ // Apply the logical translation, scale to physical size, apply the
+ // physical translation and finally rotate to the physical orientation.
+ mGlobalTransform = R * TP * S * TL;
}
}
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 6542acd..da15248 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1976,7 +1976,8 @@ void SurfaceFlinger::dumpAllLocked(
snprintf(buffer, SIZE,
"+ DisplayDevice[%u]\n"
" type=%x, layerStack=%u, (%4dx%4d), orient=%2d (type=%08x), "
- "flips=%u, secure=%d, numLayers=%u, v:[%d,%d,%d,%d], f:[%d,%d,%d,%d]\n",
+ "flips=%u, secure=%d, numLayers=%u, v:[%d,%d,%d,%d], f:[%d,%d,%d,%d], "
+ "transform:[[%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f]]\n",
dpy,
hw->getDisplayType(), hw->getLayerStack(),
hw->getWidth(), hw->getHeight(),
@@ -1985,7 +1986,10 @@ void SurfaceFlinger::dumpAllLocked(
hw->getSecureLayerVisible(),
hw->getVisibleLayersSortedByZ().size(),
hw->getViewport().left, hw->getViewport().top, hw->getViewport().right, hw->getViewport().bottom,
- hw->getFrame().left, hw->getFrame().top, hw->getFrame().right, hw->getFrame().bottom);
+ hw->getFrame().left, hw->getFrame().top, hw->getFrame().right, hw->getFrame().bottom,
+ hw->getTransform()[0][0], hw->getTransform()[1][0], hw->getTransform()[2][0],
+ hw->getTransform()[0][1], hw->getTransform()[1][1], hw->getTransform()[2][1],
+ hw->getTransform()[0][2], hw->getTransform()[1][2], hw->getTransform()[2][2]);
result.append(buffer);
}