blob: 36306773f7527c618c9311756f0ccf7d97f0f78c [file] [log] [blame]
chaviwa76b2712017-09-20 12:02:26 -07001#pragma once
2
Peiyong Linfd997e02018-03-28 15:29:00 -07003#include <ui/GraphicTypes.h>
Peiyong Lina52f0292018-03-14 17:26:31 -07004
chaviwa76b2712017-09-20 12:02:26 -07005#include "Transform.h"
6
Robert Carr578038f2018-03-09 12:25:24 -08007#include <functional>
8
chaviwa76b2712017-09-20 12:02:26 -07009namespace android {
10
11class RenderArea {
chaviw50da5042018-04-09 13:49:37 -070012
chaviwa76b2712017-09-20 12:02:26 -070013public:
chaviw50da5042018-04-09 13:49:37 -070014 enum class CaptureFill {CLEAR, OPAQUE};
15
16 static float getCaptureFillValue(CaptureFill captureFill);
17
18 RenderArea(uint32_t reqHeight, uint32_t reqWidth, CaptureFill captureFill,
chaviw7206d492017-11-10 16:16:12 -080019 ISurfaceComposer::Rotation rotation = ISurfaceComposer::eRotateNone)
chaviw50da5042018-04-09 13:49:37 -070020 : mReqHeight(reqHeight), mReqWidth(reqWidth), mCaptureFill(captureFill) {
chaviwa76b2712017-09-20 12:02:26 -070021 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;
Peiyong Lindd9b2ae2018-03-01 16:22:45 -080033 virtual bool getWideColorSupport() const = 0;
34 virtual ui::Dataspace getDataSpace() const = 0;
chaviwa76b2712017-09-20 12:02:26 -070035
Robert Carr578038f2018-03-09 12:25:24 -080036 virtual void render(std::function<void()> drawLayers) { drawLayers(); }
37
chaviwa76b2712017-09-20 12:02:26 -070038 int getReqHeight() const { return mReqHeight; };
39 int getReqWidth() const { return mReqWidth; };
40 Transform::orientation_flags getRotationFlags() const { return mRotationFlags; };
chaviwa76b2712017-09-20 12:02:26 -070041 status_t updateDimensions();
42
chaviw50da5042018-04-09 13:49:37 -070043 CaptureFill getCaptureFill() const { return mCaptureFill; };
44
chaviwa76b2712017-09-20 12:02:26 -070045private:
46 uint32_t mReqHeight;
47 uint32_t mReqWidth;
48 Transform::orientation_flags mRotationFlags;
chaviw50da5042018-04-09 13:49:37 -070049 CaptureFill mCaptureFill;
chaviwa76b2712017-09-20 12:02:26 -070050};
51
Chia-I Wu83ce7c12017-10-19 15:18:55 -070052} // namespace android