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