blob: 6225df134d9c147330b0567b129f31b8976a90a9 [file] [log] [blame]
chaviwa76b2712017-09-20 12:02:26 -07001#include "RenderArea.h"
2
3namespace android {
4
5/*
6 * Checks that the requested width and height are valid and updates them to the render area
7 * dimensions if they are set to 0
8 */
9status_t RenderArea::updateDimensions() {
10 // get screen geometry
11
12 uint32_t width = getWidth();
13 uint32_t height = getHeight();
14
15 if (mRotationFlags & Transform::ROT_90) {
16 std::swap(width, height);
17 }
18
19 if ((mReqWidth > width) || (mReqHeight > height)) {
20 ALOGE("size mismatch (%d, %d) > (%d, %d)", mReqWidth, mReqHeight, width, height);
21 return BAD_VALUE;
22 }
23
24 if (mReqWidth == 0) {
25 mReqWidth = width;
26 }
27 if (mReqHeight == 0) {
28 mReqHeight = height;
29 }
30
31 return NO_ERROR;
32}
33
34} // namespace android