blob: b9ca9c3b030c2afbb7e385887374d4d513b5ed9c [file] [log] [blame]
Marissa Wall6bd8bfd2016-12-15 12:25:31 -08001/*
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
Marissa Wall273b1df2016-12-15 12:28:47 -080021Hwc2TestLayer::Hwc2TestLayer(Hwc2TestCoverage coverage, uint32_t zOrder)
Marissa Wallffc67da2016-12-15 12:26:09 -080022 : mBlendMode(coverage),
Marissa Wallb72b5c92016-12-15 12:26:39 -080023 mComposition(coverage),
Marissa Wall2b1f5302016-12-15 12:27:20 -080024 mDataspace(coverage),
Marissa Wallac108192016-12-15 12:27:48 -080025 mPlaneAlpha(coverage),
Marissa Wall273b1df2016-12-15 12:28:47 -080026 mTransform(coverage),
27 mZOrder(zOrder) { }
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080028
29std::string Hwc2TestLayer::dump() const
30{
31 std::stringstream dmp;
32
33 dmp << "layer: \n";
Marissa Wallffc67da2016-12-15 12:26:09 -080034
35 for (auto property : mProperties) {
36 dmp << property->dump();
37 }
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080038
Marissa Wall273b1df2016-12-15 12:28:47 -080039 dmp << "\tz order: " << mZOrder << "\n";
40
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080041 return dmp.str();
42}
43
44void Hwc2TestLayer::reset()
45{
Marissa Wallffc67da2016-12-15 12:26:09 -080046 for (auto property : mProperties) {
47 property->reset();
48 }
49}
50
51hwc2_blend_mode_t Hwc2TestLayer::getBlendMode() const
52{
53 return mBlendMode.get();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080054}
55
56hwc2_composition_t Hwc2TestLayer::getComposition() const
57{
58 return mComposition.get();
59}
60
Marissa Wallb72b5c92016-12-15 12:26:39 -080061android_dataspace_t Hwc2TestLayer::getDataspace() const
62{
63 return mDataspace.get();
64}
65
Marissa Wall2b1f5302016-12-15 12:27:20 -080066float Hwc2TestLayer::getPlaneAlpha() const
67{
68 return mPlaneAlpha.get();
69}
70
Marissa Wallac108192016-12-15 12:27:48 -080071hwc_transform_t Hwc2TestLayer::getTransform() const
72{
73 return mTransform.get();
74}
75
Marissa Wall273b1df2016-12-15 12:28:47 -080076uint32_t Hwc2TestLayer::getZOrder() const
77{
78 return mZOrder;
79}
80
Marissa Wallffc67da2016-12-15 12:26:09 -080081bool Hwc2TestLayer::advanceBlendMode()
82{
83 return mBlendMode.advance();
84}
85
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080086bool Hwc2TestLayer::advanceComposition()
87{
88 return mComposition.advance();
89}
Marissa Wallb72b5c92016-12-15 12:26:39 -080090
91bool Hwc2TestLayer::advanceDataspace()
92{
93 return mDataspace.advance();
94}
Marissa Wall2b1f5302016-12-15 12:27:20 -080095
96bool Hwc2TestLayer::advancePlaneAlpha()
97{
98 return mPlaneAlpha.advance();
99}
Marissa Wallac108192016-12-15 12:27:48 -0800100
101bool Hwc2TestLayer::advanceTransform()
102{
103 return mTransform.advance();
104}