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
3 // found in the LICENSE file.
5 #include "cc/debug/debug_colors.h"
7 #include "cc/trees/layer_tree_impl.h"
11 static float Scale(float width
, const LayerTreeImpl
* tree_impl
) {
12 return width
* (tree_impl
? tree_impl
->device_scale_factor() : 1);
15 // ======= Layer border colors =======
17 // Tiled content layers are orange.
18 SkColor
DebugColors::TiledContentLayerBorderColor() {
19 return SkColorSetARGB(128, 255, 128, 0);
21 int DebugColors::TiledContentLayerBorderWidth(const LayerTreeImpl
* tree_impl
) {
22 return Scale(2, tree_impl
);
25 // Image layers are olive.
26 SkColor
DebugColors::ImageLayerBorderColor() {
27 return SkColorSetARGB(128, 128, 128, 0);
29 int DebugColors::ImageLayerBorderWidth(const LayerTreeImpl
* tree_impl
) {
30 return Scale(2, tree_impl
);
33 // Non-tiled content layers area green.
34 SkColor
DebugColors::ContentLayerBorderColor() {
35 return SkColorSetARGB(128, 0, 128, 32);
37 int DebugColors::ContentLayerBorderWidth(const LayerTreeImpl
* tree_impl
) {
38 return Scale(2, tree_impl
);
41 // Masking layers are pale blue and wide.
42 SkColor
DebugColors::MaskingLayerBorderColor() {
43 return SkColorSetARGB(48, 128, 255, 255);
45 int DebugColors::MaskingLayerBorderWidth(const LayerTreeImpl
* tree_impl
) {
46 return Scale(20, tree_impl
);
49 // Other container layers are yellow.
50 SkColor
DebugColors::ContainerLayerBorderColor() {
51 return SkColorSetARGB(192, 255, 255, 0);
53 int DebugColors::ContainerLayerBorderWidth(const LayerTreeImpl
* tree_impl
) {
54 return Scale(2, tree_impl
);
57 // Render surfaces are blue.
58 SkColor
DebugColors::SurfaceBorderColor() {
59 return SkColorSetARGB(100, 0, 0, 255);
61 int DebugColors::SurfaceBorderWidth(const LayerTreeImpl
* tree_impl
) {
62 return Scale(2, tree_impl
);
65 // Replicas of render surfaces are purple.
66 SkColor
DebugColors::SurfaceReplicaBorderColor() {
67 return SkColorSetARGB(100, 160, 0, 255);
69 int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeImpl
* tree_impl
) {
70 return Scale(2, tree_impl
);
73 // ======= Tile colors =======
75 // High-res tile borders are cyan.
76 SkColor
DebugColors::HighResTileBorderColor() {
77 return SkColorSetARGB(100, 80, 200, 200);
79 int DebugColors::HighResTileBorderWidth(const LayerTreeImpl
* tree_impl
) {
80 return Scale(1, tree_impl
);
83 // Low-res tile borders are purple.
84 SkColor
DebugColors::LowResTileBorderColor() {
85 return SkColorSetARGB(100, 212, 83, 192);
87 int DebugColors::LowResTileBorderWidth(const LayerTreeImpl
* tree_impl
) {
88 return Scale(2, tree_impl
);
91 // Other high-resolution tile borders are yellow.
92 SkColor
DebugColors::ExtraHighResTileBorderColor() {
93 return SkColorSetARGB(100, 239, 231, 20);
95 int DebugColors::ExtraHighResTileBorderWidth(const LayerTreeImpl
* tree_impl
) {
96 return Scale(2, tree_impl
);
99 // Other low-resolution tile borders are green.
100 SkColor
DebugColors::ExtraLowResTileBorderColor() {
101 return SkColorSetARGB(100, 93, 186, 18);
103 int DebugColors::ExtraLowResTileBorderWidth(const LayerTreeImpl
* tree_impl
) {
104 return Scale(2, tree_impl
);
107 // Missing tile borders are red.
108 SkColor
DebugColors::MissingTileBorderColor() {
109 return SkColorSetARGB(100, 255, 0, 0);
111 int DebugColors::MissingTileBorderWidth(const LayerTreeImpl
* tree_impl
) {
112 return Scale(1, tree_impl
);
115 // Culled tile borders are brown.
116 SkColor
DebugColors::CulledTileBorderColor() {
117 return SkColorSetARGB(120, 160, 100, 0);
119 int DebugColors::CulledTileBorderWidth(const LayerTreeImpl
* tree_impl
) {
120 return Scale(1, tree_impl
);
123 // Solid color tile borders are grey.
124 SkColor
DebugColors::SolidColorTileBorderColor() {
125 return SkColorSetARGB(128, 128, 128, 128);
127 int DebugColors::SolidColorTileBorderWidth(const LayerTreeImpl
* tree_impl
) {
128 return Scale(1, tree_impl
);
131 // Picture tile borders are dark grey.
132 SkColor
DebugColors::PictureTileBorderColor() {
133 return SkColorSetARGB(64, 64, 64, 0);
135 int DebugColors::PictureTileBorderWidth(const LayerTreeImpl
* tree_impl
) {
136 return Scale(1, tree_impl
);
139 // Direct picture borders are chartreuse.
140 SkColor
DebugColors::DirectPictureBorderColor() {
141 return SkColorSetARGB(255, 127, 255, 0);
143 int DebugColors::DirectPictureBorderWidth(const LayerTreeImpl
* tree_impl
) {
144 return Scale(1, tree_impl
);
147 // ======= Checkerboard colors =======
149 // Non-debug checkerboards are grey.
150 SkColor
DebugColors::DefaultCheckerboardColor() {
151 return SkColorSetRGB(241, 241, 241);
154 // Invalidated tiles get sky blue checkerboards.
155 SkColor
DebugColors::InvalidatedTileCheckerboardColor() {
156 return SkColorSetRGB(128, 200, 245);
159 // Evicted tiles get pale red checkerboards.
160 SkColor
DebugColors::EvictedTileCheckerboardColor() {
161 return SkColorSetRGB(255, 200, 200);
164 // ======= Debug rect colors =======
166 // Paint rects in red.
167 SkColor
DebugColors::PaintRectBorderColor() {
168 return SkColorSetARGB(255, 255, 0, 0);
170 int DebugColors::PaintRectBorderWidth(const LayerTreeImpl
* tree_impl
) {
171 return Scale(2, tree_impl
);
173 SkColor
DebugColors::PaintRectFillColor() {
174 return SkColorSetARGB(30, 255, 0, 0);
177 // Property-changed rects in blue.
178 SkColor
DebugColors::PropertyChangedRectBorderColor() {
179 return SkColorSetARGB(255, 0, 0, 255);
181 int DebugColors::PropertyChangedRectBorderWidth(
182 const LayerTreeImpl
* tree_impl
) {
183 return Scale(2, tree_impl
);
185 SkColor
DebugColors::PropertyChangedRectFillColor() {
186 return SkColorSetARGB(30, 0, 0, 255);
189 // Surface damage rects in yellow-orange.
190 SkColor
DebugColors::SurfaceDamageRectBorderColor() {
191 return SkColorSetARGB(255, 200, 100, 0);
193 int DebugColors::SurfaceDamageRectBorderWidth(const LayerTreeImpl
* tree_impl
) {
194 return Scale(2, tree_impl
);
196 SkColor
DebugColors::SurfaceDamageRectFillColor() {
197 return SkColorSetARGB(30, 200, 100, 0);
200 // Surface replica screen space rects in green.
201 SkColor
DebugColors::ScreenSpaceLayerRectBorderColor() {
202 return SkColorSetARGB(255, 100, 200, 0);
204 int DebugColors::ScreenSpaceLayerRectBorderWidth(
205 const LayerTreeImpl
* tree_impl
) {
206 return Scale(2, tree_impl
);
208 SkColor
DebugColors::ScreenSpaceLayerRectFillColor() {
209 return SkColorSetARGB(30, 100, 200, 0);
212 // Layer screen space rects in purple.
213 SkColor
DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() {
214 return SkColorSetARGB(255, 100, 0, 200);
216 int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(
217 const LayerTreeImpl
* tree_impl
) {
218 return Scale(2, tree_impl
);
220 SkColor
DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() {
221 return SkColorSetARGB(10, 100, 0, 200);
224 // Occluding rects in pink.
225 SkColor
DebugColors::OccludingRectBorderColor() {
226 return SkColorSetARGB(255, 245, 136, 255);
228 int DebugColors::OccludingRectBorderWidth(const LayerTreeImpl
* tree_impl
) {
229 return Scale(2, tree_impl
);
231 SkColor
DebugColors::OccludingRectFillColor() {
232 return SkColorSetARGB(10, 245, 136, 255);
235 // Non-Occluding rects in a reddish color.
236 SkColor
DebugColors::NonOccludingRectBorderColor() {
237 return SkColorSetARGB(255, 200, 0, 100);
239 int DebugColors::NonOccludingRectBorderWidth(const LayerTreeImpl
* tree_impl
) {
240 return Scale(2, tree_impl
);
242 SkColor
DebugColors::NonOccludingRectFillColor() {
243 return SkColorSetARGB(10, 200, 0, 100);
246 // Non-Painted rects in cyan.
247 SkColor
DebugColors::NonPaintedFillColor() { return SK_ColorCYAN
; }
249 // Missing picture rects in magenta.
250 SkColor
DebugColors::MissingPictureFillColor() { return SK_ColorMAGENTA
; }
252 // Picture borders in transparent blue.
253 SkColor
DebugColors::PictureBorderColor() {
254 return SkColorSetARGB(100, 0, 0, 200);
257 // ======= HUD widget colors =======
259 SkColor
DebugColors::HUDBackgroundColor() {
260 return SkColorSetARGB(215, 17, 17, 17);
262 SkColor
DebugColors::HUDSeparatorLineColor() {
263 return SkColorSetARGB(255, 130, 130, 130);
265 SkColor
DebugColors::HUDIndicatorLineColor() {
266 return SkColorSetARGB(255, 80, 80, 80);
269 SkColor
DebugColors::PlatformLayerTreeTextColor() { return SK_ColorRED
; }
270 SkColor
DebugColors::FPSDisplayTextAndGraphColor() { return SK_ColorRED
; }
271 SkColor
DebugColors::MemoryDisplayTextColor() {
272 return SkColorSetARGB(255, 220, 220, 220);
275 // Paint time display in green (similar to paint times in the WebInspector)
276 SkColor
DebugColors::PaintTimeDisplayTextAndGraphColor() {
277 return SkColorSetRGB(75, 155, 55);