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

Side by Side Diff: cc/heads_up_display_layer_impl.cc

Issue 12522005: cc: Chromify DebugRectHistory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 7 years, 9 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_rect_history.cc ('k') | cc/layer_tree_host_impl.cc » ('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/heads_up_display_layer_impl.h" 5 #include "cc/heads_up_display_layer_impl.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "cc/debug_colors.h" 9 #include "cc/debug_colors.h"
10 #include "cc/debug_rect_history.h" 10 #include "cc/debug_rect_history.h"
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 canvas->drawRect(SkRect::MakeXYWH(graphBounds.left() + it.index(), graph Bounds.bottom() - p * graphBounds.height(), 1, p * graphBounds.height()), paint) ; 472 canvas->drawRect(SkRect::MakeXYWH(graphBounds.left() + it.index(), graph Bounds.bottom() - p * graphBounds.height(), 1, p * graphBounds.height()), paint) ;
473 } 473 }
474 474
475 drawGraphLines(canvas, &paint, graphBounds, m_paintTimeGraph); 475 drawGraphLines(canvas, &paint, graphBounds, m_paintTimeGraph);
476 476
477 return area; 477 return area;
478 } 478 }
479 479
480 void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory* debugRectHistory) const 480 void HeadsUpDisplayLayerImpl::drawDebugRects(SkCanvas* canvas, DebugRectHistory* debugRectHistory) const
481 { 481 {
482 const std::vector<DebugRect>& debugRects = debugRectHistory->debugRects(); 482 const std::vector<DebugRect>& debug_rects = debugRectHistory->debug_rects();
483 float rectScale = 1 / layer_tree_impl()->device_scale_factor(); 483 float rectScale = 1 / layer_tree_impl()->device_scale_factor();
484 SkPaint paint = createPaint(); 484 SkPaint paint = createPaint();
485 485
486 canvas->save(); 486 canvas->save();
487 canvas->scale(rectScale, rectScale); 487 canvas->scale(rectScale, rectScale);
488 488
489 for (size_t i = 0; i < debugRects.size(); ++i) { 489 for (size_t i = 0; i < debug_rects.size(); ++i) {
490 SkColor strokeColor = 0; 490 SkColor strokeColor = 0;
491 SkColor fillColor = 0; 491 SkColor fillColor = 0;
492 float strokeWidth = 0; 492 float strokeWidth = 0;
493 493
494 switch (debugRects[i].type) { 494 switch (debug_rects[i].type) {
495 case PaintRectType: 495 case PAINT_RECT_TYPE:
496 strokeColor = DebugColors::PaintRectBorderColor(); 496 strokeColor = DebugColors::PaintRectBorderColor();
497 fillColor = DebugColors::PaintRectFillColor(); 497 fillColor = DebugColors::PaintRectFillColor();
498 strokeWidth = DebugColors::PaintRectBorderWidth(layer_tree_impl()); 498 strokeWidth = DebugColors::PaintRectBorderWidth(layer_tree_impl());
499 break; 499 break;
500 case PropertyChangedRectType: 500 case PROPERTY_CHANGED_RECT_TYPE:
501 strokeColor = DebugColors::PropertyChangedRectBorderColor(); 501 strokeColor = DebugColors::PropertyChangedRectBorderColor();
502 fillColor = DebugColors::PropertyChangedRectFillColor(); 502 fillColor = DebugColors::PropertyChangedRectFillColor();
503 strokeWidth = DebugColors::PropertyChangedRectBorderWidth(layer_tree _impl()); 503 strokeWidth = DebugColors::PropertyChangedRectBorderWidth(layer_tree _impl());
504 break; 504 break;
505 case SurfaceDamageRectType: 505 case SURFACE_DAMAGE_RECT_TYPE:
506 strokeColor = DebugColors::SurfaceDamageRectBorderColor(); 506 strokeColor = DebugColors::SurfaceDamageRectBorderColor();
507 fillColor = DebugColors::SurfaceDamageRectFillColor(); 507 fillColor = DebugColors::SurfaceDamageRectFillColor();
508 strokeWidth = DebugColors::SurfaceDamageRectBorderWidth(layer_tree_i mpl()); 508 strokeWidth = DebugColors::SurfaceDamageRectBorderWidth(layer_tree_i mpl());
509 break; 509 break;
510 case ReplicaScreenSpaceRectType: 510 case REPLICA_SCREEN_SPACE_RECT_TYPE:
511 strokeColor = DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor( ); 511 strokeColor = DebugColors::ScreenSpaceSurfaceReplicaRectBorderColor( );
512 fillColor = DebugColors::ScreenSpaceSurfaceReplicaRectFillColor(); 512 fillColor = DebugColors::ScreenSpaceSurfaceReplicaRectFillColor();
513 strokeWidth = DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth( layer_tree_impl()); 513 strokeWidth = DebugColors::ScreenSpaceSurfaceReplicaRectBorderWidth( layer_tree_impl());
514 break; 514 break;
515 case ScreenSpaceRectType: 515 case SCREEN_SPACE_RECT_TYPE:
516 strokeColor = DebugColors::ScreenSpaceLayerRectBorderColor(); 516 strokeColor = DebugColors::ScreenSpaceLayerRectBorderColor();
517 fillColor = DebugColors::ScreenSpaceLayerRectFillColor(); 517 fillColor = DebugColors::ScreenSpaceLayerRectFillColor();
518 strokeWidth = DebugColors::ScreenSpaceLayerRectBorderWidth(layer_tre e_impl()); 518 strokeWidth = DebugColors::ScreenSpaceLayerRectBorderWidth(layer_tre e_impl());
519 break; 519 break;
520 case OccludingRectType: 520 case OCCLUDING_RECT_TYPE:
521 strokeColor = DebugColors::OccludingRectBorderColor(); 521 strokeColor = DebugColors::OccludingRectBorderColor();
522 fillColor = DebugColors::OccludingRectFillColor(); 522 fillColor = DebugColors::OccludingRectFillColor();
523 strokeWidth = DebugColors::OccludingRectBorderWidth(layer_tree_impl( )); 523 strokeWidth = DebugColors::OccludingRectBorderWidth(layer_tree_impl( ));
524 break; 524 break;
525 case NonOccludingRectType: 525 case NONOCCLUDING_RECT_TYPE:
526 strokeColor = DebugColors::NonOccludingRectBorderColor(); 526 strokeColor = DebugColors::NonOccludingRectBorderColor();
527 fillColor = DebugColors::NonOccludingRectFillColor(); 527 fillColor = DebugColors::NonOccludingRectFillColor();
528 strokeWidth = DebugColors::NonOccludingRectBorderWidth(layer_tree_im pl()); 528 strokeWidth = DebugColors::NonOccludingRectBorderWidth(layer_tree_im pl());
529 break; 529 break;
530 } 530 }
531 531
532 const gfx::RectF& rect = debugRects[i].rect; 532 const gfx::RectF& rect = debug_rects[i].rect;
533 SkRect skRect = SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect. height()); 533 SkRect skRect = SkRect::MakeXYWH(rect.x(), rect.y(), rect.width(), rect. height());
534 paint.setColor(fillColor); 534 paint.setColor(fillColor);
535 paint.setStyle(SkPaint::kFill_Style); 535 paint.setStyle(SkPaint::kFill_Style);
536 canvas->drawRect(skRect, paint); 536 canvas->drawRect(skRect, paint);
537 537
538 paint.setColor(strokeColor); 538 paint.setColor(strokeColor);
539 paint.setStyle(SkPaint::kStroke_Style); 539 paint.setStyle(SkPaint::kStroke_Style);
540 paint.setStrokeWidth(SkFloatToScalar(strokeWidth)); 540 paint.setStrokeWidth(SkFloatToScalar(strokeWidth));
541 canvas->drawRect(skRect, paint); 541 canvas->drawRect(skRect, paint);
542 } 542 }
543 543
544 canvas->restore(); 544 canvas->restore();
545 } 545 }
546 546
547 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const 547 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const
548 { 548 {
549 return "HeadsUpDisplayLayer"; 549 return "HeadsUpDisplayLayer";
550 } 550 }
551 551
552 } // namespace cc 552 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug_rect_history.cc ('k') | cc/layer_tree_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698