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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 | 353 |
354 const int kFontHeight = 15; | 354 const int kFontHeight = 15; |
355 | 355 |
356 const int kGraphWidth = fps_counter->time_stamp_history_size() - 2; | 356 const int kGraphWidth = fps_counter->time_stamp_history_size() - 2; |
357 const int kGraphHeight = 40; | 357 const int kGraphHeight = 40; |
358 | 358 |
359 const int kHistogramWidth = 37; | 359 const int kHistogramWidth = 37; |
360 | 360 |
361 int width = kGraphWidth + kHistogramWidth + 4 * kPadding; | 361 int width = kGraphWidth + kHistogramWidth + 4 * kPadding; |
362 int height = kFontHeight + kGraphHeight + 4 * kPadding + 2; | 362 int height = kFontHeight + kGraphHeight + 4 * kPadding + 2; |
363 int left = bounds().width() - width - right; | 363 int left = ceil(bounds().width()) - width - right; |
364 SkRect area = SkRect::MakeXYWH(left, top, width, height); | 364 SkRect area = SkRect::MakeXYWH(left, top, width, height); |
365 | 365 |
366 SkPaint paint = CreatePaint(); | 366 SkPaint paint = CreatePaint(); |
367 DrawGraphBackground(canvas, &paint, area); | 367 DrawGraphBackground(canvas, &paint, area); |
368 | 368 |
369 SkRect text_bounds = | 369 SkRect text_bounds = |
370 SkRect::MakeXYWH(left + kPadding, | 370 SkRect::MakeXYWH(left + kPadding, |
371 top + kPadding, | 371 top + kPadding, |
372 kGraphWidth + kHistogramWidth + kGap + 2, | 372 kGraphWidth + kHistogramWidth + kGap + 2, |
373 kFontHeight); | 373 kFontHeight); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 int right, | 485 int right, |
486 int top, | 486 int top, |
487 int width) const { | 487 int width) const { |
488 if (!memory_entry_.bytes_total()) | 488 if (!memory_entry_.bytes_total()) |
489 return SkRect::MakeEmpty(); | 489 return SkRect::MakeEmpty(); |
490 | 490 |
491 const int kPadding = 4; | 491 const int kPadding = 4; |
492 const int kFontHeight = 13; | 492 const int kFontHeight = 13; |
493 | 493 |
494 const int height = 3 * kFontHeight + 4 * kPadding; | 494 const int height = 3 * kFontHeight + 4 * kPadding; |
495 const int left = bounds().width() - width - right; | 495 const int left = ceil(bounds().width()) - width - right; |
496 const SkRect area = SkRect::MakeXYWH(left, top, width, height); | 496 const SkRect area = SkRect::MakeXYWH(left, top, width, height); |
497 | 497 |
498 const double megabyte = 1024.0 * 1024.0; | 498 const double megabyte = 1024.0 * 1024.0; |
499 | 499 |
500 SkPaint paint = CreatePaint(); | 500 SkPaint paint = CreatePaint(); |
501 DrawGraphBackground(canvas, &paint, area); | 501 DrawGraphBackground(canvas, &paint, area); |
502 | 502 |
503 SkPoint title_pos = SkPoint::Make(left + kPadding, top + kFontHeight); | 503 SkPoint title_pos = SkPoint::Make(left + kPadding, top + kFontHeight); |
504 SkPoint stat1_pos = SkPoint::Make(left + width - kPadding - 1, | 504 SkPoint stat1_pos = SkPoint::Make(left + width - kPadding - 1, |
505 top + kPadding + 2 * kFontHeight); | 505 top + kPadding + 2 * kFontHeight); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 int top) const { | 540 int top) const { |
541 const int kPadding = 4; | 541 const int kPadding = 4; |
542 const int kFontHeight = 15; | 542 const int kFontHeight = 15; |
543 | 543 |
544 const int kGraphWidth = paint_time_counter->HistorySize(); | 544 const int kGraphWidth = paint_time_counter->HistorySize(); |
545 const int kGraphHeight = 40; | 545 const int kGraphHeight = 40; |
546 | 546 |
547 const int width = kGraphWidth + 2 * kPadding; | 547 const int width = kGraphWidth + 2 * kPadding; |
548 const int height = | 548 const int height = |
549 kFontHeight + kGraphHeight + 4 * kPadding + 2 + kFontHeight + kPadding; | 549 kFontHeight + kGraphHeight + 4 * kPadding + 2 + kFontHeight + kPadding; |
550 const int left = bounds().width() - width - right; | 550 const int left = ceil(bounds().width()) - width - right; |
551 | 551 |
552 const SkRect area = SkRect::MakeXYWH(left, top, width, height); | 552 const SkRect area = SkRect::MakeXYWH(left, top, width, height); |
553 | 553 |
554 SkPaint paint = CreatePaint(); | 554 SkPaint paint = CreatePaint(); |
555 DrawGraphBackground(canvas, &paint, area); | 555 DrawGraphBackground(canvas, &paint, area); |
556 | 556 |
557 SkRect text_bounds = SkRect::MakeXYWH( | 557 SkRect text_bounds = SkRect::MakeXYWH( |
558 left + kPadding, top + kPadding, kGraphWidth, kFontHeight); | 558 left + kPadding, top + kPadding, kGraphWidth, kFontHeight); |
559 SkRect text_bounds2 = SkRect::MakeXYWH(left + kPadding, | 559 SkRect text_bounds2 = SkRect::MakeXYWH(left + kPadding, |
560 text_bounds.bottom() + kPadding, | 560 text_bounds.bottom() + kPadding, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 return "cc::HeadsUpDisplayLayerImpl"; | 788 return "cc::HeadsUpDisplayLayerImpl"; |
789 } | 789 } |
790 | 790 |
791 void HeadsUpDisplayLayerImpl::AsValueInto( | 791 void HeadsUpDisplayLayerImpl::AsValueInto( |
792 base::debug::TracedValue* dict) const { | 792 base::debug::TracedValue* dict) const { |
793 LayerImpl::AsValueInto(dict); | 793 LayerImpl::AsValueInto(dict); |
794 dict->SetString("layer_name", "Heads Up Display Layer"); | 794 dict->SetString("layer_name", "Heads Up Display Layer"); |
795 } | 795 } |
796 | 796 |
797 } // namespace cc | 797 } // namespace cc |
OLD | NEW |