chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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 | */ |
chaviw | 5bf9d68 | 2017-10-25 16:31:08 -0700 | [diff] [blame] | 16 | #include <android-base/stringprintf.h> |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 17 | #include <layerproto/LayerProtoParser.h> |
chaviw | 5bf9d68 | 2017-10-25 16:31:08 -0700 | [diff] [blame] | 18 | #include <ui/DebugUtils.h> |
| 19 | |
| 20 | using android::base::StringAppendF; |
| 21 | using android::base::StringPrintf; |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 22 | |
| 23 | namespace android { |
| 24 | namespace surfaceflinger { |
chaviw | 5bf9d68 | 2017-10-25 16:31:08 -0700 | [diff] [blame] | 25 | |
chaviw | 7ba019b | 2018-03-14 13:28:39 -0700 | [diff] [blame] | 26 | bool sortLayers(LayerProtoParser::Layer* lhs, const LayerProtoParser::Layer* rhs) { |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 27 | uint32_t ls = lhs->layerStack; |
| 28 | uint32_t rs = rhs->layerStack; |
| 29 | if (ls != rs) return ls < rs; |
| 30 | |
Robert Carr | 83f8e4d | 2017-11-15 14:37:37 -0800 | [diff] [blame] | 31 | int32_t lz = lhs->z; |
| 32 | int32_t rz = rhs->z; |
| 33 | if (lz != rz) { |
Chia-I Wu | b4e0a83 | 2018-09-21 12:18:40 -0700 | [diff] [blame] | 34 | return lz < rz; |
Robert Carr | 83f8e4d | 2017-11-15 14:37:37 -0800 | [diff] [blame] | 35 | } |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 36 | |
| 37 | return lhs->id < rhs->id; |
| 38 | } |
| 39 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 40 | LayerProtoParser::LayerTree LayerProtoParser::generateLayerTree(const LayersProto& layersProto) { |
| 41 | LayerTree layerTree; |
| 42 | layerTree.allLayers = generateLayerList(layersProto); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 43 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 44 | // find and sort the top-level layers |
| 45 | for (Layer& layer : layerTree.allLayers) { |
| 46 | if (layer.parent == nullptr) { |
| 47 | layerTree.topLevelLayers.push_back(&layer); |
chaviw | 7ba019b | 2018-03-14 13:28:39 -0700 | [diff] [blame] | 48 | } |
| 49 | } |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 50 | std::sort(layerTree.topLevelLayers.begin(), layerTree.topLevelLayers.end(), sortLayers); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 51 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 52 | return layerTree; |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 53 | } |
| 54 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 55 | std::vector<LayerProtoParser::Layer> LayerProtoParser::generateLayerList( |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 56 | const LayersProto& layersProto) { |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 57 | std::vector<Layer> layerList; |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 58 | std::unordered_map<int32_t, Layer*> layerMap; |
| 59 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 60 | // build the layer list and the layer map |
| 61 | layerList.reserve(layersProto.layers_size()); |
| 62 | layerMap.reserve(layersProto.layers_size()); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 63 | for (int i = 0; i < layersProto.layers_size(); i++) { |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 64 | layerList.emplace_back(generateLayer(layersProto.layers(i))); |
| 65 | // this works because layerList never changes capacity |
| 66 | layerMap[layerList.back().id] = &layerList.back(); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 67 | } |
| 68 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 69 | // fix up children and relatives |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 70 | for (int i = 0; i < layersProto.layers_size(); i++) { |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 71 | updateChildrenAndRelative(layersProto.layers(i), layerMap); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 72 | } |
| 73 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 74 | return layerList; |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 75 | } |
| 76 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 77 | LayerProtoParser::Layer LayerProtoParser::generateLayer(const LayerProto& layerProto) { |
| 78 | Layer layer; |
| 79 | layer.id = layerProto.id(); |
| 80 | layer.name = layerProto.name(); |
| 81 | layer.type = layerProto.type(); |
| 82 | layer.transparentRegion = generateRegion(layerProto.transparent_region()); |
| 83 | layer.visibleRegion = generateRegion(layerProto.visible_region()); |
| 84 | layer.damageRegion = generateRegion(layerProto.damage_region()); |
| 85 | layer.layerStack = layerProto.layer_stack(); |
| 86 | layer.z = layerProto.z(); |
| 87 | layer.position = {layerProto.position().x(), layerProto.position().y()}; |
| 88 | layer.requestedPosition = {layerProto.requested_position().x(), |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 89 | layerProto.requested_position().y()}; |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 90 | layer.size = {layerProto.size().w(), layerProto.size().h()}; |
| 91 | layer.crop = generateRect(layerProto.crop()); |
| 92 | layer.isOpaque = layerProto.is_opaque(); |
| 93 | layer.invalidate = layerProto.invalidate(); |
| 94 | layer.dataspace = layerProto.dataspace(); |
| 95 | layer.pixelFormat = layerProto.pixel_format(); |
| 96 | layer.color = {layerProto.color().r(), layerProto.color().g(), layerProto.color().b(), |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 97 | layerProto.color().a()}; |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 98 | layer.requestedColor = {layerProto.requested_color().r(), layerProto.requested_color().g(), |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 99 | layerProto.requested_color().b(), layerProto.requested_color().a()}; |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 100 | layer.flags = layerProto.flags(); |
| 101 | layer.transform = generateTransform(layerProto.transform()); |
| 102 | layer.requestedTransform = generateTransform(layerProto.requested_transform()); |
| 103 | layer.activeBuffer = generateActiveBuffer(layerProto.active_buffer()); |
| 104 | layer.bufferTransform = generateTransform(layerProto.buffer_transform()); |
| 105 | layer.queuedFrames = layerProto.queued_frames(); |
| 106 | layer.refreshPending = layerProto.refresh_pending(); |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 107 | layer.isProtected = layerProto.is_protected(); |
Lucas Dupin | 1b6531c | 2018-07-05 17:18:21 -0700 | [diff] [blame] | 108 | layer.cornerRadius = layerProto.corner_radius(); |
Lucas Dupin | 19c8f0e | 2019-11-25 17:55:44 -0800 | [diff] [blame] | 109 | layer.backgroundBlurRadius = layerProto.background_blur_radius(); |
Evan Rosky | 1f6d6d5 | 2018-12-06 10:47:26 -0800 | [diff] [blame] | 110 | for (const auto& entry : layerProto.metadata()) { |
| 111 | const std::string& dataStr = entry.second; |
| 112 | std::vector<uint8_t>& outData = layer.metadata.mMap[entry.first]; |
| 113 | outData.resize(dataStr.size()); |
| 114 | memcpy(outData.data(), dataStr.data(), dataStr.size()); |
| 115 | } |
Vishnu Nair | 95a1ed4 | 2019-12-06 12:25:11 -0800 | [diff] [blame] | 116 | layer.cornerRadiusCrop = generateFloatRect(layerProto.corner_radius_crop()); |
| 117 | layer.shadowRadius = layerProto.shadow_radius(); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 118 | return layer; |
| 119 | } |
| 120 | |
| 121 | LayerProtoParser::Region LayerProtoParser::generateRegion(const RegionProto& regionProto) { |
| 122 | LayerProtoParser::Region region; |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 123 | for (int i = 0; i < regionProto.rect_size(); i++) { |
| 124 | const RectProto& rectProto = regionProto.rect(i); |
| 125 | region.rects.push_back(generateRect(rectProto)); |
| 126 | } |
| 127 | |
| 128 | return region; |
| 129 | } |
| 130 | |
| 131 | LayerProtoParser::Rect LayerProtoParser::generateRect(const RectProto& rectProto) { |
| 132 | LayerProtoParser::Rect rect; |
| 133 | rect.left = rectProto.left(); |
| 134 | rect.top = rectProto.top(); |
| 135 | rect.right = rectProto.right(); |
| 136 | rect.bottom = rectProto.bottom(); |
| 137 | |
| 138 | return rect; |
| 139 | } |
| 140 | |
Yiwei Zhang | 7124ad3 | 2018-02-21 13:02:45 -0800 | [diff] [blame] | 141 | LayerProtoParser::FloatRect LayerProtoParser::generateFloatRect(const FloatRectProto& rectProto) { |
| 142 | LayerProtoParser::FloatRect rect; |
| 143 | rect.left = rectProto.left(); |
| 144 | rect.top = rectProto.top(); |
| 145 | rect.right = rectProto.right(); |
| 146 | rect.bottom = rectProto.bottom(); |
| 147 | |
| 148 | return rect; |
| 149 | } |
| 150 | |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 151 | LayerProtoParser::Transform LayerProtoParser::generateTransform( |
| 152 | const TransformProto& transformProto) { |
| 153 | LayerProtoParser::Transform transform; |
| 154 | transform.dsdx = transformProto.dsdx(); |
| 155 | transform.dtdx = transformProto.dtdx(); |
| 156 | transform.dsdy = transformProto.dsdy(); |
| 157 | transform.dtdy = transformProto.dtdy(); |
| 158 | |
| 159 | return transform; |
| 160 | } |
| 161 | |
| 162 | LayerProtoParser::ActiveBuffer LayerProtoParser::generateActiveBuffer( |
| 163 | const ActiveBufferProto& activeBufferProto) { |
| 164 | LayerProtoParser::ActiveBuffer activeBuffer; |
| 165 | activeBuffer.width = activeBufferProto.width(); |
| 166 | activeBuffer.height = activeBufferProto.height(); |
| 167 | activeBuffer.stride = activeBufferProto.stride(); |
| 168 | activeBuffer.format = activeBufferProto.format(); |
| 169 | |
| 170 | return activeBuffer; |
| 171 | } |
| 172 | |
| 173 | void LayerProtoParser::updateChildrenAndRelative(const LayerProto& layerProto, |
| 174 | std::unordered_map<int32_t, Layer*>& layerMap) { |
| 175 | auto currLayer = layerMap[layerProto.id()]; |
| 176 | |
| 177 | for (int i = 0; i < layerProto.children_size(); i++) { |
| 178 | if (layerMap.count(layerProto.children(i)) > 0) { |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 179 | currLayer->children.push_back(layerMap[layerProto.children(i)]); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 180 | } |
| 181 | } |
| 182 | |
| 183 | for (int i = 0; i < layerProto.relatives_size(); i++) { |
| 184 | if (layerMap.count(layerProto.relatives(i)) > 0) { |
chaviw | 7ba019b | 2018-03-14 13:28:39 -0700 | [diff] [blame] | 185 | currLayer->relatives.push_back(layerMap[layerProto.relatives(i)]); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 186 | } |
| 187 | } |
| 188 | |
Nataniel Borges | dcc0bab | 2019-02-15 13:22:03 -0800 | [diff] [blame] | 189 | if (layerProto.parent() != -1) { |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 190 | if (layerMap.count(layerProto.parent()) > 0) { |
chaviw | 7ba019b | 2018-03-14 13:28:39 -0700 | [diff] [blame] | 191 | currLayer->parent = layerMap[layerProto.parent()]; |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 192 | } |
| 193 | } |
| 194 | |
Nataniel Borges | dcc0bab | 2019-02-15 13:22:03 -0800 | [diff] [blame] | 195 | if (layerProto.z_order_relative_of() != -1) { |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 196 | if (layerMap.count(layerProto.z_order_relative_of()) > 0) { |
chaviw | 7ba019b | 2018-03-14 13:28:39 -0700 | [diff] [blame] | 197 | currLayer->zOrderRelativeOf = layerMap[layerProto.z_order_relative_of()]; |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 198 | } |
| 199 | } |
| 200 | } |
| 201 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 202 | std::string LayerProtoParser::layerTreeToString(const LayerTree& layerTree) { |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 203 | std::string result; |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 204 | for (const LayerProtoParser::Layer* layer : layerTree.topLevelLayers) { |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 205 | if (layer->zOrderRelativeOf != nullptr) { |
| 206 | continue; |
| 207 | } |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 208 | result.append(layerToString(layer)); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 209 | } |
| 210 | |
| 211 | return result; |
| 212 | } |
| 213 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 214 | std::string LayerProtoParser::layerToString(const LayerProtoParser::Layer* layer) { |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 215 | std::string result; |
| 216 | |
chaviw | 7ba019b | 2018-03-14 13:28:39 -0700 | [diff] [blame] | 217 | std::vector<Layer*> traverse(layer->relatives); |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 218 | for (LayerProtoParser::Layer* child : layer->children) { |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 219 | if (child->zOrderRelativeOf != nullptr) { |
| 220 | continue; |
| 221 | } |
| 222 | |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 223 | traverse.push_back(child); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | std::sort(traverse.begin(), traverse.end(), sortLayers); |
| 227 | |
| 228 | size_t i = 0; |
| 229 | for (; i < traverse.size(); i++) { |
chaviw | 7ba019b | 2018-03-14 13:28:39 -0700 | [diff] [blame] | 230 | auto& relative = traverse[i]; |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 231 | if (relative->z >= 0) { |
| 232 | break; |
| 233 | } |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 234 | result.append(layerToString(relative)); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 235 | } |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 236 | result.append(layer->to_string()); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 237 | result.append("\n"); |
| 238 | for (; i < traverse.size(); i++) { |
chaviw | 7ba019b | 2018-03-14 13:28:39 -0700 | [diff] [blame] | 239 | auto& relative = traverse[i]; |
Chia-I Wu | 2f88413 | 2018-09-13 15:17:58 -0700 | [diff] [blame] | 240 | result.append(layerToString(relative)); |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | return result; |
| 244 | } |
| 245 | |
chaviw | 5bf9d68 | 2017-10-25 16:31:08 -0700 | [diff] [blame] | 246 | std::string LayerProtoParser::ActiveBuffer::to_string() const { |
| 247 | return StringPrintf("[%4ux%4u:%4u,%s]", width, height, stride, |
| 248 | decodePixelFormat(format).c_str()); |
| 249 | } |
| 250 | |
| 251 | std::string LayerProtoParser::Transform::to_string() const { |
| 252 | return StringPrintf("[%.2f, %.2f][%.2f, %.2f]", static_cast<double>(dsdx), |
| 253 | static_cast<double>(dtdx), static_cast<double>(dsdy), |
| 254 | static_cast<double>(dtdy)); |
| 255 | } |
| 256 | |
| 257 | std::string LayerProtoParser::Rect::to_string() const { |
| 258 | return StringPrintf("[%3d, %3d, %3d, %3d]", left, top, right, bottom); |
| 259 | } |
| 260 | |
Yiwei Zhang | 7124ad3 | 2018-02-21 13:02:45 -0800 | [diff] [blame] | 261 | std::string LayerProtoParser::FloatRect::to_string() const { |
| 262 | return StringPrintf("[%.2f, %.2f, %.2f, %.2f]", left, top, right, bottom); |
| 263 | } |
| 264 | |
chaviw | 5bf9d68 | 2017-10-25 16:31:08 -0700 | [diff] [blame] | 265 | std::string LayerProtoParser::Region::to_string(const char* what) const { |
| 266 | std::string result = |
| 267 | StringPrintf(" Region %s (this=%lx count=%d)\n", what, static_cast<unsigned long>(id), |
| 268 | static_cast<int>(rects.size())); |
| 269 | |
| 270 | for (auto& rect : rects) { |
| 271 | StringAppendF(&result, " %s\n", rect.to_string().c_str()); |
| 272 | } |
| 273 | |
| 274 | return result; |
| 275 | } |
| 276 | |
| 277 | std::string LayerProtoParser::Layer::to_string() const { |
| 278 | std::string result; |
| 279 | StringAppendF(&result, "+ %s (%s)\n", type.c_str(), name.c_str()); |
| 280 | result.append(transparentRegion.to_string("TransparentRegion").c_str()); |
| 281 | result.append(visibleRegion.to_string("VisibleRegion").c_str()); |
| 282 | result.append(damageRegion.to_string("SurfaceDamageRegion").c_str()); |
| 283 | |
| 284 | StringAppendF(&result, " layerStack=%4d, z=%9d, pos=(%g,%g), size=(%4d,%4d), ", layerStack, |
| 285 | z, static_cast<double>(position.x), static_cast<double>(position.y), size.x, |
| 286 | size.y); |
| 287 | |
Vishnu Nair | dcce0e2 | 2018-08-23 08:35:19 -0700 | [diff] [blame] | 288 | StringAppendF(&result, "crop=%s, ", crop.to_string().c_str()); |
Lucas Dupin | 1b6531c | 2018-07-05 17:18:21 -0700 | [diff] [blame] | 289 | StringAppendF(&result, "cornerRadius=%f, ", cornerRadius); |
Peiyong Lin | 5159855 | 2019-04-17 14:09:22 -0700 | [diff] [blame] | 290 | StringAppendF(&result, "isProtected=%1d, ", isProtected); |
chaviw | 5bf9d68 | 2017-10-25 16:31:08 -0700 | [diff] [blame] | 291 | StringAppendF(&result, "isOpaque=%1d, invalidate=%1d, ", isOpaque, invalidate); |
| 292 | StringAppendF(&result, "dataspace=%s, ", dataspace.c_str()); |
Chia-I Wu | 1e04361 | 2018-03-01 09:45:09 -0800 | [diff] [blame] | 293 | StringAppendF(&result, "defaultPixelFormat=%s, ", pixelFormat.c_str()); |
Lucas Dupin | 19c8f0e | 2019-11-25 17:55:44 -0800 | [diff] [blame] | 294 | StringAppendF(&result, "backgroundBlurRadius=%1d, ", backgroundBlurRadius); |
chaviw | 5bf9d68 | 2017-10-25 16:31:08 -0700 | [diff] [blame] | 295 | StringAppendF(&result, "color=(%.3f,%.3f,%.3f,%.3f), flags=0x%08x, ", |
| 296 | static_cast<double>(color.r), static_cast<double>(color.g), |
| 297 | static_cast<double>(color.b), static_cast<double>(color.a), flags); |
| 298 | StringAppendF(&result, "tr=%s", transform.to_string().c_str()); |
| 299 | result.append("\n"); |
| 300 | StringAppendF(&result, " parent=%s\n", parent == nullptr ? "none" : parent->name.c_str()); |
| 301 | StringAppendF(&result, " zOrderRelativeOf=%s\n", |
| 302 | zOrderRelativeOf == nullptr ? "none" : zOrderRelativeOf->name.c_str()); |
| 303 | StringAppendF(&result, " activeBuffer=%s,", activeBuffer.to_string().c_str()); |
Yichi Chen | 6ca3519 | 2018-05-29 12:20:43 +0800 | [diff] [blame] | 304 | StringAppendF(&result, " tr=%s", bufferTransform.to_string().c_str()); |
rongliu | cfb187b | 2018-03-14 12:26:23 -0700 | [diff] [blame] | 305 | StringAppendF(&result, " queued-frames=%d, mRefreshPending=%d,", queuedFrames, refreshPending); |
Evan Rosky | 1f6d6d5 | 2018-12-06 10:47:26 -0800 | [diff] [blame] | 306 | StringAppendF(&result, " metadata={"); |
| 307 | bool first = true; |
| 308 | for (const auto& entry : metadata.mMap) { |
| 309 | if (!first) result.append(", "); |
| 310 | first = false; |
| 311 | result.append(metadata.itemToString(entry.first, ":")); |
| 312 | } |
Vishnu Nair | 95a1ed4 | 2019-12-06 12:25:11 -0800 | [diff] [blame] | 313 | result.append("},"); |
| 314 | StringAppendF(&result, " cornerRadiusCrop=%s, ", cornerRadiusCrop.to_string().c_str()); |
| 315 | StringAppendF(&result, " shadowRadius=%.3f, ", shadowRadius); |
chaviw | 5bf9d68 | 2017-10-25 16:31:08 -0700 | [diff] [blame] | 316 | return result; |
| 317 | } |
| 318 | |
chaviw | 1d04428 | 2017-09-27 12:19:28 -0700 | [diff] [blame] | 319 | } // namespace surfaceflinger |
| 320 | } // namespace android |