Home | History | Annotate | Download | only in surfaceflinger
      1 #pragma once
      2 
      3 #include <ui/GraphicTypes.h>
      4 
      5 #include "Transform.h"
      6 
      7 #include <functional>
      8 
      9 namespace android {
     10 
     11 class RenderArea {
     12 
     13 public:
     14     enum class CaptureFill {CLEAR, OPAQUE};
     15 
     16     static float getCaptureFillValue(CaptureFill captureFill);
     17 
     18     RenderArea(uint32_t reqHeight, uint32_t reqWidth, CaptureFill captureFill,
     19                ISurfaceComposer::Rotation rotation = ISurfaceComposer::eRotateNone)
     20           : mReqHeight(reqHeight), mReqWidth(reqWidth), mCaptureFill(captureFill) {
     21         mRotationFlags = Transform::fromRotation(rotation);
     22     }
     23 
     24     virtual ~RenderArea() = default;
     25 
     26     virtual const Transform& getTransform() const = 0;
     27     virtual Rect getBounds() const = 0;
     28     virtual int getHeight() const = 0;
     29     virtual int getWidth() const = 0;
     30     virtual bool isSecure() const = 0;
     31     virtual bool needsFiltering() const = 0;
     32     virtual Rect getSourceCrop() const = 0;
     33 
     34     virtual void render(std::function<void()> drawLayers) { drawLayers(); }
     35 
     36     int getReqHeight() const { return mReqHeight; };
     37     int getReqWidth() const { return mReqWidth; };
     38     Transform::orientation_flags getRotationFlags() const { return mRotationFlags; };
     39     status_t updateDimensions(int displayRotation);
     40 
     41     CaptureFill getCaptureFill() const { return mCaptureFill; };
     42 
     43 private:
     44     uint32_t mReqHeight;
     45     uint32_t mReqWidth;
     46     Transform::orientation_flags mRotationFlags;
     47     CaptureFill mCaptureFill;
     48 };
     49 
     50 } // namespace android
     51