chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame^] | 1 | #include "RenderArea.h" |
| 2 | |
| 3 | namespace 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 | */ |
| 9 | status_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 |