blob: 261fe976a12114a0647d751ca9150f0c2326e1a0 [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 Wallb72b5c92016-12-15 12:26:39 -080024 mComposition(coverage),
Marissa Wall2b1f5302016-12-15 12:27:20 -080025 mDataspace(coverage),
Marissa Wall600a73b2016-12-15 12:30:39 -080026 mDisplayFrame(coverage, displayArea),
Marissa Wallac108192016-12-15 12:27:48 -080027 mPlaneAlpha(coverage),
Marissa Wall273b1df2016-12-15 12:28:47 -080028 mTransform(coverage),
29 mZOrder(zOrder) { }
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080030
31std::string Hwc2TestLayer::dump() const
32{
33 std::stringstream dmp;
34
35 dmp << "layer: \n";
Marissa Wallffc67da2016-12-15 12:26:09 -080036
37 for (auto property : mProperties) {
38 dmp << property->dump();
39 }
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080040
Marissa Wall273b1df2016-12-15 12:28:47 -080041 dmp << "\tz order: " << mZOrder << "\n";
42
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080043 return dmp.str();
44}
45
46void Hwc2TestLayer::reset()
47{
Marissa Wallffc67da2016-12-15 12:26:09 -080048 for (auto property : mProperties) {
49 property->reset();
50 }
51}
52
53hwc2_blend_mode_t Hwc2TestLayer::getBlendMode() const
54{
55 return mBlendMode.get();
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080056}
57
58hwc2_composition_t Hwc2TestLayer::getComposition() const
59{
60 return mComposition.get();
61}
62
Marissa Wallb72b5c92016-12-15 12:26:39 -080063android_dataspace_t Hwc2TestLayer::getDataspace() const
64{
65 return mDataspace.get();
66}
67
Marissa Wall600a73b2016-12-15 12:30:39 -080068hwc_rect_t Hwc2TestLayer::getDisplayFrame() const
69{
70 return mDisplayFrame.get();
71}
72
Marissa Wall2b1f5302016-12-15 12:27:20 -080073float Hwc2TestLayer::getPlaneAlpha() const
74{
75 return mPlaneAlpha.get();
76}
77
Marissa Wallac108192016-12-15 12:27:48 -080078hwc_transform_t Hwc2TestLayer::getTransform() const
79{
80 return mTransform.get();
81}
82
Marissa Wall273b1df2016-12-15 12:28:47 -080083uint32_t Hwc2TestLayer::getZOrder() const
84{
85 return mZOrder;
86}
87
Marissa Wallffc67da2016-12-15 12:26:09 -080088bool Hwc2TestLayer::advanceBlendMode()
89{
90 return mBlendMode.advance();
91}
92
Marissa Wall6bd8bfd2016-12-15 12:25:31 -080093bool Hwc2TestLayer::advanceComposition()
94{
95 return mComposition.advance();
96}
Marissa Wallb72b5c92016-12-15 12:26:39 -080097
98bool Hwc2TestLayer::advanceDataspace()
99{
100 return mDataspace.advance();
101}
Marissa Wall2b1f5302016-12-15 12:27:20 -0800102
Marissa Wall600a73b2016-12-15 12:30:39 -0800103bool Hwc2TestLayer::advanceDisplayFrame()
104{
105 return mDisplayFrame.advance();
106}
107
Marissa Wall2b1f5302016-12-15 12:27:20 -0800108bool Hwc2TestLayer::advancePlaneAlpha()
109{
110 return mPlaneAlpha.advance();
111}
Marissa Wallac108192016-12-15 12:27:48 -0800112
113bool Hwc2TestLayer::advanceTransform()
114{
115 return mTransform.advance();
116}