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_colors.h"
7 #include "cc/layer_tree_impl.h"
11 static const 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() { return SkColorSetARGB(128, 255, 128, 0); }
19 int DebugColors::TiledContentLayerBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
21 // Non-tiled content layers area green.
22 SkColor
DebugColors::ContentLayerBorderColor() { return SkColorSetARGB(128, 0, 128, 32); }
23 int DebugColors::ContentLayerBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
25 // Masking layers are pale blue and wide.
26 SkColor
DebugColors::MaskingLayerBorderColor() { return SkColorSetARGB(48, 128, 255, 255); }
27 int DebugColors::MaskingLayerBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(20, tree_impl
); }
29 // Other container layers are yellow.
30 SkColor
DebugColors::ContainerLayerBorderColor() { return SkColorSetARGB(192, 255, 255, 0); }
31 int DebugColors::ContainerLayerBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
33 // Render surfaces are blue.
34 SkColor
DebugColors::SurfaceBorderColor() { return SkColorSetARGB(100, 0, 0, 255); }
35 int DebugColors::SurfaceBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
37 // Replicas of render surfaces are purple.
38 SkColor
DebugColors::SurfaceReplicaBorderColor() { return SkColorSetARGB(100, 160, 0, 255); }
39 int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
41 // ======= Tile colors =======
43 // High-res tile borders are cyan.
44 SkColor
DebugColors::HighResTileBorderColor() { return SkColorSetARGB(100, 80, 200, 200); }
45 int DebugColors::HighResTileBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(1, tree_impl
); }
47 // Low-res tile borders are purple.
48 SkColor
DebugColors::LowResTileBorderColor() { return SkColorSetARGB(100, 212, 83, 192); }
49 int DebugColors::LowResTileBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
51 // Other high-resolution tile borders are yellow.
52 SkColor
DebugColors::ExtraHighResTileBorderColor() { return SkColorSetARGB(100, 239, 231, 20); }
53 int DebugColors::ExtraHighResTileBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
55 // Other low-resolution tile borders are green.
56 SkColor
DebugColors::ExtraLowResTileBorderColor() { return SkColorSetARGB(100, 93, 186, 18); }
57 int DebugColors::ExtraLowResTileBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
59 // Missing tile borders are red.
60 SkColor
DebugColors::MissingTileBorderColor() { return SkColorSetARGB(100, 255, 0, 0); }
61 int DebugColors::MissingTileBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(1, tree_impl
); }
63 // Culled tile borders are brown.
64 SkColor
DebugColors::CulledTileBorderColor() { return SkColorSetARGB(120, 160, 100, 0); }
65 int DebugColors::CulledTileBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(1, tree_impl
); }
67 // ======= Checkerboard colors =======
69 // Non-debug checkerboards are grey.
70 SkColor
DebugColors::DefaultCheckerboardColor() { return SkColorSetRGB(241, 241, 241); }
72 // Invalidated tiles get sky blue checkerboards.
73 SkColor
DebugColors::InvalidatedTileCheckerboardColor() { return SkColorSetRGB(128, 200, 245); }
75 // Evicted tiles get pale red checkerboards.
76 SkColor
DebugColors::EvictedTileCheckerboardColor() { return SkColorSetRGB(255, 200, 200); }
78 // ======= Debug rect colors =======
80 // Paint rects in red.
81 SkColor
DebugColors::PaintRectBorderColor() { return SkColorSetARGB(255, 255, 0, 0); }
82 int DebugColors::PaintRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
83 SkColor
DebugColors::PaintRectFillColor() { return SkColorSetARGB(30, 255, 0, 0); }
85 // Property-changed rects in blue.
86 SkColor
DebugColors::PropertyChangedRectBorderColor() { return SkColorSetARGB(255, 0, 0, 255); }
87 int DebugColors::PropertyChangedRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
88 SkColor
DebugColors::PropertyChangedRectFillColor() { return SkColorSetARGB(30, 0, 0, 255); }
90 // Surface damage rects in yellow-orange.
91 SkColor
DebugColors::SurfaceDamageRectBorderColor() { return SkColorSetARGB(255, 200, 100, 0); }
92 int DebugColors::SurfaceDamageRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
93 SkColor
DebugColors::SurfaceDamageRectFillColor() { return SkColorSetARGB(30, 200, 100, 0); }
95 // Surface replica screen space rects in green.
96 SkColor
DebugColors::ScreenSpaceLayerRectBorderColor() { return SkColorSetARGB(255, 100, 200, 0); }
97 int DebugColors::ScreenSpaceLayerRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
98 SkColor
DebugColors::ScreenSpaceLayerRectFillColor() { return SkColorSetARGB(30, 100, 200, 0); }
100 // Layer screen space rects in purple.
101 SkColor
DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() { return SkColorSetARGB(255, 100, 0, 200); }
102 int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
103 SkColor
DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() { return SkColorSetARGB(10, 100, 0, 200); }
105 // Occluding rects in pink.
106 SkColor
DebugColors::OccludingRectBorderColor() { return SkColorSetARGB(255, 245, 136, 255); }
107 int DebugColors::OccludingRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
108 SkColor
DebugColors::OccludingRectFillColor() { return SkColorSetARGB(10, 245, 136, 255); }
110 // Non-Occluding rects in a reddish color.
111 SkColor
DebugColors::NonOccludingRectBorderColor() { return SkColorSetARGB(255, 200, 0, 100); }
112 int DebugColors::NonOccludingRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
113 SkColor
DebugColors::NonOccludingRectFillColor() { return SkColorSetARGB(10, 200, 0, 100); }
115 // ======= HUD widget colors =======
117 SkColor
DebugColors::PlatformLayerTreeTextColor() { return SK_ColorRED
; }
118 SkColor
DebugColors::FPSDisplayTextAndGraphColor() { return SK_ColorRED
; }
120 // Paint time display has the same green as used for paint time in the WebInspector
121 SkColor
DebugColors::PaintTimeDisplayTextAndGraphColor() { return SkColorSetRGB(95, 160, 80); }