Chromium Code Reviews| 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 "base/macros.h" | |
| 6 | |
| 5 #include "cc/debug/debug_colors.h" | 7 #include "cc/debug/debug_colors.h" |
| 6 | 8 |
| 7 #include "cc/trees/layer_tree_impl.h" | 9 #include "cc/trees/layer_tree_impl.h" |
| 8 | 10 |
| 9 namespace cc { | 11 namespace cc { |
| 10 | 12 |
| 13 static const int kPaintRectColors[][3] = { | |
| 14 {0, 95, 0}, | |
| 15 {0, 175, 0}, | |
| 16 {0, 255, 0} | |
| 17 }; | |
| 18 static int s_currentPaintRectColor = 0; | |
| 19 | |
| 11 static float Scale(float width, const LayerTreeImpl* tree_impl) { | 20 static float Scale(float width, const LayerTreeImpl* tree_impl) { |
| 12 return width * (tree_impl ? tree_impl->device_scale_factor() : 1); | 21 return width * (tree_impl ? tree_impl->device_scale_factor() : 1); |
| 13 } | 22 } |
| 14 | 23 |
| 15 // ======= Layer border colors ======= | 24 // ======= Layer border colors ======= |
| 16 | 25 |
| 17 // Tiled content layers are orange. | 26 // Tiled content layers are orange. |
| 18 SkColor DebugColors::TiledContentLayerBorderColor() { | 27 SkColor DebugColors::TiledContentLayerBorderColor() { |
| 19 return SkColorSetARGB(128, 255, 128, 0); | 28 return SkColorSetARGB(128, 255, 128, 0); |
| 20 } | 29 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 164 return SkColorSetRGB(128, 200, 245); | 173 return SkColorSetRGB(128, 200, 245); |
| 165 } | 174 } |
| 166 | 175 |
| 167 // Evicted tiles get pale red checkerboards. | 176 // Evicted tiles get pale red checkerboards. |
| 168 SkColor DebugColors::EvictedTileCheckerboardColor() { | 177 SkColor DebugColors::EvictedTileCheckerboardColor() { |
| 169 return SkColorSetRGB(255, 200, 200); | 178 return SkColorSetRGB(255, 200, 200); |
| 170 } | 179 } |
| 171 | 180 |
| 172 // ======= Debug rect colors ======= | 181 // ======= Debug rect colors ======= |
| 173 | 182 |
| 174 // Paint rects in red. | 183 // Paint rects in shades of green. |
| 175 SkColor DebugColors::PaintRectBorderColor() { | 184 SkColor DebugColors::PaintRectBorderColor() { |
| 176 return SkColorSetARGB(255, 255, 0, 0); | 185 return SkColorSetARGB(255, |
| 186 kPaintRectColors[s_currentPaintRectColor][0], | |
| 187 kPaintRectColors[s_currentPaintRectColor][1], | |
| 188 kPaintRectColors[s_currentPaintRectColor][2]); | |
| 177 } | 189 } |
| 178 int DebugColors::PaintRectBorderWidth() { return 2; } | 190 int DebugColors::PaintRectBorderWidth() { return 2; } |
| 179 SkColor DebugColors::PaintRectFillColor() { | 191 SkColor DebugColors::PaintRectFillColor() { |
| 180 return SkColorSetARGB(30, 255, 0, 0); | 192 return SkColorSetARGB(30, |
| 193 kPaintRectColors[s_currentPaintRectColor][0], | |
| 194 kPaintRectColors[s_currentPaintRectColor][1], | |
| 195 kPaintRectColors[s_currentPaintRectColor][2]); | |
| 196 } | |
| 197 void DebugColors::CyclePaintRectColor() { | |
| 198 s_currentPaintRectColor = | |
|
danakj
2014/01/29 18:34:32
Can you move this variable to be a member of the H
| |
| 199 (s_currentPaintRectColor + 1) % arraysize(kPaintRectColors); | |
| 181 } | 200 } |
| 182 | 201 |
| 183 // Property-changed rects in blue. | 202 // Property-changed rects in blue. |
| 184 SkColor DebugColors::PropertyChangedRectBorderColor() { | 203 SkColor DebugColors::PropertyChangedRectBorderColor() { |
| 185 return SkColorSetARGB(255, 0, 0, 255); | 204 return SkColorSetARGB(255, 0, 0, 255); |
| 186 } | 205 } |
| 187 int DebugColors::PropertyChangedRectBorderWidth() { return 2; } | 206 int DebugColors::PropertyChangedRectBorderWidth() { return 2; } |
| 188 SkColor DebugColors::PropertyChangedRectFillColor() { | 207 SkColor DebugColors::PropertyChangedRectFillColor() { |
| 189 return SkColorSetARGB(30, 0, 0, 255); | 208 return SkColorSetARGB(30, 0, 0, 255); |
| 190 } | 209 } |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 SkColor DebugColors::MemoryDisplayTextColor() { | 317 SkColor DebugColors::MemoryDisplayTextColor() { |
| 299 return SkColorSetARGB(255, 220, 220, 220); | 318 return SkColorSetARGB(255, 220, 220, 220); |
| 300 } | 319 } |
| 301 | 320 |
| 302 // Paint time display in green (similar to paint times in the WebInspector) | 321 // Paint time display in green (similar to paint times in the WebInspector) |
| 303 SkColor DebugColors::PaintTimeDisplayTextAndGraphColor() { | 322 SkColor DebugColors::PaintTimeDisplayTextAndGraphColor() { |
| 304 return SkColorSetRGB(75, 155, 55); | 323 return SkColorSetRGB(75, 155, 55); |
| 305 } | 324 } |
| 306 | 325 |
| 307 } // namespace cc | 326 } // namespace cc |
| OLD | NEW |