Home | History | Annotate | Download | only in surfaceflinger
      1 #include "RenderArea.h"
      2 
      3 #include <gui/LayerState.h>
      4 
      5 namespace android {
      6 
      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 }
     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  */
     20 status_t RenderArea::updateDimensions(int displayRotation) {
     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 
     30     if (displayRotation & DisplayState::eOrientationSwapMask) {
     31         std::swap(width, height);
     32     }
     33 
     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 
     49 } // namespace android
     50