blob: caf3987701d182933bf0aea3b6f9ee3968ab1205 [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 Wall600a73b2016-12-15 12:30:39 -080021Hwc2TestLayer::Hwc2TestLayer(Hwc2TestCoverage coverage, const Area& displayArea,
22 uint32_t zOrder)
Marissa Wallffc67da2016-12-15 12:26:09 -080023 : mBlendMode(coverage),
Marissa Wallc57468f2016-12-15 12:31:12 -080024 mBufferArea(coverage, displayArea),
Marissa Wallee242782016-12-15 12:30:12 -080025 mColor(coverage),
Marissa Wallb72b5c92016-12-15 12:26:39 -080026 mComposition(coverage),
Marissa Wall2b1f5302016-12-15 12:27:20 -080027 mDataspace(coverage),
Marissa Wall600a73b2016-12-15 12:30:39 -080028 mDisplayFrame(coverage, displayArea),
Marissa Wallac108192016-12-15 12:27:48 -080029 mPlaneAlpha(coverage),
Marissa Wallc57468f2016-12-15 12:31:12 -080030 mSourceCrop(coverage),
Marissa Wall273b1df2016-12-15 12:28:47 -080031 mTransform(coverage),
Marissa Wallc57468f2016-12-15 12:31:12 -080032 mZOrder(zOrder)
33{
34 mBufferArea.setDependent(&mSourceCrop);
Marissa Wallee242782016-12-15 12:30:12 -080035 mBlendMode.setDependent(&mColor);
Marissa Wallc57468f2016-12-15 12:31:12 -080036}
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080037
38std::string Hwc2TestLayer::dump() const
39{
40 std::stringstream dmp;
41
42 dmp << "layer: \n";
Marissa Wallffc67da2016-12-15 12:26:09 -080043
44 for (auto property : mProperties) {
45 dmp << property->dump();
46 }
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080047
Marissa Wall273b1df2016-12-15 12:28:47 -080048 dmp << "\tz order: " << mZOrder << "\n";
49
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080050 return dmp.str();
51}
52
53void Hwc2TestLayer::reset()
54{
Marissa Wallffc67da2016-12-15 12:26:09 -080055 for (auto property : mProperties) {
56 property->reset();
57 }
58}
59
60hwc2_blend_mode_t Hwc2TestLayer::getBlendMode() const
61{
62 return mBlendMode.get();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080063}
64
Marissa Wallee242782016-12-15 12:30:12 -080065hwc_color_t Hwc2TestLayer::getColor() const
66{
67 return mColor.get();
68}
69
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080070hwc2_composition_t Hwc2TestLayer::getComposition() const
71{
72 return mComposition.get();
73}
74
Marissa Wallb72b5c92016-12-15 12:26:39 -080075android_dataspace_t Hwc2TestLayer::getDataspace() const
76{
77 return mDataspace.get();
78}
79
Marissa Wall600a73b2016-12-15 12:30:39 -080080hwc_rect_t Hwc2TestLayer::getDisplayFrame() const
81{
82 return mDisplayFrame.get();
83}
84
Marissa Wall2b1f5302016-12-15 12:27:20 -080085float Hwc2TestLayer::getPlaneAlpha() const
86{
87 return mPlaneAlpha.get();
88}
89
Marissa Wallc57468f2016-12-15 12:31:12 -080090hwc_frect_t Hwc2TestLayer::getSourceCrop() const
91{
92 return mSourceCrop.get();
93}
94
Marissa Wallac108192016-12-15 12:27:48 -080095hwc_transform_t Hwc2TestLayer::getTransform() const
96{
97 return mTransform.get();
98}
99
Marissa Wall273b1df2016-12-15 12:28:47 -0800100uint32_t Hwc2TestLayer::getZOrder() const
101{
102 return mZOrder;
103}
104
Marissa Wallffc67da2016-12-15 12:26:09 -0800105bool Hwc2TestLayer::advanceBlendMode()
106{
107 return mBlendMode.advance();
108}
109
Marissa Wallc57468f2016-12-15 12:31:12 -0800110bool Hwc2TestLayer::advanceBufferArea()
111{
112 return mBufferArea.advance();
113}
114
Marissa Wallee242782016-12-15 12:30:12 -0800115bool Hwc2TestLayer::advanceColor()
116{
117 return mColor.advance();
118}
119
Marissa Wall6bd8bfd2016-12-15 12:25:31 -0800120bool Hwc2TestLayer::advanceComposition()
121{
122 return mComposition.advance();
123}
Marissa Wallb72b5c92016-12-15 12:26:39 -0800124
125bool Hwc2TestLayer::advanceDataspace()
126{
127 return mDataspace.advance();
128}
Marissa Wall2b1f5302016-12-15 12:27:20 -0800129
Marissa Wall600a73b2016-12-15 12:30:39 -0800130bool Hwc2TestLayer::advanceDisplayFrame()
131{
132 return mDisplayFrame.advance();
133}
134
Marissa Wall2b1f5302016-12-15 12:27:20 -0800135bool Hwc2TestLayer::advancePlaneAlpha()
136{
137 return mPlaneAlpha.advance();
138}
Marissa Wallac108192016-12-15 12:27:48 -0800139
Marissa Wallc57468f2016-12-15 12:31:12 -0800140bool Hwc2TestLayer::advanceSourceCrop()
141{
142 return mSourceCrop.advance();
143}
144
Marissa Wallac108192016-12-15 12:27:48 -0800145bool Hwc2TestLayer::advanceTransform()
146{
147 return mTransform.advance();
148}