am fa32888f: Merge "Fix display projection transforms" into jb-mr1-dev

* commit 'fa32888f5822093f69522086d96ea2d493011a67':
  Fix display projection transforms
This commit is contained in:
Jesse Hall 2012-09-12 20:18:31 -07:00 committed by Android Git Automerger
commit c66f34d8dd

View File

@ -309,7 +309,7 @@ void DisplayDevice::setProjection(int orientation,
void DisplayDevice::updateGeometryTransform() {
int w = mDisplayWidth;
int h = mDisplayHeight;
Transform R, S;
Transform T, R, S;
if (DisplayDevice::orientationToTransfrom(
mOrientation, w, h, &R) == NO_ERROR) {
dirtyRegion.set(bounds());
@ -340,20 +340,23 @@ void DisplayDevice::updateGeometryTransform() {
float src_height = viewport.height();
float dst_width = frame.width();
float dst_height = frame.height();
if (src_width != src_height || dst_width != dst_height) {
if (src_width != dst_width || src_height != dst_height) {
float sx = dst_width / src_width;
float sy = dst_height / src_height;
S.set(sx, 0, 0, sy);
}
float src_x = viewport.left;
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;
S.set(tx, ty);
T.set(tx, ty);
// rotate first, followed by scaling
mGlobalTransform = S * R;
// 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;
}
}