blob: 01d48c4c663d604d6800d745d84cca8fdc78ea39 [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 Wallad761812016-12-15 12:32:24 -080031 mSurfaceDamage(coverage),
Marissa Wall273b1df2016-12-15 12:28:47 -080032 mTransform(coverage),
Marissa Wallc57468f2016-12-15 12:31:12 -080033 mZOrder(zOrder)
34{
35 mBufferArea.setDependent(&mSourceCrop);
Marissa Wallad761812016-12-15 12:32:24 -080036 mBufferArea.setDependent(&mSurfaceDamage);
Marissa Wallee242782016-12-15 12:30:12 -080037 mBlendMode.setDependent(&mColor);
Marissa Wallc57468f2016-12-15 12:31:12 -080038}
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080039
40std::string Hwc2TestLayer::dump() const
41{
42 std::stringstream dmp;
43
44 dmp << "layer: \n";
Marissa Wallffc67da2016-12-15 12:26:09 -080045
46 for (auto property : mProperties) {
47 dmp << property->dump();
48 }
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080049
Marissa Wall273b1df2016-12-15 12:28:47 -080050 dmp << "\tz order: " << mZOrder << "\n";
51
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080052 return dmp.str();
53}
54
55void Hwc2TestLayer::reset()
56{
Marissa Wallffc67da2016-12-15 12:26:09 -080057 for (auto property : mProperties) {
58 property->reset();
59 }
60}
61
62hwc2_blend_mode_t Hwc2TestLayer::getBlendMode() const
63{
64 return mBlendMode.get();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080065}
66
Marissa Wallee242782016-12-15 12:30:12 -080067hwc_color_t Hwc2TestLayer::getColor() const
68{
69 return mColor.get();
70}
71
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080072hwc2_composition_t Hwc2TestLayer::getComposition() const
73{
74 return mComposition.get();
75}
76
Marissa Wall2a0aaf92016-12-15 12:31:37 -080077/* The cursor position corresponds to {displayFrame.left, displayFrame.top} */
78hwc_rect_t Hwc2TestLayer::getCursorPosition() const
79{
80 return mDisplayFrame.get();
81}
82
Marissa Wallb72b5c92016-12-15 12:26:39 -080083android_dataspace_t Hwc2TestLayer::getDataspace() const
84{
85 return mDataspace.get();
86}
87
Marissa Wall600a73b2016-12-15 12:30:39 -080088hwc_rect_t Hwc2TestLayer::getDisplayFrame() const
89{
90 return mDisplayFrame.get();
91}
92
Marissa Wall2b1f5302016-12-15 12:27:20 -080093float Hwc2TestLayer::getPlaneAlpha() const
94{
95 return mPlaneAlpha.get();
96}
97
Marissa Wallc57468f2016-12-15 12:31:12 -080098hwc_frect_t Hwc2TestLayer::getSourceCrop() const
99{
100 return mSourceCrop.get();
101}
102
Marissa Wallad761812016-12-15 12:32:24 -0800103hwc_region_t Hwc2TestLayer::getSurfaceDamage() const
104{
105 return mSurfaceDamage.get();
106}
107
Marissa Wallac108192016-12-15 12:27:48 -0800108hwc_transform_t Hwc2TestLayer::getTransform() const
109{
110 return mTransform.get();
111}
112
Marissa Wall273b1df2016-12-15 12:28:47 -0800113uint32_t Hwc2TestLayer::getZOrder() const
114{
115 return mZOrder;
116}
117
Marissa Wallffc67da2016-12-15 12:26:09 -0800118bool Hwc2TestLayer::advanceBlendMode()
119{
120 return mBlendMode.advance();
121}
122
Marissa Wallc57468f2016-12-15 12:31:12 -0800123bool Hwc2TestLayer::advanceBufferArea()
124{
125 return mBufferArea.advance();
126}
127
Marissa Wallee242782016-12-15 12:30:12 -0800128bool Hwc2TestLayer::advanceColor()
129{
130 return mColor.advance();
131}
132
Marissa Wall6bd8bfd2016-12-15 12:25:31 -0800133bool Hwc2TestLayer::advanceComposition()
134{
135 return mComposition.advance();
136}
Marissa Wallb72b5c92016-12-15 12:26:39 -0800137
Marissa Wall2a0aaf92016-12-15 12:31:37 -0800138bool Hwc2TestLayer::advanceCursorPosition()
139{
140 return mDisplayFrame.advance();
141}
142
Marissa Wallb72b5c92016-12-15 12:26:39 -0800143bool Hwc2TestLayer::advanceDataspace()
144{
145 return mDataspace.advance();
146}
Marissa Wall2b1f5302016-12-15 12:27:20 -0800147
Marissa Wall600a73b2016-12-15 12:30:39 -0800148bool Hwc2TestLayer::advanceDisplayFrame()
149{
150 return mDisplayFrame.advance();
151}
152
Marissa Wall2b1f5302016-12-15 12:27:20 -0800153bool Hwc2TestLayer::advancePlaneAlpha()
154{
155 return mPlaneAlpha.advance();
156}
Marissa Wallac108192016-12-15 12:27:48 -0800157
Marissa Wallc57468f2016-12-15 12:31:12 -0800158bool Hwc2TestLayer::advanceSourceCrop()
159{
160 return mSourceCrop.advance();
161}
162
Marissa Wallad761812016-12-15 12:32:24 -0800163bool Hwc2TestLayer::advanceSurfaceDamage()
164{
165 return mSurfaceDamage.advance();
166}
167
Marissa Wallac108192016-12-15 12:27:48 -0800168bool Hwc2TestLayer::advanceTransform()
169{
170 return mTransform.advance();
171}