blob: 96e4b5f48b1aac3e4f9a042fe15c93bc455c8196 [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;
33
Robert Carr578038f2018-03-09 12:25:24 -080034 virtual void render(std::function<void()> drawLayers) { drawLayers(); }
35
chaviwa76b2712017-09-20 12:02:26 -070036 int getReqHeight() const { return mReqHeight; };
37 int getReqWidth() const { return mReqWidth; };
38 Transform::orientation_flags getRotationFlags() const { return mRotationFlags; };
Iris Chang7501ed62018-04-30 14:45:42 +080039 status_t updateDimensions(int displayRotation);
chaviwa76b2712017-09-20 12:02:26 -070040
chaviw50da5042018-04-09 13:49:37 -070041 CaptureFill getCaptureFill() const { return mCaptureFill; };
42
chaviwa76b2712017-09-20 12:02:26 -070043private:
44 uint32_t mReqHeight;
45 uint32_t mReqWidth;
46 Transform::orientation_flags mRotationFlags;
chaviw50da5042018-04-09 13:49:37 -070047 CaptureFill mCaptureFill;
chaviwa76b2712017-09-20 12:02:26 -070048};
49
Chia-I Wu83ce7c12017-10-19 15:18:55 -070050} // namespace android