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/layers/heads_up_display_layer_impl.h"
10 #include "base/strings/stringprintf.h"
11 #include "cc/debug/debug_colors.h"
12 #include "cc/debug/frame_rate_counter.h"
13 #include "cc/debug/paint_time_counter.h"
14 #include "cc/debug/traced_value.h"
15 #include "cc/layers/quad_sink.h"
16 #include "cc/output/renderer.h"
17 #include "cc/quads/texture_draw_quad.h"
18 #include "cc/resources/memory_history.h"
19 #include "cc/trees/layer_tree_impl.h"
20 #include "skia/ext/platform_canvas.h"
21 #include "third_party/khronos/GLES2/gl2.h"
22 #include "third_party/khronos/GLES2/gl2ext.h"
23 #include "third_party/skia/include/core/SkBitmap.h"
24 #include "third_party/skia/include/core/SkPaint.h"
25 #include "third_party/skia/include/core/SkTypeface.h"
26 #include "third_party/skia/include/effects/SkColorMatrixFilter.h"
27 #include "ui/gfx/point.h"
28 #include "ui/gfx/size.h"
32 static inline SkPaint CreatePaint() {
34 #if (SK_R32_SHIFT || SK_B32_SHIFT != 16)
35 // The SkCanvas is in RGBA but the shader is expecting BGRA, so we need to
36 // swizzle our colors when drawing to the SkCanvas.
37 SkColorMatrix swizzle_matrix;
38 for (int i = 0; i < 20; ++i)
39 swizzle_matrix.fMat[i] = 0;
40 swizzle_matrix.fMat[0 + 5 * 2] = 1;
41 swizzle_matrix.fMat[1 + 5 * 1] = 1;
42 swizzle_matrix.fMat[2 + 5 * 0] = 1;
43 swizzle_matrix.fMat[3 + 5 * 3] = 1;
45 skia::RefPtr<SkColorMatrixFilter> filter =
46 skia::AdoptRef(new SkColorMatrixFilter(swizzle_matrix));
47 paint.setColorFilter(filter.get());
52 HeadsUpDisplayLayerImpl::Graph::Graph(double indicator_value,
53 double start_upper_bound)
57 current_upper_bound(start_upper_bound),
58 default_upper_bound(start_upper_bound),
59 indicator(indicator_value) {}
61 double HeadsUpDisplayLayerImpl::Graph::UpdateUpperBound() {
62 double target_upper_bound = std::max(max, default_upper_bound);
63 current_upper_bound += (target_upper_bound - current_upper_bound) * 0.5;
64 return current_upper_bound;
67 HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(LayerTreeImpl* tree_impl,
69 : LayerImpl(tree_impl, id),
70 typeface_(skia::AdoptRef(
71 SkTypeface::CreateFromName("monospace", SkTypeface::kBold))),
72 fps_graph_(60.0, 80.0),
73 paint_time_graph_(16.0, 48.0),
76 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {}
78 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl(
79 LayerTreeImpl* tree_impl) {
80 return HeadsUpDisplayLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
83 bool HeadsUpDisplayLayerImpl::WillDraw(DrawMode draw_mode,
84 ResourceProvider* resource_provider) {
85 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE)
89 hud_resource_ = ScopedResource::Create(resource_provider);
91 // TODO(danakj): The HUD could swap between two textures instead of creating a
92 // texture every frame in ubercompositor.
93 if (hud_resource_->size() != content_bounds() ||
94 (hud_resource_->id() &&
95 resource_provider->InUseByConsumer(hud_resource_->id()))) {
96 hud_resource_->Free();
99 if (!hud_resource_->id()) {
100 hud_resource_->Allocate(content_bounds(),
101 ResourceProvider::TextureUsageAny,
105 return LayerImpl::WillDraw(draw_mode, resource_provider);
108 void HeadsUpDisplayLayerImpl::AppendQuads(QuadSink* quad_sink,
109 AppendQuadsData* append_quads_data) {
110 if (!hud_resource_->id())
113 SharedQuadState* shared_quad_state =
114 quad_sink->UseSharedQuadState(CreateSharedQuadState());
116 gfx::Rect quad_rect(content_bounds());
117 gfx::Rect opaque_rect(contents_opaque() ? quad_rect : gfx::Rect());
118 gfx::Rect visible_quad_rect(quad_rect);
119 bool premultiplied_alpha = true;
120 gfx::PointF uv_top_left(0.f, 0.f);
121 gfx::PointF uv_bottom_right(1.f, 1.f);
122 const float vertex_opacity[] = { 1.f, 1.f, 1.f, 1.f };
123 bool flipped = false;
124 scoped_ptr<TextureDrawQuad> quad = TextureDrawQuad::Create();
125 quad->SetNew(shared_quad_state,
136 quad_sink->Append(quad.PassAs<DrawQuad>());
139 void HeadsUpDisplayLayerImpl::UpdateHudTexture(
141 ResourceProvider* resource_provider) {
142 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE || !hud_resource_->id())
147 canvas_size = hud_canvas_->getDeviceSize();
149 canvas_size.set(0, 0);
151 if (canvas_size.width() != content_bounds().width() ||
152 canvas_size.width() != content_bounds().height() || !hud_canvas_) {
153 TRACE_EVENT0("cc", "ResizeHudCanvas");
155 hud_canvas_ = make_scoped_ptr(skia::CreateBitmapCanvas(
156 content_bounds().width(), content_bounds().height(), opaque));
162 TRACE_EVENT0("cc", "DrawHudContents");
163 hud_canvas_->clear(SkColorSetARGB(0, 0, 0, 0));
165 hud_canvas_->scale(contents_scale_x(), contents_scale_y());
167 DrawHudContents(hud_canvas_.get());
169 hud_canvas_->restore();
172 TRACE_EVENT0("cc", "UploadHudTexture");
174 size_t row_bytes = 0;
175 const void* pixels = hud_canvas_->peekPixels(&info, &row_bytes);
177 gfx::Rect content_rect(content_bounds());
178 DCHECK(info.colorType() == kPMColor_SkColorType);
179 resource_provider->SetPixels(hud_resource_->id(),
180 static_cast<const uint8_t*>(pixels),
186 void HeadsUpDisplayLayerImpl::ReleaseResources() { hud_resource_.reset(); }
188 void HeadsUpDisplayLayerImpl::UpdateHudContents() {
189 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state();
191 // Don't update numbers every frame so text is readable.
192 base::TimeTicks now = layer_tree_impl()->CurrentFrameTimeTicks();
193 if (base::TimeDelta(now - time_of_last_graph_update_).InSecondsF() > 0.25f) {
194 time_of_last_graph_update_ = now;
196 if (debug_state.show_fps_counter) {
197 FrameRateCounter* fps_counter = layer_tree_impl()->frame_rate_counter();
198 fps_graph_.value = fps_counter->GetAverageFPS();
199 fps_counter->GetMinAndMaxFPS(&fps_graph_.min, &fps_graph_.max);
202 if (debug_state.continuous_painting) {
203 PaintTimeCounter* paint_time_counter =
204 layer_tree_impl()->paint_time_counter();
205 base::TimeDelta latest, min, max;
207 if (paint_time_counter->End())
208 latest = **paint_time_counter->End();
209 paint_time_counter->GetMinAndMaxPaintTime(&min, &max);
211 paint_time_graph_.value = latest.InMillisecondsF();
212 paint_time_graph_.min = min.InMillisecondsF();
213 paint_time_graph_.max = max.InMillisecondsF();
216 if (debug_state.ShowMemoryStats()) {
217 MemoryHistory* memory_history = layer_tree_impl()->memory_history();
218 if (memory_history->End())
219 memory_entry_ = **memory_history->End();
221 memory_entry_ = MemoryHistory::Entry();
225 fps_graph_.UpdateUpperBound();
226 paint_time_graph_.UpdateUpperBound();
229 void HeadsUpDisplayLayerImpl::DrawHudContents(SkCanvas* canvas) {
230 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state();
232 if (debug_state.ShowHudRects()) {
233 DrawDebugRects(canvas, layer_tree_impl()->debug_rect_history());
234 if (IsAnimatingHUDContents()) {
235 layer_tree_impl()->SetNeedsRedraw();
239 SkRect area = SkRect::MakeEmpty();
240 if (debug_state.continuous_painting) {
241 area = DrawPaintTimeDisplay(
242 canvas, layer_tree_impl()->paint_time_counter(), 0, 0);
243 } else if (debug_state.show_fps_counter) {
244 // Don't show the FPS display when continuous painting is enabled, because
245 // it would show misleading numbers.
247 DrawFPSDisplay(canvas, layer_tree_impl()->frame_rate_counter(), 0, 0);
250 if (debug_state.ShowMemoryStats())
251 DrawMemoryDisplay(canvas, 0, area.bottom(), SkMaxScalar(area.width(), 150));
254 void HeadsUpDisplayLayerImpl::DrawText(SkCanvas* canvas,
256 const std::string& text,
257 SkPaint::Align align,
261 const bool anti_alias = paint->isAntiAlias();
262 paint->setAntiAlias(true);
264 paint->setTextSize(size);
265 paint->setTextAlign(align);
266 paint->setTypeface(typeface_.get());
267 canvas->drawText(text.c_str(), text.length(), x, y, *paint);
269 paint->setAntiAlias(anti_alias);
272 void HeadsUpDisplayLayerImpl::DrawText(SkCanvas* canvas,
274 const std::string& text,
275 SkPaint::Align align,
277 const SkPoint& pos) const {
278 DrawText(canvas, paint, text, align, size, pos.x(), pos.y());
281 void HeadsUpDisplayLayerImpl::DrawGraphBackground(SkCanvas* canvas,
283 const SkRect& bounds) const {
284 paint->setColor(DebugColors::HUDBackgroundColor());
285 canvas->drawRect(bounds, *paint);
288 void HeadsUpDisplayLayerImpl::DrawGraphLines(SkCanvas* canvas,
290 const SkRect& bounds,
291 const Graph& graph) const {
292 // Draw top and bottom line.
293 paint->setColor(DebugColors::HUDSeparatorLineColor());
294 canvas->drawLine(bounds.left(),
300 bounds.left(), bounds.bottom(), bounds.right(), bounds.bottom(), *paint);
302 // Draw indicator line (additive blend mode to increase contrast when drawn on
304 paint->setColor(DebugColors::HUDIndicatorLineColor());
305 paint->setXfermodeMode(SkXfermode::kPlus_Mode);
306 const double indicator_top =
307 bounds.height() * (1.0 - graph.indicator / graph.current_upper_bound) -
309 canvas->drawLine(bounds.left(),
310 bounds.top() + indicator_top,
312 bounds.top() + indicator_top,
314 paint->setXfermode(NULL);
317 SkRect HeadsUpDisplayLayerImpl::DrawFPSDisplay(
319 const FrameRateCounter* fps_counter,
322 const int kPadding = 4;
325 const int kFontHeight = 15;
327 const int kGraphWidth = fps_counter->time_stamp_history_size() - 2;
328 const int kGraphHeight = 40;
330 const int kHistogramWidth = 37;
332 int width = kGraphWidth + kHistogramWidth + 4 * kPadding;
333 int height = kFontHeight + kGraphHeight + 4 * kPadding + 2;
334 int left = bounds().width() - width - right;
335 SkRect area = SkRect::MakeXYWH(left, top, width, height);
337 SkPaint paint = CreatePaint();
338 DrawGraphBackground(canvas, &paint, area);
341 SkRect::MakeXYWH(left + kPadding,
343 kGraphWidth + kHistogramWidth + kGap + 2,
345 SkRect graph_bounds = SkRect::MakeXYWH(left + kPadding,
346 text_bounds.bottom() + 2 * kPadding,
349 SkRect histogram_bounds = SkRect::MakeXYWH(graph_bounds.right() + kGap,
354 const std::string value_text =
355 base::StringPrintf("FPS:%5.1f", fps_graph_.value);
356 const std::string min_max_text =
357 base::StringPrintf("%.0f-%.0f", fps_graph_.min, fps_graph_.max);
359 paint.setColor(DebugColors::FPSDisplayTextAndGraphColor());
363 SkPaint::kLeft_Align,
366 text_bounds.bottom());
370 SkPaint::kRight_Align,
373 text_bounds.bottom());
375 DrawGraphLines(canvas, &paint, graph_bounds, fps_graph_);
377 // Collect graph and histogram data.
380 const int kHistogramSize = 20;
381 double histogram[kHistogramSize] = { 1.0 };
382 double max_bucket_value = 1.0;
384 for (FrameRateCounter::RingBufferType::Iterator it = --fps_counter->end(); it;
386 base::TimeDelta delta = fps_counter->RecentFrameInterval(it.index() + 1);
388 // Skip this particular instantaneous frame rate if it is not likely to have
390 if (!fps_counter->IsBadFrameInterval(delta)) {
391 double fps = 1.0 / delta.InSecondsF();
393 // Clamp the FPS to the range we want to plot visually.
394 double p = fps / fps_graph_.current_upper_bound;
398 // Plot this data point.
400 SkPoint::Make(graph_bounds.left() + it.index(),
401 graph_bounds.bottom() - p * graph_bounds.height());
407 // Use the fps value to find the right bucket in the histogram.
408 int bucket_index = floor(p * (kHistogramSize - 1));
410 // Add the delta time to take the time spent at that fps rate into
412 histogram[bucket_index] += delta.InSecondsF();
413 max_bucket_value = std::max(histogram[bucket_index], max_bucket_value);
417 // Draw FPS histogram.
418 paint.setColor(DebugColors::HUDSeparatorLineColor());
419 canvas->drawLine(histogram_bounds.left() - 1,
420 histogram_bounds.top() - 1,
421 histogram_bounds.left() - 1,
422 histogram_bounds.bottom() + 1,
424 canvas->drawLine(histogram_bounds.right() + 1,
425 histogram_bounds.top() - 1,
426 histogram_bounds.right() + 1,
427 histogram_bounds.bottom() + 1,
430 paint.setColor(DebugColors::FPSDisplayTextAndGraphColor());
431 const double bar_height = histogram_bounds.height() / kHistogramSize;
433 for (int i = kHistogramSize - 1; i >= 0; --i) {
434 if (histogram[i] > 0) {
436 histogram[i] / max_bucket_value * histogram_bounds.width();
438 SkRect::MakeXYWH(histogram_bounds.left(),
439 histogram_bounds.bottom() - (i + 1) * bar_height,
447 paint.setAntiAlias(true);
448 paint.setStyle(SkPaint::kStroke_Style);
449 paint.setStrokeWidth(1);
450 canvas->drawPath(path, paint);
455 SkRect HeadsUpDisplayLayerImpl::DrawMemoryDisplay(SkCanvas* canvas,
459 if (!memory_entry_.bytes_total())
460 return SkRect::MakeEmpty();
462 const int kPadding = 4;
463 const int kFontHeight = 13;
465 const int height = 3 * kFontHeight + 4 * kPadding;
466 const int left = bounds().width() - width - right;
467 const SkRect area = SkRect::MakeXYWH(left, top, width, height);
469 const double megabyte = 1024.0 * 1024.0;
471 SkPaint paint = CreatePaint();
472 DrawGraphBackground(canvas, &paint, area);
474 SkPoint title_pos = SkPoint::Make(left + kPadding, top + kFontHeight);
475 SkPoint stat1_pos = SkPoint::Make(left + width - kPadding - 1,
476 top + kPadding + 2 * kFontHeight);
477 SkPoint stat2_pos = SkPoint::Make(left + width - kPadding - 1,
478 top + 2 * kPadding + 3 * kFontHeight);
480 paint.setColor(DebugColors::MemoryDisplayTextColor());
484 SkPaint::kLeft_Align,
489 base::StringPrintf("%6.1f MB used",
490 (memory_entry_.bytes_unreleasable +
491 memory_entry_.bytes_allocated) / megabyte);
492 DrawText(canvas, &paint, text, SkPaint::kRight_Align, kFontHeight, stat1_pos);
494 if (memory_entry_.bytes_over) {
495 paint.setColor(SK_ColorRED);
496 text = base::StringPrintf("%6.1f MB over",
497 memory_entry_.bytes_over / megabyte);
499 text = base::StringPrintf("%6.1f MB max ",
500 memory_entry_.total_budget_in_bytes / megabyte);
502 DrawText(canvas, &paint, text, SkPaint::kRight_Align, kFontHeight, stat2_pos);
507 SkRect HeadsUpDisplayLayerImpl::DrawPaintTimeDisplay(
509 const PaintTimeCounter* paint_time_counter,
512 const int kPadding = 4;
513 const int kFontHeight = 15;
515 const int kGraphWidth = paint_time_counter->HistorySize();
516 const int kGraphHeight = 40;
518 const int width = kGraphWidth + 2 * kPadding;
520 kFontHeight + kGraphHeight + 4 * kPadding + 2 + kFontHeight + kPadding;
521 const int left = bounds().width() - width - right;
523 const SkRect area = SkRect::MakeXYWH(left, top, width, height);
525 SkPaint paint = CreatePaint();
526 DrawGraphBackground(canvas, &paint, area);
528 SkRect text_bounds = SkRect::MakeXYWH(
529 left + kPadding, top + kPadding, kGraphWidth, kFontHeight);
530 SkRect text_bounds2 = SkRect::MakeXYWH(left + kPadding,
531 text_bounds.bottom() + kPadding,
534 SkRect graph_bounds = SkRect::MakeXYWH(left + kPadding,
535 text_bounds2.bottom() + 2 * kPadding,
539 const std::string value_text =
540 base::StringPrintf("%.1f", paint_time_graph_.value);
541 const std::string min_max_text = base::StringPrintf(
542 "%.1f-%.1f", paint_time_graph_.min, paint_time_graph_.max);
544 paint.setColor(DebugColors::PaintTimeDisplayTextAndGraphColor());
547 "Page paint time (ms)",
548 SkPaint::kLeft_Align,
551 text_bounds.bottom());
555 SkPaint::kLeft_Align,
558 text_bounds2.bottom());
562 SkPaint::kRight_Align,
564 text_bounds2.right(),
565 text_bounds2.bottom());
567 paint.setColor(DebugColors::PaintTimeDisplayTextAndGraphColor());
568 for (PaintTimeCounter::RingBufferType::Iterator it =
569 paint_time_counter->End();
572 double pt = it->InMillisecondsF();
577 double p = pt / paint_time_graph_.current_upper_bound;
582 SkRect::MakeXYWH(graph_bounds.left() + it.index(),
583 graph_bounds.bottom() - p * graph_bounds.height(),
585 p * graph_bounds.height()),
589 DrawGraphLines(canvas, &paint, graph_bounds, paint_time_graph_);
594 void HeadsUpDisplayLayerImpl::DrawDebugRect(
597 const DebugRect& rect,
598 SkColor stroke_color,
601 const std::string& label_text) const {
602 gfx::RectF debug_layer_rect = gfx::ScaleRect(
603 rect.rect, 1.0 / contents_scale_x(), 1.0 / contents_scale_y());
604 SkRect sk_rect = RectFToSkRect(debug_layer_rect);
605 paint.setColor(fill_color);
606 paint.setStyle(SkPaint::kFill_Style);
607 canvas->drawRect(sk_rect, paint);
609 paint.setColor(stroke_color);
610 paint.setStyle(SkPaint::kStroke_Style);
611 paint.setStrokeWidth(SkFloatToScalar(stroke_width));
612 canvas->drawRect(sk_rect, paint);
614 if (label_text.length()) {
615 const int kFontHeight = 12;
616 const int kPadding = 3;
619 canvas->clipRect(sk_rect);
620 canvas->translate(sk_rect.x(), sk_rect.y());
622 SkPaint label_paint = CreatePaint();
623 label_paint.setTextSize(kFontHeight);
624 label_paint.setTypeface(typeface_.get());
625 label_paint.setColor(stroke_color);
627 const SkScalar label_text_width =
628 label_paint.measureText(label_text.c_str(), label_text.length());
629 canvas->drawRect(SkRect::MakeWH(label_text_width + 2 * kPadding,
630 kFontHeight + 2 * kPadding),
633 label_paint.setAntiAlias(true);
634 label_paint.setColor(SkColorSetARGB(255, 50, 50, 50));
635 canvas->drawText(label_text.c_str(),
638 kFontHeight * 0.8f + kPadding,
645 void HeadsUpDisplayLayerImpl::DrawDebugRects(
647 DebugRectHistory* debug_rect_history) {
648 SkPaint paint = CreatePaint();
650 const std::vector<DebugRect>& debug_rects = debug_rect_history->debug_rects();
651 std::vector<DebugRect> new_paint_rects;
653 for (size_t i = 0; i < debug_rects.size(); ++i) {
654 SkColor stroke_color = 0;
655 SkColor fill_color = 0;
656 float stroke_width = 0.f;
657 std::string label_text;
659 switch (debug_rects[i].type) {
660 case PAINT_RECT_TYPE:
661 new_paint_rects.push_back(debug_rects[i]);
663 case PROPERTY_CHANGED_RECT_TYPE:
664 stroke_color = DebugColors::PropertyChangedRectBorderColor();
665 fill_color = DebugColors::PropertyChangedRectFillColor();
666 stroke_width = DebugColors::PropertyChangedRectBorderWidth();
668 case SURFACE_DAMAGE_RECT_TYPE:
669 stroke_color = DebugColors::SurfaceDamageRectBorderColor();
670 fill_color = DebugColors::SurfaceDamageRectFillColor();
671 stroke_width = DebugColors::SurfaceDamageRectBorderWidth();
673 case REPLICA_SCREEN_SPACE_RECT_TYPE:
674 stroke_color = DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor();
675 fill_color = DebugColors::ScreenSpaceSurfaceReplicaRectFillColor();
676 stroke_width = DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth();
678 case SCREEN_SPACE_RECT_TYPE:
679 stroke_color = DebugColors::ScreenSpaceLayerRectBorderColor();
680 fill_color = DebugColors::ScreenSpaceLayerRectFillColor();
681 stroke_width = DebugColors::ScreenSpaceLayerRectBorderWidth();
683 case OCCLUDING_RECT_TYPE:
684 stroke_color = DebugColors::OccludingRectBorderColor();
685 fill_color = DebugColors::OccludingRectFillColor();
686 stroke_width = DebugColors::OccludingRectBorderWidth();
688 case NONOCCLUDING_RECT_TYPE:
689 stroke_color = DebugColors::NonOccludingRectBorderColor();
690 fill_color = DebugColors::NonOccludingRectFillColor();
691 stroke_width = DebugColors::NonOccludingRectBorderWidth();
693 case TOUCH_EVENT_HANDLER_RECT_TYPE:
694 stroke_color = DebugColors::TouchEventHandlerRectBorderColor();
695 fill_color = DebugColors::TouchEventHandlerRectFillColor();
696 stroke_width = DebugColors::TouchEventHandlerRectBorderWidth();
697 label_text = "touch event listener";
699 case WHEEL_EVENT_HANDLER_RECT_TYPE:
700 stroke_color = DebugColors::WheelEventHandlerRectBorderColor();
701 fill_color = DebugColors::WheelEventHandlerRectFillColor();
702 stroke_width = DebugColors::WheelEventHandlerRectBorderWidth();
703 label_text = "mousewheel event listener";
705 case NON_FAST_SCROLLABLE_RECT_TYPE:
706 stroke_color = DebugColors::NonFastScrollableRectBorderColor();
707 fill_color = DebugColors::NonFastScrollableRectFillColor();
708 stroke_width = DebugColors::NonFastScrollableRectBorderWidth();
709 label_text = "repaints on scroll";
711 case ANIMATION_BOUNDS_RECT_TYPE:
712 stroke_color = DebugColors::LayerAnimationBoundsBorderColor();
713 fill_color = DebugColors::LayerAnimationBoundsFillColor();
714 stroke_width = DebugColors::LayerAnimationBoundsBorderWidth();
715 label_text = "animation bounds";
719 DrawDebugRect(canvas,
728 if (new_paint_rects.size()) {
729 paint_rects_.swap(new_paint_rects);
730 fade_step_ = DebugColors::kFadeSteps;
732 if (fade_step_ > 0) {
734 for (size_t i = 0; i < paint_rects_.size(); ++i) {
735 DrawDebugRect(canvas,
738 DebugColors::PaintRectBorderColor(fade_step_),
739 DebugColors::PaintRectFillColor(fade_step_),
740 DebugColors::PaintRectBorderWidth(),
746 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const {
747 return "cc::HeadsUpDisplayLayerImpl";
750 void HeadsUpDisplayLayerImpl::AsValueInto(base::DictionaryValue* dict) const {
751 LayerImpl::AsValueInto(dict);
752 dict->SetString("layer_name", "Heads Up Display Layer");