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/layers/heads_up_display_layer_impl.h" | 5 #include "cc/layers/heads_up_display_layer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 current_upper_bound += (target_upper_bound - current_upper_bound) * 0.5; | 64 current_upper_bound += (target_upper_bound - current_upper_bound) * 0.5; |
65 return current_upper_bound; | 65 return current_upper_bound; |
66 } | 66 } |
67 | 67 |
68 HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(LayerTreeImpl* tree_impl, | 68 HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(LayerTreeImpl* tree_impl, |
69 int id) | 69 int id) |
70 : LayerImpl(tree_impl, id), | 70 : LayerImpl(tree_impl, id), |
71 typeface_(skia::AdoptRef( | 71 typeface_(skia::AdoptRef( |
72 SkTypeface::CreateFromName("monospace", SkTypeface::kBold))), | 72 SkTypeface::CreateFromName("monospace", SkTypeface::kBold))), |
73 fps_graph_(60.0, 80.0), | 73 fps_graph_(60.0, 80.0), |
74 paint_time_graph_(16.0, 48.0) {} | 74 paint_time_graph_(16.0, 48.0), |
75 current_paint_rect_color_(0) {} | |
75 | 76 |
76 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {} | 77 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {} |
77 | 78 |
78 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl( | 79 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl( |
79 LayerTreeImpl* tree_impl) { | 80 LayerTreeImpl* tree_impl) { |
80 return HeadsUpDisplayLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 81 return HeadsUpDisplayLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
81 } | 82 } |
82 | 83 |
83 bool HeadsUpDisplayLayerImpl::WillDraw(DrawMode draw_mode, | 84 bool HeadsUpDisplayLayerImpl::WillDraw(DrawMode draw_mode, |
84 ResourceProvider* resource_provider) { | 85 ResourceProvider* resource_provider) { |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
584 DrawGraphLines(canvas, &paint, graph_bounds, paint_time_graph_); | 585 DrawGraphLines(canvas, &paint, graph_bounds, paint_time_graph_); |
585 | 586 |
586 return area; | 587 return area; |
587 } | 588 } |
588 | 589 |
589 void HeadsUpDisplayLayerImpl::DrawDebugRects( | 590 void HeadsUpDisplayLayerImpl::DrawDebugRects( |
590 SkCanvas* canvas, | 591 SkCanvas* canvas, |
591 DebugRectHistory* debug_rect_history) const { | 592 DebugRectHistory* debug_rect_history) const { |
592 const std::vector<DebugRect>& debug_rects = debug_rect_history->debug_rects(); | 593 const std::vector<DebugRect>& debug_rects = debug_rect_history->debug_rects(); |
593 SkPaint paint = CreatePaint(); | 594 SkPaint paint = CreatePaint(); |
595 // static int s_currentPaintRectColor = 0; | |
danakj
2014/02/10 16:11:12
remove this
| |
596 current_paint_rect_color_++; | |
594 | 597 |
595 for (size_t i = 0; i < debug_rects.size(); ++i) { | 598 for (size_t i = 0; i < debug_rects.size(); ++i) { |
596 SkColor stroke_color = 0; | 599 SkColor stroke_color = 0; |
597 SkColor fill_color = 0; | 600 SkColor fill_color = 0; |
598 float stroke_width = 0.f; | 601 float stroke_width = 0.f; |
599 std::string label_text; | 602 std::string label_text; |
600 | 603 |
601 switch (debug_rects[i].type) { | 604 switch (debug_rects[i].type) { |
602 case PAINT_RECT_TYPE: | 605 case PAINT_RECT_TYPE: |
603 stroke_color = DebugColors::PaintRectBorderColor(); | 606 stroke_color = |
604 fill_color = DebugColors::PaintRectFillColor(); | 607 DebugColors::PaintRectBorderColor(current_paint_rect_color_); |
608 fill_color = DebugColors::PaintRectFillColor(current_paint_rect_color_); | |
605 stroke_width = DebugColors::PaintRectBorderWidth(); | 609 stroke_width = DebugColors::PaintRectBorderWidth(); |
606 break; | 610 break; |
607 case PROPERTY_CHANGED_RECT_TYPE: | 611 case PROPERTY_CHANGED_RECT_TYPE: |
608 stroke_color = DebugColors::PropertyChangedRectBorderColor(); | 612 stroke_color = DebugColors::PropertyChangedRectBorderColor(); |
609 fill_color = DebugColors::PropertyChangedRectFillColor(); | 613 fill_color = DebugColors::PropertyChangedRectFillColor(); |
610 stroke_width = DebugColors::PropertyChangedRectBorderWidth(); | 614 stroke_width = DebugColors::PropertyChangedRectBorderWidth(); |
611 break; | 615 break; |
612 case SURFACE_DAMAGE_RECT_TYPE: | 616 case SURFACE_DAMAGE_RECT_TYPE: |
613 stroke_color = DebugColors::SurfaceDamageRectBorderColor(); | 617 stroke_color = DebugColors::SurfaceDamageRectBorderColor(); |
614 fill_color = DebugColors::SurfaceDamageRectFillColor(); | 618 fill_color = DebugColors::SurfaceDamageRectFillColor(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
708 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { | 712 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { |
709 return "cc::HeadsUpDisplayLayerImpl"; | 713 return "cc::HeadsUpDisplayLayerImpl"; |
710 } | 714 } |
711 | 715 |
712 void HeadsUpDisplayLayerImpl::AsValueInto(base::DictionaryValue* dict) const { | 716 void HeadsUpDisplayLayerImpl::AsValueInto(base::DictionaryValue* dict) const { |
713 LayerImpl::AsValueInto(dict); | 717 LayerImpl::AsValueInto(dict); |
714 dict->SetString("layer_name", "Heads Up Display Layer"); | 718 dict->SetString("layer_name", "Heads Up Display Layer"); |
715 } | 719 } |
716 | 720 |
717 } // namespace cc | 721 } // namespace cc |
OLD | NEW |