blob: 2a5a1af8bf4fb9482d0d41f18b59bef74b15363c [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 Wall2a0aaf92016-12-15 12:31:37 -080075/* The cursor position corresponds to {displayFrame.left, displayFrame.top} */
76hwc_rect_t Hwc2TestLayer::getCursorPosition() const
77{
78 return mDisplayFrame.get();
79}
80
Marissa Wallb72b5c92016-12-15 12:26:39 -080081android_dataspace_t Hwc2TestLayer::getDataspace() const
82{
83 return mDataspace.get();
84}
85
Marissa Wall600a73b2016-12-15 12:30:39 -080086hwc_rect_t Hwc2TestLayer::getDisplayFrame() const
87{
88 return mDisplayFrame.get();
89}
90
Marissa Wall2b1f5302016-12-15 12:27:20 -080091float Hwc2TestLayer::getPlaneAlpha() const
92{
93 return mPlaneAlpha.get();
94}
95
Marissa Wallc57468f2016-12-15 12:31:12 -080096hwc_frect_t Hwc2TestLayer::getSourceCrop() const
97{
98 return mSourceCrop.get();
99}
100
Marissa Wallac108192016-12-15 12:27:48 -0800101hwc_transform_t Hwc2TestLayer::getTransform() const
102{
103 return mTransform.get();
104}
105
Marissa Wall273b1df2016-12-15 12:28:47 -0800106uint32_t Hwc2TestLayer::getZOrder() const
107{
108 return mZOrder;
109}
110
Marissa Wallffc67da2016-12-15 12:26:09 -0800111bool Hwc2TestLayer::advanceBlendMode()
112{
113 return mBlendMode.advance();
114}
115
Marissa Wallc57468f2016-12-15 12:31:12 -0800116bool Hwc2TestLayer::advanceBufferArea()
117{
118 return mBufferArea.advance();
119}
120
Marissa Wallee242782016-12-15 12:30:12 -0800121bool Hwc2TestLayer::advanceColor()
122{
123 return mColor.advance();
124}
125
Marissa Wall6bd8bfd2016-12-15 12:25:31 -0800126bool Hwc2TestLayer::advanceComposition()
127{
128 return mComposition.advance();
129}
Marissa Wallb72b5c92016-12-15 12:26:39 -0800130
Marissa Wall2a0aaf92016-12-15 12:31:37 -0800131bool Hwc2TestLayer::advanceCursorPosition()
132{
133 return mDisplayFrame.advance();
134}
135
Marissa Wallb72b5c92016-12-15 12:26:39 -0800136bool Hwc2TestLayer::advanceDataspace()
137{
138 return mDataspace.advance();
139}
Marissa Wall2b1f5302016-12-15 12:27:20 -0800140
Marissa Wall600a73b2016-12-15 12:30:39 -0800141bool Hwc2TestLayer::advanceDisplayFrame()
142{
143 return mDisplayFrame.advance();
144}
145
Marissa Wall2b1f5302016-12-15 12:27:20 -0800146bool Hwc2TestLayer::advancePlaneAlpha()
147{
148 return mPlaneAlpha.advance();
149}
Marissa Wallac108192016-12-15 12:27:48 -0800150
Marissa Wallc57468f2016-12-15 12:31:12 -0800151bool Hwc2TestLayer::advanceSourceCrop()
152{
153 return mSourceCrop.advance();
154}
155
Marissa Wallac108192016-12-15 12:27:48 -0800156bool Hwc2TestLayer::advanceTransform()
157{
158 return mTransform.advance();
159}