| 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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 SkRect HeadsUpDisplayLayerImpl::DrawFPSDisplay( | 376 SkRect HeadsUpDisplayLayerImpl::DrawFPSDisplay( |
| 377 SkCanvas* canvas, | 377 SkCanvas* canvas, |
| 378 const FrameRateCounter* fps_counter, | 378 const FrameRateCounter* fps_counter, |
| 379 int right, | 379 int right, |
| 380 int top) const { | 380 int top) const { |
| 381 const int kPadding = 4; | 381 const int kPadding = 4; |
| 382 const int kGap = 6; | 382 const int kGap = 6; |
| 383 | 383 |
| 384 const int kFontHeight = 15; | 384 const int kFontHeight = 15; |
| 385 | 385 |
| 386 const int kGraphWidth = fps_counter->time_stamp_history_size() - 2; | 386 const int kGraphWidth = |
| 387 static_cast<int>(fps_counter->time_stamp_history_size()) - 2; |
| 387 const int kGraphHeight = 40; | 388 const int kGraphHeight = 40; |
| 388 | 389 |
| 389 const int kHistogramWidth = 37; | 390 const int kHistogramWidth = 37; |
| 390 | 391 |
| 391 int width = kGraphWidth + kHistogramWidth + 4 * kPadding; | 392 int width = kGraphWidth + kHistogramWidth + 4 * kPadding; |
| 392 int height = kFontHeight + kGraphHeight + 4 * kPadding + 2; | 393 int height = kFontHeight + kGraphHeight + 4 * kPadding + 2; |
| 393 int left = bounds().width() - width - right; | 394 int left = bounds().width() - width - right; |
| 394 SkRect area = SkRect::MakeXYWH(left, top, width, height); | 395 SkRect area = SkRect::MakeXYWH(left, top, width, height); |
| 395 | 396 |
| 396 SkPaint paint = CreatePaint(); | 397 SkPaint paint = CreatePaint(); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 } | 619 } |
| 619 | 620 |
| 620 SkRect HeadsUpDisplayLayerImpl::DrawPaintTimeDisplay( | 621 SkRect HeadsUpDisplayLayerImpl::DrawPaintTimeDisplay( |
| 621 SkCanvas* canvas, | 622 SkCanvas* canvas, |
| 622 const PaintTimeCounter* paint_time_counter, | 623 const PaintTimeCounter* paint_time_counter, |
| 623 int right, | 624 int right, |
| 624 int top) const { | 625 int top) const { |
| 625 const int kPadding = 4; | 626 const int kPadding = 4; |
| 626 const int kFontHeight = 14; | 627 const int kFontHeight = 14; |
| 627 | 628 |
| 628 const int kGraphWidth = paint_time_counter->HistorySize(); | 629 const int kGraphWidth = static_cast<int>(paint_time_counter->HistorySize()); |
| 629 const int kGraphHeight = 40; | 630 const int kGraphHeight = 40; |
| 630 | 631 |
| 631 SkPaint paint = CreatePaint(); | 632 SkPaint paint = CreatePaint(); |
| 632 | 633 |
| 633 const std::string title = "Compositor frame time (ms)"; | 634 const std::string title = "Compositor frame time (ms)"; |
| 634 int title_text_width = MeasureText(&paint, title, kFontHeight); | 635 int title_text_width = MeasureText(&paint, title, kFontHeight); |
| 635 int contents_width = std::max(title_text_width, kGraphWidth); | 636 int contents_width = std::max(title_text_width, kGraphWidth); |
| 636 | 637 |
| 637 const int width = contents_width + 2 * kPadding; | 638 const int width = contents_width + 2 * kPadding; |
| 638 const int height = | 639 const int height = |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 return "cc::HeadsUpDisplayLayerImpl"; | 862 return "cc::HeadsUpDisplayLayerImpl"; |
| 862 } | 863 } |
| 863 | 864 |
| 864 void HeadsUpDisplayLayerImpl::AsValueInto( | 865 void HeadsUpDisplayLayerImpl::AsValueInto( |
| 865 base::trace_event::TracedValue* dict) const { | 866 base::trace_event::TracedValue* dict) const { |
| 866 LayerImpl::AsValueInto(dict); | 867 LayerImpl::AsValueInto(dict); |
| 867 dict->SetString("layer_name", "Heads Up Display Layer"); | 868 dict->SetString("layer_name", "Heads Up Display Layer"); |
| 868 } | 869 } |
| 869 | 870 |
| 870 } // namespace cc | 871 } // namespace cc |
| OLD | NEW |