blob: e38f4621d71faaa5a6672f3bfc53df4b9be59623 [file] [log] [blame]
chaviwa76b2712017-09-20 12:02:26 -07001#pragma once
2
Peiyong Linefefaac2018-08-17 12:27:51 -07003#include <gui/ISurfaceComposer.h>
Peiyong Linfd997e02018-03-28 15:29:00 -07004#include <ui/GraphicTypes.h>
Peiyong Linefefaac2018-08-17 12:27:51 -07005#include <ui/Transform.h>
chaviwa76b2712017-09-20 12:02:26 -07006
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,
Peiyong Linefefaac2018-08-17 12:27:51 -070019 ISurfaceComposer::Rotation rotation = ISurfaceComposer::eRotateNone);
chaviwa76b2712017-09-20 12:02:26 -070020
21 virtual ~RenderArea() = default;
22
Peiyong Linefefaac2018-08-17 12:27:51 -070023 virtual const ui::Transform& getTransform() const = 0;
chaviwa76b2712017-09-20 12:02:26 -070024 virtual Rect getBounds() const = 0;
25 virtual int getHeight() const = 0;
26 virtual int getWidth() const = 0;
27 virtual bool isSecure() const = 0;
28 virtual bool needsFiltering() const = 0;
29 virtual Rect getSourceCrop() const = 0;
30
Robert Carr578038f2018-03-09 12:25:24 -080031 virtual void render(std::function<void()> drawLayers) { drawLayers(); }
32
chaviwa76b2712017-09-20 12:02:26 -070033 int getReqHeight() const { return mReqHeight; };
34 int getReqWidth() const { return mReqWidth; };
Peiyong Linefefaac2018-08-17 12:27:51 -070035 ui::Transform::orientation_flags getRotationFlags() const { return mRotationFlags; };
Iris Chang7501ed62018-04-30 14:45:42 +080036 status_t updateDimensions(int displayRotation);
chaviwa76b2712017-09-20 12:02:26 -070037
chaviw50da5042018-04-09 13:49:37 -070038 CaptureFill getCaptureFill() const { return mCaptureFill; };
39
chaviwa76b2712017-09-20 12:02:26 -070040private:
41 uint32_t mReqHeight;
42 uint32_t mReqWidth;
Peiyong Linefefaac2018-08-17 12:27:51 -070043 ui::Transform::orientation_flags mRotationFlags;
chaviw50da5042018-04-09 13:49:37 -070044 CaptureFill mCaptureFill;
chaviwa76b2712017-09-20 12:02:26 -070045};
46
Chia-I Wu83ce7c12017-10-19 15:18:55 -070047} // namespace android