| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/debug/debug_colors.h" | 5 #include "cc/debug/debug_colors.h" |
| 6 | 6 |
| 7 #include "cc/trees/layer_tree_impl.h" | 7 #include "cc/trees/layer_tree_impl.h" |
| 8 | 8 |
| 9 namespace cc { | 9 namespace cc { |
| 10 | 10 |
| 11 static const float Scale(float width, const LayerTreeImpl* tree_impl) { | 11 static const float Scale(float width, const LayerTreeImpl* tree_impl) { |
| 12 return width * (tree_impl ? tree_impl->device_scale_factor() : 1); | 12 return width * (tree_impl ? tree_impl->device_scale_factor() : 1); |
| 13 } | 13 } |
| 14 | 14 |
| 15 // ======= Layer border colors ======= | 15 // ======= Layer border colors ======= |
| 16 | 16 |
| 17 // Tiled content layers are orange. | 17 // Tiled content layers are orange. |
| 18 SkColor DebugColors::TiledContentLayerBorderColor() { return SkColorSetARGB(128,
255, 128, 0); } | 18 SkColor DebugColors::TiledContentLayerBorderColor() { |
| 19 int DebugColors::TiledContentLayerBorderWidth(const LayerTreeImpl* tree_impl) {
return Scale(2, tree_impl); } | 19 return SkColorSetARGB(128, 255, 128, 0); |
| 20 } |
| 21 int DebugColors::TiledContentLayerBorderWidth(const LayerTreeImpl* tree_impl) { |
| 22 return Scale(2, tree_impl); |
| 23 } |
| 20 | 24 |
| 21 // Image layers are olive. | 25 // Image layers are olive. |
| 22 SkColor DebugColors::ImageLayerBorderColor() { return SkColorSetARGB(128, 128, 1
28, 0); } | 26 SkColor DebugColors::ImageLayerBorderColor() { |
| 23 int DebugColors::ImageLayerBorderWidth(const LayerTreeImpl* tree_impl) { return
Scale(2, tree_impl); } | 27 return SkColorSetARGB(128, 128, 128, 0); |
| 28 } |
| 29 int DebugColors::ImageLayerBorderWidth(const LayerTreeImpl* tree_impl) { |
| 30 return Scale(2, tree_impl); |
| 31 } |
| 24 | 32 |
| 25 // Non-tiled content layers area green. | 33 // Non-tiled content layers area green. |
| 26 SkColor DebugColors::ContentLayerBorderColor() { return SkColorSetARGB(128, 0, 1
28, 32); } | 34 SkColor DebugColors::ContentLayerBorderColor() { |
| 27 int DebugColors::ContentLayerBorderWidth(const LayerTreeImpl* tree_impl) { retur
n Scale(2, tree_impl); } | 35 return SkColorSetARGB(128, 0, 128, 32); |
| 36 } |
| 37 int DebugColors::ContentLayerBorderWidth(const LayerTreeImpl* tree_impl) { |
| 38 return Scale(2, tree_impl); |
| 39 } |
| 28 | 40 |
| 29 // Masking layers are pale blue and wide. | 41 // Masking layers are pale blue and wide. |
| 30 SkColor DebugColors::MaskingLayerBorderColor() { return SkColorSetARGB(48, 128,
255, 255); } | 42 SkColor DebugColors::MaskingLayerBorderColor() { |
| 31 int DebugColors::MaskingLayerBorderWidth(const LayerTreeImpl* tree_impl) { retur
n Scale(20, tree_impl); } | 43 return SkColorSetARGB(48, 128, 255, 255); |
| 44 } |
| 45 int DebugColors::MaskingLayerBorderWidth(const LayerTreeImpl* tree_impl) { |
| 46 return Scale(20, tree_impl); |
| 47 } |
| 32 | 48 |
| 33 // Other container layers are yellow. | 49 // Other container layers are yellow. |
| 34 SkColor DebugColors::ContainerLayerBorderColor() { return SkColorSetARGB(192, 25
5, 255, 0); } | 50 SkColor DebugColors::ContainerLayerBorderColor() { |
| 35 int DebugColors::ContainerLayerBorderWidth(const LayerTreeImpl* tree_impl) { ret
urn Scale(2, tree_impl); } | 51 return SkColorSetARGB(192, 255, 255, 0); |
| 52 } |
| 53 int DebugColors::ContainerLayerBorderWidth(const LayerTreeImpl* tree_impl) { |
| 54 return Scale(2, tree_impl); |
| 55 } |
| 36 | 56 |
| 37 // Render surfaces are blue. | 57 // Render surfaces are blue. |
| 38 SkColor DebugColors::SurfaceBorderColor() { return SkColorSetARGB(100, 0, 0, 255
); } | 58 SkColor DebugColors::SurfaceBorderColor() { |
| 39 int DebugColors::SurfaceBorderWidth(const LayerTreeImpl* tree_impl) { return Sca
le(2, tree_impl); } | 59 return SkColorSetARGB(100, 0, 0, 255); |
| 60 } |
| 61 int DebugColors::SurfaceBorderWidth(const LayerTreeImpl* tree_impl) { |
| 62 return Scale(2, tree_impl); |
| 63 } |
| 40 | 64 |
| 41 // Replicas of render surfaces are purple. | 65 // Replicas of render surfaces are purple. |
| 42 SkColor DebugColors::SurfaceReplicaBorderColor() { return SkColorSetARGB(100, 16
0, 0, 255); } | 66 SkColor DebugColors::SurfaceReplicaBorderColor() { |
| 43 int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeImpl* tree_impl) { ret
urn Scale(2, tree_impl); } | 67 return SkColorSetARGB(100, 160, 0, 255); |
| 68 } |
| 69 int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeImpl* tree_impl) { |
| 70 return Scale(2, tree_impl); |
| 71 } |
| 44 | 72 |
| 45 // ======= Tile colors ======= | 73 // ======= Tile colors ======= |
| 46 | 74 |
| 47 // High-res tile borders are cyan. | 75 // High-res tile borders are cyan. |
| 48 SkColor DebugColors::HighResTileBorderColor() { return SkColorSetARGB(100, 80, 2
00, 200); } | 76 SkColor DebugColors::HighResTileBorderColor() { |
| 49 int DebugColors::HighResTileBorderWidth(const LayerTreeImpl* tree_impl) { return
Scale(1, tree_impl); } | 77 return SkColorSetARGB(100, 80, 200, 200); |
| 78 } |
| 79 int DebugColors::HighResTileBorderWidth(const LayerTreeImpl* tree_impl) { |
| 80 return Scale(1, tree_impl); |
| 81 } |
| 50 | 82 |
| 51 // Low-res tile borders are purple. | 83 // Low-res tile borders are purple. |
| 52 SkColor DebugColors::LowResTileBorderColor() { return SkColorSetARGB(100, 212, 8
3, 192); } | 84 SkColor DebugColors::LowResTileBorderColor() { |
| 53 int DebugColors::LowResTileBorderWidth(const LayerTreeImpl* tree_impl) { return
Scale(2, tree_impl); } | 85 return SkColorSetARGB(100, 212, 83, 192); |
| 86 } |
| 87 int DebugColors::LowResTileBorderWidth(const LayerTreeImpl* tree_impl) { |
| 88 return Scale(2, tree_impl); |
| 89 } |
| 54 | 90 |
| 55 // Other high-resolution tile borders are yellow. | 91 // Other high-resolution tile borders are yellow. |
| 56 SkColor DebugColors::ExtraHighResTileBorderColor() { return SkColorSetARGB(100,
239, 231, 20); } | 92 SkColor DebugColors::ExtraHighResTileBorderColor() { |
| 57 int DebugColors::ExtraHighResTileBorderWidth(const LayerTreeImpl* tree_impl) { r
eturn Scale(2, tree_impl); } | 93 return SkColorSetARGB(100, 239, 231, 20); |
| 94 } |
| 95 int DebugColors::ExtraHighResTileBorderWidth(const LayerTreeImpl* tree_impl) { |
| 96 return Scale(2, tree_impl); |
| 97 } |
| 58 | 98 |
| 59 // Other low-resolution tile borders are green. | 99 // Other low-resolution tile borders are green. |
| 60 SkColor DebugColors::ExtraLowResTileBorderColor() { return SkColorSetARGB(100, 9
3, 186, 18); } | 100 SkColor DebugColors::ExtraLowResTileBorderColor() { |
| 61 int DebugColors::ExtraLowResTileBorderWidth(const LayerTreeImpl* tree_impl) { re
turn Scale(2, tree_impl); } | 101 return SkColorSetARGB(100, 93, 186, 18); |
| 102 } |
| 103 int DebugColors::ExtraLowResTileBorderWidth(const LayerTreeImpl* tree_impl) { |
| 104 return Scale(2, tree_impl); |
| 105 } |
| 62 | 106 |
| 63 // Missing tile borders are red. | 107 // Missing tile borders are red. |
| 64 SkColor DebugColors::MissingTileBorderColor() { return SkColorSetARGB(100, 255,
0, 0); } | 108 SkColor DebugColors::MissingTileBorderColor() { |
| 65 int DebugColors::MissingTileBorderWidth(const LayerTreeImpl* tree_impl) { return
Scale(1, tree_impl); } | 109 return SkColorSetARGB(100, 255, 0, 0); |
| 110 } |
| 111 int DebugColors::MissingTileBorderWidth(const LayerTreeImpl* tree_impl) { |
| 112 return Scale(1, tree_impl); |
| 113 } |
| 66 | 114 |
| 67 // Culled tile borders are brown. | 115 // Culled tile borders are brown. |
| 68 SkColor DebugColors::CulledTileBorderColor() { return SkColorSetARGB(120, 160, 1
00, 0); } | 116 SkColor DebugColors::CulledTileBorderColor() { |
| 69 int DebugColors::CulledTileBorderWidth(const LayerTreeImpl* tree_impl) { return
Scale(1, tree_impl); } | 117 return SkColorSetARGB(120, 160, 100, 0); |
| 118 } |
| 119 int DebugColors::CulledTileBorderWidth(const LayerTreeImpl* tree_impl) { |
| 120 return Scale(1, tree_impl); |
| 121 } |
| 70 | 122 |
| 71 // Solid color tile borders are grey. | 123 // Solid color tile borders are grey. |
| 72 SkColor DebugColors::SolidColorTileBorderColor() { return SkColorSetARGB(128, 12
8, 128, 128); } | 124 SkColor DebugColors::SolidColorTileBorderColor() { |
| 73 int DebugColors::SolidColorTileBorderWidth(const LayerTreeImpl* tree_impl) { ret
urn Scale(1, tree_impl); } | 125 return SkColorSetARGB(128, 128, 128, 128); |
| 126 } |
| 127 int DebugColors::SolidColorTileBorderWidth(const LayerTreeImpl* tree_impl) { |
| 128 return Scale(1, tree_impl); |
| 129 } |
| 74 | 130 |
| 75 // ======= Checkerboard colors ======= | 131 // ======= Checkerboard colors ======= |
| 76 | 132 |
| 77 // Non-debug checkerboards are grey. | 133 // Non-debug checkerboards are grey. |
| 78 SkColor DebugColors::DefaultCheckerboardColor() { return SkColorSetRGB(241, 241,
241); } | 134 SkColor DebugColors::DefaultCheckerboardColor() { |
| 135 return SkColorSetRGB(241, 241, 241); |
| 136 } |
| 79 | 137 |
| 80 // Invalidated tiles get sky blue checkerboards. | 138 // Invalidated tiles get sky blue checkerboards. |
| 81 SkColor DebugColors::InvalidatedTileCheckerboardColor() { return SkColorSetRGB(1
28, 200, 245); } | 139 SkColor DebugColors::InvalidatedTileCheckerboardColor() { |
| 140 return SkColorSetRGB(128, 200, 245); |
| 141 } |
| 82 | 142 |
| 83 // Evicted tiles get pale red checkerboards. | 143 // Evicted tiles get pale red checkerboards. |
| 84 SkColor DebugColors::EvictedTileCheckerboardColor() { return SkColorSetRGB(255,
200, 200); } | 144 SkColor DebugColors::EvictedTileCheckerboardColor() { |
| 145 return SkColorSetRGB(255, 200, 200); |
| 146 } |
| 85 | 147 |
| 86 // ======= Debug rect colors ======= | 148 // ======= Debug rect colors ======= |
| 87 | 149 |
| 88 // Paint rects in red. | 150 // Paint rects in red. |
| 89 SkColor DebugColors::PaintRectBorderColor() { return SkColorSetARGB(255, 255, 0,
0); } | 151 SkColor DebugColors::PaintRectBorderColor() { |
| 90 int DebugColors::PaintRectBorderWidth(const LayerTreeImpl* tree_impl) { return S
cale(2, tree_impl); } | 152 return SkColorSetARGB(255, 255, 0, 0); |
| 91 SkColor DebugColors::PaintRectFillColor() { return SkColorSetARGB(30, 255, 0, 0)
; } | 153 } |
| 154 int DebugColors::PaintRectBorderWidth(const LayerTreeImpl* tree_impl) { |
| 155 return Scale(2, tree_impl); |
| 156 } |
| 157 SkColor DebugColors::PaintRectFillColor() { |
| 158 return SkColorSetARGB(30, 255, 0, 0); |
| 159 } |
| 92 | 160 |
| 93 // Property-changed rects in blue. | 161 // Property-changed rects in blue. |
| 94 SkColor DebugColors::PropertyChangedRectBorderColor() { return SkColorSetARGB(25
5, 0, 0, 255); } | 162 SkColor DebugColors::PropertyChangedRectBorderColor() { |
| 95 int DebugColors::PropertyChangedRectBorderWidth(const LayerTreeImpl* tree_impl)
{ return Scale(2, tree_impl); } | 163 return SkColorSetARGB(255, 0, 0, 255); |
| 96 SkColor DebugColors::PropertyChangedRectFillColor() { return SkColorSetARGB(30,
0, 0, 255); } | 164 } |
| 165 int DebugColors::PropertyChangedRectBorderWidth( |
| 166 const LayerTreeImpl* tree_impl) { |
| 167 return Scale(2, tree_impl); |
| 168 } |
| 169 SkColor DebugColors::PropertyChangedRectFillColor() { |
| 170 return SkColorSetARGB(30, 0, 0, 255); |
| 171 } |
| 97 | 172 |
| 98 // Surface damage rects in yellow-orange. | 173 // Surface damage rects in yellow-orange. |
| 99 SkColor DebugColors::SurfaceDamageRectBorderColor() { return SkColorSetARGB(255,
200, 100, 0); } | 174 SkColor DebugColors::SurfaceDamageRectBorderColor() { |
| 100 int DebugColors::SurfaceDamageRectBorderWidth(const LayerTreeImpl* tree_impl) {
return Scale(2, tree_impl); } | 175 return SkColorSetARGB(255, 200, 100, 0); |
| 101 SkColor DebugColors::SurfaceDamageRectFillColor() { return SkColorSetARGB(30, 20
0, 100, 0); } | 176 } |
| 177 int DebugColors::SurfaceDamageRectBorderWidth(const LayerTreeImpl* tree_impl) { |
| 178 return Scale(2, tree_impl); |
| 179 } |
| 180 SkColor DebugColors::SurfaceDamageRectFillColor() { |
| 181 return SkColorSetARGB(30, 200, 100, 0); |
| 182 } |
| 102 | 183 |
| 103 // Surface replica screen space rects in green. | 184 // Surface replica screen space rects in green. |
| 104 SkColor DebugColors::ScreenSpaceLayerRectBorderColor() { return SkColorSetARGB(2
55, 100, 200, 0); } | 185 SkColor DebugColors::ScreenSpaceLayerRectBorderColor() { |
| 105 int DebugColors::ScreenSpaceLayerRectBorderWidth(const LayerTreeImpl* tree_impl)
{ return Scale(2, tree_impl); } | 186 return SkColorSetARGB(255, 100, 200, 0); |
| 106 SkColor DebugColors::ScreenSpaceLayerRectFillColor() { return SkColorSetARGB(30,
100, 200, 0); } | 187 } |
| 188 int DebugColors::ScreenSpaceLayerRectBorderWidth( |
| 189 const LayerTreeImpl* tree_impl) { |
| 190 return Scale(2, tree_impl); |
| 191 } |
| 192 SkColor DebugColors::ScreenSpaceLayerRectFillColor() { |
| 193 return SkColorSetARGB(30, 100, 200, 0); |
| 194 } |
| 107 | 195 |
| 108 // Layer screen space rects in purple. | 196 // Layer screen space rects in purple. |
| 109 SkColor DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() { return SkColor
SetARGB(255, 100, 0, 200); } | 197 SkColor DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() { |
| 110 int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(const LayerTreeImpl* t
ree_impl) { return Scale(2, tree_impl); } | 198 return SkColorSetARGB(255, 100, 0, 200); |
| 111 SkColor DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() { return SkColorSe
tARGB(10, 100, 0, 200); } | 199 } |
| 200 int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth( |
| 201 const LayerTreeImpl* tree_impl) { |
| 202 return Scale(2, tree_impl); |
| 203 } |
| 204 SkColor DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() { |
| 205 return SkColorSetARGB(10, 100, 0, 200); |
| 206 } |
| 112 | 207 |
| 113 // Occluding rects in pink. | 208 // Occluding rects in pink. |
| 114 SkColor DebugColors::OccludingRectBorderColor() { return SkColorSetARGB(255, 245
, 136, 255); } | 209 SkColor DebugColors::OccludingRectBorderColor() { |
| 115 int DebugColors::OccludingRectBorderWidth(const LayerTreeImpl* tree_impl) { retu
rn Scale(2, tree_impl); } | 210 return SkColorSetARGB(255, 245, 136, 255); |
| 116 SkColor DebugColors::OccludingRectFillColor() { return SkColorSetARGB(10, 245, 1
36, 255); } | 211 } |
| 212 int DebugColors::OccludingRectBorderWidth(const LayerTreeImpl* tree_impl) { |
| 213 return Scale(2, tree_impl); |
| 214 } |
| 215 SkColor DebugColors::OccludingRectFillColor() { |
| 216 return SkColorSetARGB(10, 245, 136, 255); |
| 217 } |
| 117 | 218 |
| 118 // Non-Occluding rects in a reddish color. | 219 // Non-Occluding rects in a reddish color. |
| 119 SkColor DebugColors::NonOccludingRectBorderColor() { return SkColorSetARGB(255,
200, 0, 100); } | 220 SkColor DebugColors::NonOccludingRectBorderColor() { |
| 120 int DebugColors::NonOccludingRectBorderWidth(const LayerTreeImpl* tree_impl) { r
eturn Scale(2, tree_impl); } | 221 return SkColorSetARGB(255, 200, 0, 100); |
| 121 SkColor DebugColors::NonOccludingRectFillColor() { return SkColorSetARGB(10, 200
, 0, 100); } | 222 } |
| 223 int DebugColors::NonOccludingRectBorderWidth(const LayerTreeImpl* tree_impl) { |
| 224 return Scale(2, tree_impl); |
| 225 } |
| 226 SkColor DebugColors::NonOccludingRectFillColor() { |
| 227 return SkColorSetARGB(10, 200, 0, 100); |
| 228 } |
| 122 | 229 |
| 123 // Non-Painted rects in cyan. | 230 // Non-Painted rects in cyan. |
| 124 SkColor DebugColors::NonPaintedFillColor() { return SK_ColorCYAN; } | 231 SkColor DebugColors::NonPaintedFillColor() { return SK_ColorCYAN; } |
| 125 | 232 |
| 126 // Missing picture rects in magenta. | 233 // Missing picture rects in magenta. |
| 127 SkColor DebugColors::MissingPictureFillColor() { return SK_ColorMAGENTA; } | 234 SkColor DebugColors::MissingPictureFillColor() { return SK_ColorMAGENTA; } |
| 128 | 235 |
| 129 // ======= HUD widget colors ======= | 236 // ======= HUD widget colors ======= |
| 130 | 237 |
| 131 SkColor DebugColors::HUDBackgroundColor() { return SkColorSetARGB(215, 17, 17, 1
7); } | 238 SkColor DebugColors::HUDBackgroundColor() { |
| 132 SkColor DebugColors::HUDSeparatorLineColor() { return SkColorSetARGB(255, 130, 1
30, 130); } | 239 return SkColorSetARGB(215, 17, 17, 17); |
| 133 SkColor DebugColors::HUDIndicatorLineColor() { return SkColorSetARGB(255, 80, 80
, 80); } | 240 } |
| 241 SkColor DebugColors::HUDSeparatorLineColor() { |
| 242 return SkColorSetARGB(255, 130, 130, 130); |
| 243 } |
| 244 SkColor DebugColors::HUDIndicatorLineColor() { |
| 245 return SkColorSetARGB(255, 80, 80, 80); |
| 246 } |
| 134 | 247 |
| 135 SkColor DebugColors::PlatformLayerTreeTextColor() { return SK_ColorRED; } | 248 SkColor DebugColors::PlatformLayerTreeTextColor() { return SK_ColorRED; } |
| 136 SkColor DebugColors::FPSDisplayTextAndGraphColor() { return SK_ColorRED; } | 249 SkColor DebugColors::FPSDisplayTextAndGraphColor() { return SK_ColorRED; } |
| 137 SkColor DebugColors::MemoryDisplayTextColor() { return SkColorSetARGB(255, 220,
220, 220); } | 250 SkColor DebugColors::MemoryDisplayTextColor() { |
| 251 return SkColorSetARGB(255, 220, 220, 220); |
| 252 } |
| 138 | 253 |
| 139 // Paint time display in green (similar to paint times in the WebInspector) | 254 // Paint time display in green (similar to paint times in the WebInspector) |
| 140 SkColor DebugColors::PaintTimeDisplayTextAndGraphColor() { return SkColorSetRGB(
75, 155, 55); } | 255 SkColor DebugColors::PaintTimeDisplayTextAndGraphColor() { |
| 256 return SkColorSetRGB(75, 155, 55); |
| 257 } |
| 141 | 258 |
| 142 } // namespace cc | 259 } // namespace cc |
| OLD | NEW |