Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: cc/layers/heads_up_display_layer_impl.cc

Issue 367833003: cc: Start using raster/eviction iterators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/debug/rasterize_and_record_benchmark_impl.cc ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 paint.setStrokeWidth(1); 478 paint.setStrokeWidth(1);
479 canvas->drawPath(path, paint); 479 canvas->drawPath(path, paint);
480 480
481 return area; 481 return area;
482 } 482 }
483 483
484 SkRect HeadsUpDisplayLayerImpl::DrawMemoryDisplay(SkCanvas* canvas, 484 SkRect HeadsUpDisplayLayerImpl::DrawMemoryDisplay(SkCanvas* canvas,
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_.total_bytes_used)
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 = 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 kMegabyte = 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);
506 SkPoint stat2_pos = SkPoint::Make(left + width - kPadding - 1, 506 SkPoint stat2_pos = SkPoint::Make(left + width - kPadding - 1,
507 top + 2 * kPadding + 3 * kFontHeight); 507 top + 2 * kPadding + 3 * kFontHeight);
508 508
509 paint.setColor(DebugColors::MemoryDisplayTextColor()); 509 paint.setColor(DebugColors::MemoryDisplayTextColor());
510 DrawText(canvas, 510 DrawText(canvas,
511 &paint, 511 &paint,
512 "GPU memory", 512 "GPU memory",
513 SkPaint::kLeft_Align, 513 SkPaint::kLeft_Align,
514 kFontHeight, 514 kFontHeight,
515 title_pos); 515 title_pos);
516 516
517 std::string text = 517 std::string text = base::StringPrintf(
518 base::StringPrintf("%6.1f MB used", 518 "%6.1f MB used", memory_entry_.total_bytes_used / kMegabyte);
519 (memory_entry_.bytes_unreleasable +
520 memory_entry_.bytes_allocated) / megabyte);
521 DrawText(canvas, &paint, text, SkPaint::kRight_Align, kFontHeight, stat1_pos); 519 DrawText(canvas, &paint, text, SkPaint::kRight_Align, kFontHeight, stat1_pos);
522 520
523 if (memory_entry_.bytes_over) { 521 if (!memory_entry_.had_enough_memory)
524 paint.setColor(SK_ColorRED); 522 paint.setColor(SK_ColorRED);
525 text = base::StringPrintf("%6.1f MB over", 523 text = base::StringPrintf("%6.1f MB max ",
526 memory_entry_.bytes_over / megabyte); 524 memory_entry_.total_budget_in_bytes / kMegabyte);
527 } else {
528 text = base::StringPrintf("%6.1f MB max ",
529 memory_entry_.total_budget_in_bytes / megabyte);
530 }
531 DrawText(canvas, &paint, text, SkPaint::kRight_Align, kFontHeight, stat2_pos); 525 DrawText(canvas, &paint, text, SkPaint::kRight_Align, kFontHeight, stat2_pos);
532 526
533 return area; 527 return area;
534 } 528 }
535 529
536 SkRect HeadsUpDisplayLayerImpl::DrawPaintTimeDisplay( 530 SkRect HeadsUpDisplayLayerImpl::DrawPaintTimeDisplay(
537 SkCanvas* canvas, 531 SkCanvas* canvas,
538 const PaintTimeCounter* paint_time_counter, 532 const PaintTimeCounter* paint_time_counter,
539 int right, 533 int right,
540 int top) const { 534 int top) const {
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 return "cc::HeadsUpDisplayLayerImpl"; 782 return "cc::HeadsUpDisplayLayerImpl";
789 } 783 }
790 784
791 void HeadsUpDisplayLayerImpl::AsValueInto( 785 void HeadsUpDisplayLayerImpl::AsValueInto(
792 base::debug::TracedValue* dict) const { 786 base::debug::TracedValue* dict) const {
793 LayerImpl::AsValueInto(dict); 787 LayerImpl::AsValueInto(dict);
794 dict->SetString("layer_name", "Heads Up Display Layer"); 788 dict->SetString("layer_name", "Heads Up Display Layer");
795 } 789 }
796 790
797 } // namespace cc 791 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug/rasterize_and_record_benchmark_impl.cc ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698