diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index 6a9cb3e03..2c06a0b55 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); + TL.set(-src_x, -src_y); + TP.set(dst_x, dst_y); - // 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; + // 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 6542acd29..da15248c4 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); }