Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions services/surfaceflinger/DisplayDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,22 @@ void DisplayDevice::setProjection(int orientation,
Rect viewport(newViewport);
Rect frame(newFrame);

int displayOrientation = DisplayState::eOrientationDefault;
char property[PROPERTY_VALUE_MAX];
if (mType == DISPLAY_PRIMARY) {
if (property_get("ro.sf.hwrotation", property, NULL) > 0) {
switch (atoi(property)) {
case 90:
displayOrientation = DisplayState::eOrientation90;
break;
case 270:
displayOrientation = DisplayState::eOrientation270;
break;
}
}
}

orientation = (orientation + displayOrientation) % 4;
const int w = mDisplayWidth;
const int h = mDisplayHeight;

Expand All @@ -440,10 +456,16 @@ void DisplayDevice::setProjection(int orientation,
frame = Rect(h, w);
} else {
frame = Rect(w, h);
if (R.getOrientation() & Transform::ROT_90) {
// frame is always specified in the logical orientation
// of the display (ie: post-rotation).
swap(frame.right, frame.bottom);
}
}
}

if (viewport.isEmpty()) {
b/services/surfaceflinger/SurfaceFlinger.cpp
// viewport can be invalid if it has never been set, in that case
// we assume the whole display size.
// it's also invalid to have an empty viewport, so we handle that
Expand Down