blob: cdf4392684c850cbfb81bf4123a3fb0721efb3ae [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 Wallb72b5c92016-12-15 12:26:39 -080025 mComposition(coverage),
Marissa Wall2b1f5302016-12-15 12:27:20 -080026 mDataspace(coverage),
Marissa Wall600a73b2016-12-15 12:30:39 -080027 mDisplayFrame(coverage, displayArea),
Marissa Wallac108192016-12-15 12:27:48 -080028 mPlaneAlpha(coverage),
Marissa Wallc57468f2016-12-15 12:31:12 -080029 mSourceCrop(coverage),
Marissa Wall273b1df2016-12-15 12:28:47 -080030 mTransform(coverage),
Marissa Wallc57468f2016-12-15 12:31:12 -080031 mZOrder(zOrder)
32{
33 mBufferArea.setDependent(&mSourceCrop);
34}
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080035
36std::string Hwc2TestLayer::dump() const
37{
38 std::stringstream dmp;
39
40 dmp << "layer: \n";
Marissa Wallffc67da2016-12-15 12:26:09 -080041
42 for (auto property : mProperties) {
43 dmp << property->dump();
44 }
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080045
Marissa Wall273b1df2016-12-15 12:28:47 -080046 dmp << "\tz order: " << mZOrder << "\n";
47
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080048 return dmp.str();
49}
50
51void Hwc2TestLayer::reset()
52{
Marissa Wallffc67da2016-12-15 12:26:09 -080053 for (auto property : mProperties) {
54 property->reset();
55 }
56}
57
58hwc2_blend_mode_t Hwc2TestLayer::getBlendMode() const
59{
60 return mBlendMode.get();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080061}
62
63hwc2_composition_t Hwc2TestLayer::getComposition() const
64{
65 return mComposition.get();
66}
67
Marissa Wallb72b5c92016-12-15 12:26:39 -080068android_dataspace_t Hwc2TestLayer::getDataspace() const
69{
70 return mDataspace.get();
71}
72
Marissa Wall600a73b2016-12-15 12:30:39 -080073hwc_rect_t Hwc2TestLayer::getDisplayFrame() const
74{
75 return mDisplayFrame.get();
76}
77
Marissa Wall2b1f5302016-12-15 12:27:20 -080078float Hwc2TestLayer::getPlaneAlpha() const
79{
80 return mPlaneAlpha.get();
81}
82
Marissa Wallc57468f2016-12-15 12:31:12 -080083hwc_frect_t Hwc2TestLayer::getSourceCrop() const
84{
85 return mSourceCrop.get();
86}
87
Marissa Wallac108192016-12-15 12:27:48 -080088hwc_transform_t Hwc2TestLayer::getTransform() const
89{
90 return mTransform.get();
91}
92
Marissa Wall273b1df2016-12-15 12:28:47 -080093uint32_t Hwc2TestLayer::getZOrder() const
94{
95 return mZOrder;
96}
97
Marissa Wallffc67da2016-12-15 12:26:09 -080098bool Hwc2TestLayer::advanceBlendMode()
99{
100 return mBlendMode.advance();
101}
102
Marissa Wallc57468f2016-12-15 12:31:12 -0800103bool Hwc2TestLayer::advanceBufferArea()
104{
105 return mBufferArea.advance();
106}
107
Marissa Wall6bd8bfd2016-12-15 12:25:31 -0800108bool Hwc2TestLayer::advanceComposition()
109{
110 return mComposition.advance();
111}
Marissa Wallb72b5c92016-12-15 12:26:39 -0800112
113bool Hwc2TestLayer::advanceDataspace()
114{
115 return mDataspace.advance();
116}
Marissa Wall2b1f5302016-12-15 12:27:20 -0800117
Marissa Wall600a73b2016-12-15 12:30:39 -0800118bool Hwc2TestLayer::advanceDisplayFrame()
119{
120 return mDisplayFrame.advance();
121}
122
Marissa Wall2b1f5302016-12-15 12:27:20 -0800123bool Hwc2TestLayer::advancePlaneAlpha()
124{
125 return mPlaneAlpha.advance();
126}
Marissa Wallac108192016-12-15 12:27:48 -0800127
Marissa Wallc57468f2016-12-15 12:31:12 -0800128bool Hwc2TestLayer::advanceSourceCrop()
129{
130 return mSourceCrop.advance();
131}
132
Marissa Wallac108192016-12-15 12:27:48 -0800133bool Hwc2TestLayer::advanceTransform()
134{
135 return mTransform.advance();
136}