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_colors.h" | 5 #include "cc/debug_colors.h" |
6 | 6 |
7 #include "cc/layer_tree_host_impl.h" | 7 #include "cc/layer_tree_impl.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 static const float Scale(float width, const LayerTreeHostImpl* host_impl) { | 11 static const float Scale(float width, const LayerTreeImpl* tree_impl) { |
12 return width * (host_impl ? host_impl->deviceScaleFactor() : 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() { return SkColorSetARGB(128,
255, 128, 0); } |
19 int DebugColors::TiledContentLayerBorderWidth(const LayerTreeHostImpl* host_impl
) { return Scale(2, host_impl); } | 19 int DebugColors::TiledContentLayerBorderWidth(const LayerTreeImpl* tree_impl) {
return Scale(2, tree_impl); } |
20 | 20 |
21 // Non-tiled content layers area green. | 21 // Non-tiled content layers area green. |
22 SkColor DebugColors::ContentLayerBorderColor() { return SkColorSetARGB(128, 0, 1
28, 32); } | 22 SkColor DebugColors::ContentLayerBorderColor() { return SkColorSetARGB(128, 0, 1
28, 32); } |
23 int DebugColors::ContentLayerBorderWidth(const LayerTreeHostImpl* host_impl) { r
eturn Scale(2, host_impl); } | 23 int DebugColors::ContentLayerBorderWidth(const LayerTreeImpl* tree_impl) { retur
n Scale(2, tree_impl); } |
24 | 24 |
25 // Masking layers are pale blue and wide. | 25 // Masking layers are pale blue and wide. |
26 SkColor DebugColors::MaskingLayerBorderColor() { return SkColorSetARGB(48, 128,
255, 255); } | 26 SkColor DebugColors::MaskingLayerBorderColor() { return SkColorSetARGB(48, 128,
255, 255); } |
27 int DebugColors::MaskingLayerBorderWidth(const LayerTreeHostImpl* host_impl) { r
eturn Scale(20, host_impl); } | 27 int DebugColors::MaskingLayerBorderWidth(const LayerTreeImpl* tree_impl) { retur
n Scale(20, tree_impl); } |
28 | 28 |
29 // Other container layers are yellow. | 29 // Other container layers are yellow. |
30 SkColor DebugColors::ContainerLayerBorderColor() { return SkColorSetARGB(192, 25
5, 255, 0); } | 30 SkColor DebugColors::ContainerLayerBorderColor() { return SkColorSetARGB(192, 25
5, 255, 0); } |
31 int DebugColors::ContainerLayerBorderWidth(const LayerTreeHostImpl* host_impl) {
return Scale(2, host_impl); } | 31 int DebugColors::ContainerLayerBorderWidth(const LayerTreeImpl* tree_impl) { ret
urn Scale(2, tree_impl); } |
32 | 32 |
33 // Render surfaces are blue. | 33 // Render surfaces are blue. |
34 SkColor DebugColors::SurfaceBorderColor() { return SkColorSetARGB(100, 0, 0, 255
); } | 34 SkColor DebugColors::SurfaceBorderColor() { return SkColorSetARGB(100, 0, 0, 255
); } |
35 int DebugColors::SurfaceBorderWidth(const LayerTreeHostImpl* host_impl) { return
Scale(2, host_impl); } | 35 int DebugColors::SurfaceBorderWidth(const LayerTreeImpl* tree_impl) { return Sca
le(2, tree_impl); } |
36 | 36 |
37 // Replicas of render surfaces are purple. | 37 // Replicas of render surfaces are purple. |
38 SkColor DebugColors::SurfaceReplicaBorderColor() { return SkColorSetARGB(100, 16
0, 0, 255); } | 38 SkColor DebugColors::SurfaceReplicaBorderColor() { return SkColorSetARGB(100, 16
0, 0, 255); } |
39 int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeHostImpl* host_impl) {
return Scale(2, host_impl); } | 39 int DebugColors::SurfaceReplicaBorderWidth(const LayerTreeImpl* tree_impl) { ret
urn Scale(2, tree_impl); } |
40 | 40 |
41 // Tile borders are cyan. | 41 // Tile borders are cyan. |
42 SkColor DebugColors::TileBorderColor() { return SkColorSetARGB(100, 80, 200, 200
); } | 42 SkColor DebugColors::TileBorderColor() { return SkColorSetARGB(100, 80, 200, 200
); } |
43 int DebugColors::TileBorderWidth(const LayerTreeHostImpl* host_impl) { return Sc
ale(1, host_impl); } | 43 int DebugColors::TileBorderWidth(const LayerTreeImpl* tree_impl) { return Scale(
1, tree_impl); } |
44 | 44 |
45 // ======= Tile colors ======= | 45 // ======= Tile colors ======= |
46 | 46 |
47 // Missing tile borders are red. | 47 // Missing tile borders are red. |
48 SkColor DebugColors::MissingTileBorderColor() { return SkColorSetARGB(100, 255,
0, 0); } | 48 SkColor DebugColors::MissingTileBorderColor() { return SkColorSetARGB(100, 255,
0, 0); } |
49 int DebugColors::MissingTileBorderWidth(const LayerTreeHostImpl* host_impl) { re
turn Scale(1, host_impl); } | 49 int DebugColors::MissingTileBorderWidth(const LayerTreeImpl* tree_impl) { return
Scale(1, tree_impl); } |
50 | 50 |
51 // Culled tile borders are brown. | 51 // Culled tile borders are brown. |
52 SkColor DebugColors::CulledTileBorderColor() { return SkColorSetARGB(120, 160, 1
00, 0); } | 52 SkColor DebugColors::CulledTileBorderColor() { return SkColorSetARGB(120, 160, 1
00, 0); } |
53 int DebugColors::CulledTileBorderWidth(const LayerTreeHostImpl* host_impl) { ret
urn Scale(1, host_impl); } | 53 int DebugColors::CulledTileBorderWidth(const LayerTreeImpl* tree_impl) { return
Scale(1, tree_impl); } |
54 | 54 |
55 // ======= Checkerboard colors ======= | 55 // ======= Checkerboard colors ======= |
56 | 56 |
57 // Non-debug checkerboards are grey. | 57 // Non-debug checkerboards are grey. |
58 SkColor DebugColors::DefaultCheckerboardColor() { return SkColorSetRGB(241, 241,
241); } | 58 SkColor DebugColors::DefaultCheckerboardColor() { return SkColorSetRGB(241, 241,
241); } |
59 | 59 |
60 // Invalidated tiles get sky blue checkerboards. | 60 // Invalidated tiles get sky blue checkerboards. |
61 SkColor DebugColors::InvalidatedTileCheckerboardColor() { return SkColorSetRGB(1
28, 200, 245); } | 61 SkColor DebugColors::InvalidatedTileCheckerboardColor() { return SkColorSetRGB(1
28, 200, 245); } |
62 | 62 |
63 // Evicted tiles get pale red checkerboards. | 63 // Evicted tiles get pale red checkerboards. |
64 SkColor DebugColors::EvictedTileCheckerboardColor() { return SkColorSetRGB(255,
200, 200); } | 64 SkColor DebugColors::EvictedTileCheckerboardColor() { return SkColorSetRGB(255,
200, 200); } |
65 | 65 |
66 // ======= Debug rect colors ======= | 66 // ======= Debug rect colors ======= |
67 | 67 |
68 // Paint rects in red. | 68 // Paint rects in red. |
69 SkColor DebugColors::PaintRectBorderColor() { return SkColorSetARGB(255, 255, 0,
0); } | 69 SkColor DebugColors::PaintRectBorderColor() { return SkColorSetARGB(255, 255, 0,
0); } |
70 int DebugColors::PaintRectBorderWidth(const LayerTreeHostImpl* host_impl) { retu
rn Scale(2, host_impl); } | 70 int DebugColors::PaintRectBorderWidth(const LayerTreeImpl* tree_impl) { return S
cale(2, tree_impl); } |
71 SkColor DebugColors::PaintRectFillColor() { return SkColorSetARGB(30, 255, 0, 0)
; } | 71 SkColor DebugColors::PaintRectFillColor() { return SkColorSetARGB(30, 255, 0, 0)
; } |
72 | 72 |
73 // Property-changed rects in blue. | 73 // Property-changed rects in blue. |
74 SkColor DebugColors::PropertyChangedRectBorderColor() { return SkColorSetARGB(25
5, 0, 0, 255); } | 74 SkColor DebugColors::PropertyChangedRectBorderColor() { return SkColorSetARGB(25
5, 0, 0, 255); } |
75 int DebugColors::PropertyChangedRectBorderWidth(const LayerTreeHostImpl* host_im
pl) { return Scale(2, host_impl); } | 75 int DebugColors::PropertyChangedRectBorderWidth(const LayerTreeImpl* tree_impl)
{ return Scale(2, tree_impl); } |
76 SkColor DebugColors::PropertyChangedRectFillColor() { return SkColorSetARGB(30,
0, 0, 255); } | 76 SkColor DebugColors::PropertyChangedRectFillColor() { return SkColorSetARGB(30,
0, 0, 255); } |
77 | 77 |
78 // Surface damage rects in yellow-orange. | 78 // Surface damage rects in yellow-orange. |
79 SkColor DebugColors::SurfaceDamageRectBorderColor() { return SkColorSetARGB(255,
200, 100, 0); } | 79 SkColor DebugColors::SurfaceDamageRectBorderColor() { return SkColorSetARGB(255,
200, 100, 0); } |
80 int DebugColors::SurfaceDamageRectBorderWidth(const LayerTreeHostImpl* host_impl
) { return Scale(2, host_impl); } | 80 int DebugColors::SurfaceDamageRectBorderWidth(const LayerTreeImpl* tree_impl) {
return Scale(2, tree_impl); } |
81 SkColor DebugColors::SurfaceDamageRectFillColor() { return SkColorSetARGB(30, 20
0, 100, 0); } | 81 SkColor DebugColors::SurfaceDamageRectFillColor() { return SkColorSetARGB(30, 20
0, 100, 0); } |
82 | 82 |
83 // Surface replica screen space rects in green. | 83 // Surface replica screen space rects in green. |
84 SkColor DebugColors::ScreenSpaceLayerRectBorderColor() { return SkColorSetARGB(2
55, 100, 200, 0); } | 84 SkColor DebugColors::ScreenSpaceLayerRectBorderColor() { return SkColorSetARGB(2
55, 100, 200, 0); } |
85 int DebugColors::ScreenSpaceLayerRectBorderWidth(const LayerTreeHostImpl* host_i
mpl) { return Scale(2, host_impl); } | 85 int DebugColors::ScreenSpaceLayerRectBorderWidth(const LayerTreeImpl* tree_impl)
{ return Scale(2, tree_impl); } |
86 SkColor DebugColors::ScreenSpaceLayerRectFillColor() { return SkColorSetARGB(30,
100, 200, 0); } | 86 SkColor DebugColors::ScreenSpaceLayerRectFillColor() { return SkColorSetARGB(30,
100, 200, 0); } |
87 | 87 |
88 // Layer screen space rects in purple. | 88 // Layer screen space rects in purple. |
89 SkColor DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() { return SkColor
SetARGB(255, 100, 0, 200); } | 89 SkColor DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor() { return SkColor
SetARGB(255, 100, 0, 200); } |
90 int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(const LayerTreeHostImp
l* host_impl) { return Scale(2, host_impl); } | 90 int DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth(const LayerTreeImpl* t
ree_impl) { return Scale(2, tree_impl); } |
91 SkColor DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() { return SkColorSe
tARGB(10, 100, 0, 200); } | 91 SkColor DebugColors::ScreenSpaceSurfaceReplicaRectFillColor() { return SkColorSe
tARGB(10, 100, 0, 200); } |
92 | 92 |
93 // Occluding rects in pink. | 93 // Occluding rects in pink. |
94 SkColor DebugColors::OccludingRectBorderColor() { return SkColorSetARGB(255, 245
, 136, 255); } | 94 SkColor DebugColors::OccludingRectBorderColor() { return SkColorSetARGB(255, 245
, 136, 255); } |
95 int DebugColors::OccludingRectBorderWidth(const LayerTreeHostImpl* host_impl) {
return Scale(2, host_impl); } | 95 int DebugColors::OccludingRectBorderWidth(const LayerTreeImpl* tree_impl) { retu
rn Scale(2, tree_impl); } |
96 SkColor DebugColors::OccludingRectFillColor() { return SkColorSetARGB(10, 245, 1
36, 255); } | 96 SkColor DebugColors::OccludingRectFillColor() { return SkColorSetARGB(10, 245, 1
36, 255); } |
97 | 97 |
98 // Non-Occluding rects in a reddish color. | 98 // Non-Occluding rects in a reddish color. |
99 SkColor DebugColors::NonOccludingRectBorderColor() { return SkColorSetARGB(255,
200, 0, 100); } | 99 SkColor DebugColors::NonOccludingRectBorderColor() { return SkColorSetARGB(255,
200, 0, 100); } |
100 int DebugColors::NonOccludingRectBorderWidth(const LayerTreeHostImpl* host_impl)
{ return Scale(2, host_impl); } | 100 int DebugColors::NonOccludingRectBorderWidth(const LayerTreeImpl* tree_impl) { r
eturn Scale(2, tree_impl); } |
101 SkColor DebugColors::NonOccludingRectFillColor() { return SkColorSetARGB(10, 200
, 0, 100); } | 101 SkColor DebugColors::NonOccludingRectFillColor() { return SkColorSetARGB(10, 200
, 0, 100); } |
102 | 102 |
103 } // namespace cc | 103 } // namespace cc |
OLD | NEW |