diff options
author | Mathias Agopian <mathias@google.com> | 2012-09-04 19:29:13 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2012-09-04 20:23:23 -0700 |
commit | 63f1c43fbef157397869475ef30d23e631b88bbe (patch) | |
tree | f485bac161dae075a2df0b5a1c07a5adc76d0a23 /services/java/com/android/server/display/LogicalDisplay.java | |
parent | d2a8df9541c198d555ef6a50347acb9160509863 (diff) |
update to new SurfaceComposerClient API
Change-Id: I8f2c96df56fe3a851b8ec03bb8734db0b6bea3d5
Diffstat (limited to 'services/java/com/android/server/display/LogicalDisplay.java')
-rw-r--r-- | services/java/com/android/server/display/LogicalDisplay.java | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/services/java/com/android/server/display/LogicalDisplay.java b/services/java/com/android/server/display/LogicalDisplay.java index 32ca1c513fb7..c864189753d0 100644 --- a/services/java/com/android/server/display/LogicalDisplay.java +++ b/services/java/com/android/server/display/LogicalDisplay.java @@ -64,7 +64,8 @@ final class LogicalDisplay { private DisplayDeviceInfo mPrimaryDisplayDeviceInfo; // Temporary rectangle used when needed. - private final Rect mTempRect = new Rect(); + private final Rect mTempLayerStackRect = new Rect(); + private final Rect mTempDisplayRect = new Rect(); public LogicalDisplay(int layerStack, DisplayDevice primaryDisplayDevice) { mLayerStack = layerStack; @@ -208,8 +209,7 @@ final class LogicalDisplay { // Set the viewport. // This is the area of the logical display that we intend to show on the // display device. For now, it is always the full size of the logical display. - mTempRect.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); - device.setViewportInTransactionLocked(mTempRect); + mTempLayerStackRect.set(0, 0, displayInfo.logicalWidth, displayInfo.logicalHeight); // Set the orientation. // The orientation specifies how the physical coordinate system of the display @@ -219,7 +219,6 @@ final class LogicalDisplay { && (displayDeviceInfo.flags & DisplayDeviceInfo.FLAG_SUPPORTS_ROTATION) != 0) { orientation = displayInfo.rotation; } - device.setOrientationInTransactionLocked(orientation); // Set the frame. // The frame specifies the rotated physical coordinates into which the viewport @@ -238,21 +237,23 @@ final class LogicalDisplay { // We avoid a division (and possible floating point imprecision) here by // multiplying the fractions by the product of their denominators before // comparing them. - int frameWidth, frameHeight; + int displayRectWidth, displayRectHeight; if (physWidth * displayInfo.logicalHeight < physHeight * displayInfo.logicalWidth) { // Letter box. - frameWidth = physWidth; - frameHeight = displayInfo.logicalHeight * physWidth / displayInfo.logicalWidth; + displayRectWidth = physWidth; + displayRectHeight = displayInfo.logicalHeight * physWidth / displayInfo.logicalWidth; } else { // Pillar box. - frameWidth = displayInfo.logicalWidth * physHeight / displayInfo.logicalHeight; - frameHeight = physHeight; + displayRectWidth = displayInfo.logicalWidth * physHeight / displayInfo.logicalHeight; + displayRectHeight = physHeight; } - int frameTop = (physHeight - frameHeight) / 2; - int frameLeft = (physWidth - frameWidth) / 2; - mTempRect.set(frameLeft, frameTop, frameLeft + frameWidth, frameTop + frameHeight); - device.setFrameInTransactionLocked(mTempRect); + int displayRectTop = (physHeight - displayRectHeight) / 2; + int displayRectLeft = (physWidth - displayRectWidth) / 2; + mTempDisplayRect.set(displayRectLeft, displayRectTop, + displayRectLeft + displayRectWidth, displayRectTop + displayRectHeight); + + device.setProjectionInTransactionLocked(orientation, mTempLayerStackRect, mTempDisplayRect); } public void dumpLocked(PrintWriter pw) { |