chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 1 | #include "RenderArea.h" |
| 2 | |
Iris Chang | 7501ed6 | 2018-04-30 14:45:42 +0800 | [diff] [blame^] | 3 | #include <gui/LayerState.h> |
| 4 | |
chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 5 | namespace android { |
| 6 | |
chaviw | 50da504 | 2018-04-09 13:49:37 -0700 | [diff] [blame] | 7 | float RenderArea::getCaptureFillValue(CaptureFill captureFill) { |
| 8 | switch(captureFill) { |
| 9 | case CaptureFill::CLEAR: |
| 10 | return 0.0f; |
| 11 | case CaptureFill::OPAQUE: |
| 12 | default: |
| 13 | return 1.0f; |
| 14 | } |
| 15 | } |
chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 16 | /* |
| 17 | * Checks that the requested width and height are valid and updates them to the render area |
| 18 | * dimensions if they are set to 0 |
| 19 | */ |
Iris Chang | 7501ed6 | 2018-04-30 14:45:42 +0800 | [diff] [blame^] | 20 | status_t RenderArea::updateDimensions(int displayRotation) { |
chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 21 | // get screen geometry |
| 22 | |
| 23 | uint32_t width = getWidth(); |
| 24 | uint32_t height = getHeight(); |
| 25 | |
| 26 | if (mRotationFlags & Transform::ROT_90) { |
| 27 | std::swap(width, height); |
| 28 | } |
| 29 | |
Iris Chang | 7501ed6 | 2018-04-30 14:45:42 +0800 | [diff] [blame^] | 30 | if (displayRotation & DisplayState::eOrientationSwapMask) { |
| 31 | std::swap(width, height); |
| 32 | } |
| 33 | |
chaviw | a76b271 | 2017-09-20 12:02:26 -0700 | [diff] [blame] | 34 | if ((mReqWidth > width) || (mReqHeight > height)) { |
| 35 | ALOGE("size mismatch (%d, %d) > (%d, %d)", mReqWidth, mReqHeight, width, height); |
| 36 | return BAD_VALUE; |
| 37 | } |
| 38 | |
| 39 | if (mReqWidth == 0) { |
| 40 | mReqWidth = width; |
| 41 | } |
| 42 | if (mReqHeight == 0) { |
| 43 | mReqHeight = height; |
| 44 | } |
| 45 | |
| 46 | return NO_ERROR; |
| 47 | } |
| 48 | |
Iris Chang | 7501ed6 | 2018-04-30 14:45:42 +0800 | [diff] [blame^] | 49 | } // namespace android |