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() { return 2; }
171 SkColor
DebugColors::PaintRectFillColor() {
172 return SkColorSetARGB(30, 255, 0, 0);
175 // Property-changed rects in blue.
176 SkColor
DebugColors::PropertyChangedRectBorderColor() {
177 return SkColorSetARGB(255, 0, 0, 255);
179 int DebugColors::PropertyChangedRectBorderWidth() { return 2; }
180 SkColor
DebugColors::PropertyChangedRectFillColor() {
181 return SkColorSetARGB(30, 0, 0, 255);
184 // Surface damage rects in yellow-orange.
185 SkColor
DebugColors::SurfaceDamageRectBorderColor() {
186 return SkColorSetARGB(255, 200, 100, 0);
188 int DebugColors::SurfaceDamageRectBorderWidth() { return 2; }
189 SkColor
DebugColors::SurfaceDamageRectFillColor() {
190 return SkColorSetARGB(30, 200, 100, 0);
193 // Surface replica screen space rects in green.
194 SkColor
DebugColors::ScreenSpaceLayerRectBorderColor() {
195 return SkColorSetARGB(255, 100, 200, 0);
197 int DebugColors::ScreenSpaceLayerRectBorderWidth() { return 2; }
198 SkColor
DebugColors::ScreenSpaceLayerRectFillColor() {
199 return SkColorSetARGB(30, 100, 200, 0);
202 // Layer screen space rects in purple.
203 SkColor
DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() {
204 return SkColorSetARGB(255, 100, 0, 200);
206 int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth() { return 2; }
207 SkColor
DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() {
208 return SkColorSetARGB(10, 100, 0, 200);
211 // Occluding rects in pink.
212 SkColor
DebugColors::OccludingRectBorderColor() {
213 return SkColorSetARGB(255, 245, 136, 255);
215 int DebugColors::OccludingRectBorderWidth() { return 2; }
216 SkColor
DebugColors::OccludingRectFillColor() {
217 return SkColorSetARGB(10, 245, 136, 255);
220 // Non-Occluding rects in a reddish color.
221 SkColor
DebugColors::NonOccludingRectBorderColor() {
222 return SkColorSetARGB(255, 200, 0, 100);
224 int DebugColors::NonOccludingRectBorderWidth() { return 2; }
225 SkColor
DebugColors::NonOccludingRectFillColor() {
226 return SkColorSetARGB(10, 200, 0, 100);
229 // Touch-event-handler rects in yellow.
230 SkColor
DebugColors::TouchEventHandlerRectBorderColor() {
231 return SkColorSetARGB(255, 239, 229, 60);
233 int DebugColors::TouchEventHandlerRectBorderWidth() { return 2; }
234 SkColor
DebugColors::TouchEventHandlerRectFillColor() {
235 return SkColorSetARGB(30, 239, 229, 60);
238 // Wheel-event-handler rects in green.
239 SkColor
DebugColors::WheelEventHandlerRectBorderColor() {
240 return SkColorSetARGB(255, 189, 209, 57);
242 int DebugColors::WheelEventHandlerRectBorderWidth() { return 2; }
243 SkColor
DebugColors::WheelEventHandlerRectFillColor() {
244 return SkColorSetARGB(30, 189, 209, 57);
247 // Non-fast-scrollable rects in orange.
248 SkColor
DebugColors::NonFastScrollableRectBorderColor() {
249 return SkColorSetARGB(255, 238, 163, 59);
251 int DebugColors::NonFastScrollableRectBorderWidth() { return 2; }
252 SkColor
DebugColors::NonFastScrollableRectFillColor() {
253 return SkColorSetARGB(30, 238, 163, 59);
256 // Non-Painted rects in cyan.
257 SkColor
DebugColors::NonPaintedFillColor() { return SK_ColorCYAN
; }
259 // Missing picture rects in magenta.
260 SkColor
DebugColors::MissingPictureFillColor() { return SK_ColorMAGENTA
; }
262 // Picture borders in transparent blue.
263 SkColor
DebugColors::PictureBorderColor() {
264 return SkColorSetARGB(100, 0, 0, 200);
267 // ======= HUD widget colors =======
269 SkColor
DebugColors::HUDBackgroundColor() {
270 return SkColorSetARGB(215, 17, 17, 17);
272 SkColor
DebugColors::HUDSeparatorLineColor() {
273 return SkColorSetARGB(255, 130, 130, 130);
275 SkColor
DebugColors::HUDIndicatorLineColor() {
276 return SkColorSetARGB(255, 80, 80, 80);
279 SkColor
DebugColors::PlatformLayerTreeTextColor() { return SK_ColorRED
; }
280 SkColor
DebugColors::FPSDisplayTextAndGraphColor() { return SK_ColorRED
; }
281 SkColor
DebugColors::MemoryDisplayTextColor() {
282 return SkColorSetARGB(255, 220, 220, 220);
285 // Paint time display in green (similar to paint times in the WebInspector)
286 SkColor
DebugColors::PaintTimeDisplayTextAndGraphColor() {
287 return SkColorSetRGB(75, 155, 55);