blob: aa609eea38875de4c1a6f5595646aa20455fcf79 [file] [log] [blame]
Marin Shalamanovf6b5d182020-06-12 02:08:51 +02001/*
2 * Copyright 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19#include <string>
20
21#include <ui/GraphicTypes.h>
22#include <ui/Transform.h>
23#include <utils/StrongPointer.h>
24
25#include "RenderArea.h"
26
27namespace android {
28
29class DisplayDevice;
30class Layer;
31class SurfaceFlinger;
32
33class LayerRenderArea : public RenderArea {
34public:
35 LayerRenderArea(SurfaceFlinger& flinger, sp<Layer> layer, const Rect& crop, ui::Size reqSize,
Vishnu Nair36d5f8e2023-03-19 13:31:35 -070036 ui::Dataspace reqDataSpace, bool childrenOnly, bool allowSecureLayers,
Alec Mouri3e5965f2023-04-07 18:00:58 +000037 const ui::Transform& layerTransform, const Rect& layerBufferSize,
38 bool hintForSeamlessTransition);
Marin Shalamanovf6b5d182020-06-12 02:08:51 +020039
40 const ui::Transform& getTransform() const override;
Marin Shalamanovf6b5d182020-06-12 02:08:51 +020041 bool isSecure() const override;
Marin Shalamanovf6b5d182020-06-12 02:08:51 +020042 sp<const DisplayDevice> getDisplayDevice() const override;
43 Rect getSourceCrop() const override;
44
45 void render(std::function<void()> drawLayers) override;
Robert Carr12a3b9b2022-03-10 09:55:29 -080046 virtual sp<Layer> getParentLayer() const { return mLayer; }
Marin Shalamanovf6b5d182020-06-12 02:08:51 +020047
48private:
49 const sp<Layer> mLayer;
Vishnu Nair36d5f8e2023-03-19 13:31:35 -070050 const ui::Transform mLayerTransform;
51 const Rect mLayerBufferSize;
Marin Shalamanovf6b5d182020-06-12 02:08:51 +020052 const Rect mCrop;
53
54 ui::Transform mTransform;
Marin Shalamanovf6b5d182020-06-12 02:08:51 +020055
56 SurfaceFlinger& mFlinger;
57 const bool mChildrenOnly;
58};
59
Robert Carr12a3b9b2022-03-10 09:55:29 -080060} // namespace android