Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 1 | /* |
| 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 | #include <ui/GraphicTypes.h> |
| 18 | #include <ui/Transform.h> |
| 19 | |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 20 | #include "DisplayDevice.h" |
Vishnu Nair | cb8be50 | 2022-10-12 19:03:23 +0000 | [diff] [blame] | 21 | #include "FrontEnd/LayerCreationArgs.h" |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 22 | #include "Layer.h" |
| 23 | #include "LayerRenderArea.h" |
| 24 | #include "SurfaceFlinger.h" |
| 25 | |
| 26 | namespace android { |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 27 | |
Melody Hsu | 50c151a | 2024-05-14 06:11:12 +0000 | [diff] [blame^] | 28 | LayerRenderArea::LayerRenderArea(sp<Layer> layer, frontend::LayerSnapshot layerSnapshot, |
| 29 | const Rect& crop, ui::Size reqSize, ui::Dataspace reqDataSpace, |
| 30 | bool allowSecureLayers, const ui::Transform& layerTransform, |
| 31 | const Rect& layerBufferSize, bool hintForSeamlessTransition) |
Alec Mouri | 3e5965f | 2023-04-07 18:00:58 +0000 | [diff] [blame] | 32 | : RenderArea(reqSize, CaptureFill::CLEAR, reqDataSpace, hintForSeamlessTransition, |
| 33 | allowSecureLayers), |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 34 | mLayer(std::move(layer)), |
Melody Hsu | 50c151a | 2024-05-14 06:11:12 +0000 | [diff] [blame^] | 35 | mLayerSnapshot(std::move(layerSnapshot)), |
Vishnu Nair | 36d5f8e | 2023-03-19 13:31:35 -0700 | [diff] [blame] | 36 | mLayerBufferSize(layerBufferSize), |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 37 | mCrop(crop), |
Melody Hsu | 9db32ff | 2024-04-17 19:52:55 +0000 | [diff] [blame] | 38 | mTransform(layerTransform) {} |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 39 | |
| 40 | const ui::Transform& LayerRenderArea::getTransform() const { |
| 41 | return mTransform; |
| 42 | } |
| 43 | |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 44 | bool LayerRenderArea::isSecure() const { |
chaviw | 70cb6a4 | 2020-07-30 13:57:36 -0700 | [diff] [blame] | 45 | return mAllowSecureLayers; |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 46 | } |
| 47 | |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 48 | sp<const DisplayDevice> LayerRenderArea::getDisplayDevice() const { |
| 49 | return nullptr; |
| 50 | } |
| 51 | |
| 52 | Rect LayerRenderArea::getSourceCrop() const { |
| 53 | if (mCrop.isEmpty()) { |
Vishnu Nair | 36d5f8e | 2023-03-19 13:31:35 -0700 | [diff] [blame] | 54 | // TODO this should probably be mBounds instead of just buffer bounds |
| 55 | return mLayerBufferSize; |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 56 | } else { |
| 57 | return mCrop; |
| 58 | } |
| 59 | } |
| 60 | |
Marin Shalamanov | f6b5d18 | 2020-06-12 02:08:51 +0200 | [diff] [blame] | 61 | } // namespace android |