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" | 5 #include "base/macros.h" |
6 | 6 |
7 #include "cc/debug/debug_colors.h" | 7 #include "cc/debug/debug_colors.h" |
8 | 8 |
9 #include "cc/trees/layer_tree_impl.h" | 9 #include "cc/trees/layer_tree_impl.h" |
10 | 10 |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 164 } |
165 | 165 |
166 // ======= Debug rect colors ======= | 166 // ======= Debug rect colors ======= |
167 | 167 |
168 static SkColor FadedGreen(int initial_value, int step) { | 168 static SkColor FadedGreen(int initial_value, int step) { |
169 DCHECK_GE(step, 0); | 169 DCHECK_GE(step, 0); |
170 DCHECK_LE(step, DebugColors::kFadeSteps); | 170 DCHECK_LE(step, DebugColors::kFadeSteps); |
171 int value = step * initial_value / DebugColors::kFadeSteps; | 171 int value = step * initial_value / DebugColors::kFadeSteps; |
172 return SkColorSetARGB(value, 0, 195, 0); | 172 return SkColorSetARGB(value, 0, 195, 0); |
173 } | 173 } |
| 174 static SkColor FadedRed(int initial_value, int step) { |
| 175 DCHECK_GE(step, 0); |
| 176 DCHECK_LE(step, DebugColors::kFadeSteps); |
| 177 int value = step * initial_value / DebugColors::kFadeSteps; |
| 178 return SkColorSetARGB(value, 200, 0, 0); |
| 179 } |
174 // Paint rects in green. | 180 // Paint rects in green. |
175 SkColor DebugColors::PaintRectBorderColor(int step) { | 181 SkColor DebugColors::PaintRectBorderColor(int step, bool is_first_paint) { |
176 return FadedGreen(255, step); | 182 return is_first_paint ? FadedRed(255, step) : FadedGreen(255, step); |
177 } | 183 } |
178 int DebugColors::PaintRectBorderWidth() { return 2; } | 184 int DebugColors::PaintRectBorderWidth() { return 2; } |
179 SkColor DebugColors::PaintRectFillColor(int step) { | 185 SkColor DebugColors::PaintRectFillColor(int step, bool is_first_paint) { |
180 return FadedGreen(60, step); | 186 return is_first_paint ? FadedRed(60, step) : FadedGreen(60, step); |
181 } | 187 } |
182 | 188 |
183 // Property-changed rects in blue. | 189 // Property-changed rects in blue. |
184 SkColor DebugColors::PropertyChangedRectBorderColor() { | 190 SkColor DebugColors::PropertyChangedRectBorderColor() { |
185 return SkColorSetARGB(255, 0, 0, 255); | 191 return SkColorSetARGB(255, 0, 0, 255); |
186 } | 192 } |
187 int DebugColors::PropertyChangedRectBorderWidth() { return 2; } | 193 int DebugColors::PropertyChangedRectBorderWidth() { return 2; } |
188 SkColor DebugColors::PropertyChangedRectFillColor() { | 194 SkColor DebugColors::PropertyChangedRectFillColor() { |
189 return SkColorSetARGB(30, 0, 0, 255); | 195 return SkColorSetARGB(30, 0, 0, 255); |
190 } | 196 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 SkColor DebugColors::MemoryDisplayTextColor() { | 318 SkColor DebugColors::MemoryDisplayTextColor() { |
313 return SkColorSetARGB(255, 220, 220, 220); | 319 return SkColorSetARGB(255, 220, 220, 220); |
314 } | 320 } |
315 | 321 |
316 // Paint time display in green (similar to paint times in the WebInspector) | 322 // Paint time display in green (similar to paint times in the WebInspector) |
317 SkColor DebugColors::PaintTimeDisplayTextAndGraphColor() { | 323 SkColor DebugColors::PaintTimeDisplayTextAndGraphColor() { |
318 return SkColorSetRGB(75, 155, 55); | 324 return SkColorSetRGB(75, 155, 55); |
319 } | 325 } |
320 | 326 |
321 } // namespace cc | 327 } // namespace cc |
OLD | NEW |