summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/RenderArea.cpp
diff options
context:
space:
mode:
author Xin Li <delphij@google.com> 2018-06-08 15:11:57 -0700
committer Xin Li <delphij@google.com> 2018-06-08 15:11:57 -0700
commitf11e2bd016d886a333345dea853ebda23a408d5c (patch)
tree905bd4d25d6ab2b046620ff459777d8dcfa5d7de /services/surfaceflinger/RenderArea.cpp
parentaabd6b7fa343654cd85b3b2da392e424d037d15a (diff)
parent5c947cdf72270fd1f766b2248d526ebc8c7227f6 (diff)
Merge pi-dev-plus-aosp-without-vendor into stage-aosp-master
Bug: 79597307 Change-Id: I6d6bee71b9424eb478780bbfc06b830eb8ded342
Diffstat (limited to 'services/surfaceflinger/RenderArea.cpp')
-rw-r--r--services/surfaceflinger/RenderArea.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/services/surfaceflinger/RenderArea.cpp b/services/surfaceflinger/RenderArea.cpp
new file mode 100644
index 0000000000..1a8edf3e79
--- /dev/null
+++ b/services/surfaceflinger/RenderArea.cpp
@@ -0,0 +1,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