blob: 46ec8e68ba66a0093bbb6e3b8d84757ecd57cfc8 [file] [log] [blame]
chaviwa76b2712017-09-20 12:02:26 -07001#include "RenderArea.h"
2
3namespace android {
4
chaviw50da5042018-04-09 13:49:37 -07005float 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}
chaviwa76b2712017-09-20 12:02:26 -070014/*
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 */
18status_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