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