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
This commit is contained in:
parent
ae2cfb5746
commit
6e220a6ce6
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user