Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 <sstream> |
| 18 | |
| 19 | #include "Hwc2TestLayer.h" |
| 20 | |
| 21 | Hwc2TestLayer::Hwc2TestLayer(Hwc2TestCoverage coverage) |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 22 | : mBlendMode(coverage), |
Marissa Wall | b72b5c9 | 2016-12-15 12:26:39 -0800 | [diff] [blame] | 23 | mComposition(coverage), |
Marissa Wall | 2b1f530 | 2016-12-15 12:27:20 -0800 | [diff] [blame^] | 24 | mDataspace(coverage), |
| 25 | mPlaneAlpha(coverage) { } |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 26 | |
| 27 | std::string Hwc2TestLayer::dump() const |
| 28 | { |
| 29 | std::stringstream dmp; |
| 30 | |
| 31 | dmp << "layer: \n"; |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 32 | |
| 33 | for (auto property : mProperties) { |
| 34 | dmp << property->dump(); |
| 35 | } |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 36 | |
| 37 | return dmp.str(); |
| 38 | } |
| 39 | |
| 40 | void Hwc2TestLayer::reset() |
| 41 | { |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 42 | for (auto property : mProperties) { |
| 43 | property->reset(); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | hwc2_blend_mode_t Hwc2TestLayer::getBlendMode() const |
| 48 | { |
| 49 | return mBlendMode.get(); |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 50 | } |
| 51 | |
| 52 | hwc2_composition_t Hwc2TestLayer::getComposition() const |
| 53 | { |
| 54 | return mComposition.get(); |
| 55 | } |
| 56 | |
Marissa Wall | b72b5c9 | 2016-12-15 12:26:39 -0800 | [diff] [blame] | 57 | android_dataspace_t Hwc2TestLayer::getDataspace() const |
| 58 | { |
| 59 | return mDataspace.get(); |
| 60 | } |
| 61 | |
Marissa Wall | 2b1f530 | 2016-12-15 12:27:20 -0800 | [diff] [blame^] | 62 | float Hwc2TestLayer::getPlaneAlpha() const |
| 63 | { |
| 64 | return mPlaneAlpha.get(); |
| 65 | } |
| 66 | |
Marissa Wall | ffc67da | 2016-12-15 12:26:09 -0800 | [diff] [blame] | 67 | bool Hwc2TestLayer::advanceBlendMode() |
| 68 | { |
| 69 | return mBlendMode.advance(); |
| 70 | } |
| 71 | |
Marissa Wall | 6bd8bfd | 2016-12-15 12:25:31 -0800 | [diff] [blame] | 72 | bool Hwc2TestLayer::advanceComposition() |
| 73 | { |
| 74 | return mComposition.advance(); |
| 75 | } |
Marissa Wall | b72b5c9 | 2016-12-15 12:26:39 -0800 | [diff] [blame] | 76 | |
| 77 | bool Hwc2TestLayer::advanceDataspace() |
| 78 | { |
| 79 | return mDataspace.advance(); |
| 80 | } |
Marissa Wall | 2b1f530 | 2016-12-15 12:27:20 -0800 | [diff] [blame^] | 81 | |
| 82 | bool Hwc2TestLayer::advancePlaneAlpha() |
| 83 | { |
| 84 | return mPlaneAlpha.advance(); |
| 85 | } |