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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 std::vector<DebugRect> new_paint_rects; | 661 std::vector<DebugRect> new_paint_rects; |
662 | 662 |
663 for (size_t i = 0; i < debug_rects.size(); ++i) { | 663 for (size_t i = 0; i < debug_rects.size(); ++i) { |
664 SkColor stroke_color = 0; | 664 SkColor stroke_color = 0; |
665 SkColor fill_color = 0; | 665 SkColor fill_color = 0; |
666 float stroke_width = 0.f; | 666 float stroke_width = 0.f; |
667 std::string label_text; | 667 std::string label_text; |
668 | 668 |
669 switch (debug_rects[i].type) { | 669 switch (debug_rects[i].type) { |
670 case PAINT_RECT_TYPE: | 670 case PAINT_RECT_TYPE: |
| 671 case FIRST_PAINT_RECT_TYPE: |
671 new_paint_rects.push_back(debug_rects[i]); | 672 new_paint_rects.push_back(debug_rects[i]); |
672 continue; | 673 continue; |
673 case PROPERTY_CHANGED_RECT_TYPE: | 674 case PROPERTY_CHANGED_RECT_TYPE: |
674 stroke_color = DebugColors::PropertyChangedRectBorderColor(); | 675 stroke_color = DebugColors::PropertyChangedRectBorderColor(); |
675 fill_color = DebugColors::PropertyChangedRectFillColor(); | 676 fill_color = DebugColors::PropertyChangedRectFillColor(); |
676 stroke_width = DebugColors::PropertyChangedRectBorderWidth(); | 677 stroke_width = DebugColors::PropertyChangedRectBorderWidth(); |
677 break; | 678 break; |
678 case SURFACE_DAMAGE_RECT_TYPE: | 679 case SURFACE_DAMAGE_RECT_TYPE: |
679 stroke_color = DebugColors::SurfaceDamageRectBorderColor(); | 680 stroke_color = DebugColors::SurfaceDamageRectBorderColor(); |
680 fill_color = DebugColors::SurfaceDamageRectFillColor(); | 681 fill_color = DebugColors::SurfaceDamageRectFillColor(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 label_text); | 742 label_text); |
742 } | 743 } |
743 | 744 |
744 if (new_paint_rects.size()) { | 745 if (new_paint_rects.size()) { |
745 paint_rects_.swap(new_paint_rects); | 746 paint_rects_.swap(new_paint_rects); |
746 fade_step_ = DebugColors::kFadeSteps; | 747 fade_step_ = DebugColors::kFadeSteps; |
747 } | 748 } |
748 if (fade_step_ > 0) { | 749 if (fade_step_ > 0) { |
749 fade_step_--; | 750 fade_step_--; |
750 for (size_t i = 0; i < paint_rects_.size(); ++i) { | 751 for (size_t i = 0; i < paint_rects_.size(); ++i) { |
751 DrawDebugRect(canvas, | 752 bool is_first_paint = paint_rects_[i].type == FIRST_PAINT_RECT_TYPE; |
752 &paint, | 753 DrawDebugRect( |
753 paint_rects_[i], | 754 canvas, |
754 DebugColors::PaintRectBorderColor(fade_step_), | 755 &paint, |
755 DebugColors::PaintRectFillColor(fade_step_), | 756 paint_rects_[i], |
756 DebugColors::PaintRectBorderWidth(), | 757 DebugColors::PaintRectBorderColor(fade_step_, is_first_paint), |
757 ""); | 758 DebugColors::PaintRectFillColor(fade_step_, is_first_paint), |
| 759 DebugColors::PaintRectBorderWidth(), |
| 760 ""); |
758 } | 761 } |
759 } | 762 } |
760 } | 763 } |
761 | 764 |
762 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { | 765 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { |
763 return "cc::HeadsUpDisplayLayerImpl"; | 766 return "cc::HeadsUpDisplayLayerImpl"; |
764 } | 767 } |
765 | 768 |
766 void HeadsUpDisplayLayerImpl::AsValueInto( | 769 void HeadsUpDisplayLayerImpl::AsValueInto( |
767 base::debug::TracedValue* dict) const { | 770 base::debug::TracedValue* dict) const { |
768 LayerImpl::AsValueInto(dict); | 771 LayerImpl::AsValueInto(dict); |
769 dict->SetString("layer_name", "Heads Up Display Layer"); | 772 dict->SetString("layer_name", "Heads Up Display Layer"); |
770 } | 773 } |
771 | 774 |
772 } // namespace cc | 775 } // namespace cc |
OLD | NEW |