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 borders are cyan.
42 SkColor
DebugColors::TileBorderColor() { return SkColorSetARGB(100, 80, 200, 200); }
43 int DebugColors::TileBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(1, tree_impl
); }
45 // ======= Tile colors =======
47 // Missing tile borders are red.
48 SkColor
DebugColors::MissingTileBorderColor() { return SkColorSetARGB(100, 255, 0, 0); }
49 int DebugColors::MissingTileBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(1, tree_impl
); }
51 // Culled tile borders are brown.
52 SkColor
DebugColors::CulledTileBorderColor() { return SkColorSetARGB(120, 160, 100, 0); }
53 int DebugColors::CulledTileBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(1, tree_impl
); }
55 // ======= Checkerboard colors =======
57 // Non-debug checkerboards are grey.
58 SkColor
DebugColors::DefaultCheckerboardColor() { return SkColorSetRGB(241, 241, 241); }
60 // Invalidated tiles get sky blue checkerboards.
61 SkColor
DebugColors::InvalidatedTileCheckerboardColor() { return SkColorSetRGB(128, 200, 245); }
63 // Evicted tiles get pale red checkerboards.
64 SkColor
DebugColors::EvictedTileCheckerboardColor() { return SkColorSetRGB(255, 200, 200); }
66 // ======= Debug rect colors =======
68 // Paint rects in red.
69 SkColor
DebugColors::PaintRectBorderColor() { return SkColorSetARGB(255, 255, 0, 0); }
70 int DebugColors::PaintRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
71 SkColor
DebugColors::PaintRectFillColor() { return SkColorSetARGB(30, 255, 0, 0); }
73 // Property-changed rects in blue.
74 SkColor
DebugColors::PropertyChangedRectBorderColor() { return SkColorSetARGB(255, 0, 0, 255); }
75 int DebugColors::PropertyChangedRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
76 SkColor
DebugColors::PropertyChangedRectFillColor() { return SkColorSetARGB(30, 0, 0, 255); }
78 // Surface damage rects in yellow-orange.
79 SkColor
DebugColors::SurfaceDamageRectBorderColor() { return SkColorSetARGB(255, 200, 100, 0); }
80 int DebugColors::SurfaceDamageRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
81 SkColor
DebugColors::SurfaceDamageRectFillColor() { return SkColorSetARGB(30, 200, 100, 0); }
83 // Surface replica screen space rects in green.
84 SkColor
DebugColors::ScreenSpaceLayerRectBorderColor() { return SkColorSetARGB(255, 100, 200, 0); }
85 int DebugColors::ScreenSpaceLayerRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
86 SkColor
DebugColors::ScreenSpaceLayerRectFillColor() { return SkColorSetARGB(30, 100, 200, 0); }
88 // Layer screen space rects in purple.
89 SkColor
DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() { return SkColorSetARGB(255, 100, 0, 200); }
90 int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
91 SkColor
DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() { return SkColorSetARGB(10, 100, 0, 200); }
93 // Occluding rects in pink.
94 SkColor
DebugColors::OccludingRectBorderColor() { return SkColorSetARGB(255, 245, 136, 255); }
95 int DebugColors::OccludingRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
96 SkColor
DebugColors::OccludingRectFillColor() { return SkColorSetARGB(10, 245, 136, 255); }
98 // Non-Occluding rects in a reddish color.
99 SkColor
DebugColors::NonOccludingRectBorderColor() { return SkColorSetARGB(255, 200, 0, 100); }
100 int DebugColors::NonOccludingRectBorderWidth(const LayerTreeImpl
* tree_impl
) { return Scale(2, tree_impl
); }
101 SkColor
DebugColors::NonOccludingRectFillColor() { return SkColorSetARGB(10, 200, 0, 100); }