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

Side by Side Diff: cc/debug/debug_rect_history.cc

Issue 474783002: HUD: Show first paint invalidation in red (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update only when needed Created 6 years, 3 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
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/debug/debug_rect_history.h" 5 #include "cc/debug/debug_rect_history.h"
6 6
7 #include "cc/base/math_util.h" 7 #include "cc/base/math_util.h"
8 #include "cc/layers/layer_impl.h" 8 #include "cc/layers/layer_impl.h"
9 #include "cc/layers/layer_iterator.h" 9 #include "cc/layers/layer_iterator.h"
10 #include "cc/layers/layer_utils.h" 10 #include "cc/layers/layer_utils.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 SaveLayerAnimationBoundsRects(render_surface_layer_list); 70 SaveLayerAnimationBoundsRects(render_surface_layer_list);
71 } 71 }
72 72
73 void DebugRectHistory::SavePaintRects(LayerImpl* layer) { 73 void DebugRectHistory::SavePaintRects(LayerImpl* layer) {
74 // We would like to visualize where any layer's paint rect (update rect) has 74 // We would like to visualize where any layer's paint rect (update rect) has
75 // changed, regardless of whether this layer is skipped for actual drawing or 75 // changed, regardless of whether this layer is skipped for actual drawing or
76 // not. Therefore we traverse recursively over all layers, not just the render 76 // not. Therefore we traverse recursively over all layers, not just the render
77 // surface list. 77 // surface list.
78 78
79 if (!layer->update_rect().IsEmpty() && layer->DrawsContent()) { 79 if (!layer->update_rect().IsEmpty() && layer->DrawsContent()) {
80 bool is_first_paint = layer->includes_first_paint_invalidation();
81
80 float width_scale = layer->content_bounds().width() / 82 float width_scale = layer->content_bounds().width() /
81 static_cast<float>(layer->bounds().width()); 83 static_cast<float>(layer->bounds().width());
82 float height_scale = layer->content_bounds().height() / 84 float height_scale = layer->content_bounds().height() /
83 static_cast<float>(layer->bounds().height()); 85 static_cast<float>(layer->bounds().height());
84 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect( 86 gfx::Rect update_content_rect = gfx::ScaleToEnclosingRect(
85 gfx::ToEnclosingRect(layer->update_rect()), width_scale, height_scale); 87 gfx::ToEnclosingRect(layer->update_rect()), width_scale, height_scale);
86 debug_rects_.push_back( 88 debug_rects_.push_back(
87 DebugRect(PAINT_RECT_TYPE, 89 DebugRect(is_first_paint ? FIRST_PAINT_RECT_TYPE : PAINT_RECT_TYPE,
88 MathUtil::MapEnclosingClippedRect( 90 MathUtil::MapEnclosingClippedRect(
89 layer->screen_space_transform(), update_content_rect))); 91 layer->screen_space_transform(), update_content_rect)));
90 } 92 }
91 93
92 for (unsigned i = 0; i < layer->children().size(); ++i) 94 for (unsigned i = 0; i < layer->children().size(); ++i)
93 SavePaintRects(layer->children()[i]); 95 SavePaintRects(layer->children()[i]);
94 } 96 }
95 97
96 void DebugRectHistory::SavePropertyChangedRects( 98 void DebugRectHistory::SavePropertyChangedRects(
97 const LayerImplList& render_surface_layer_list, 99 const LayerImplList& render_surface_layer_list,
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 debug_rects_.push_back( 287 debug_rects_.push_back(
286 DebugRect(ANIMATION_BOUNDS_RECT_TYPE, 288 DebugRect(ANIMATION_BOUNDS_RECT_TYPE,
287 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(), 289 gfx::ToEnclosingRect(gfx::RectF(inflated_bounds.x(),
288 inflated_bounds.y(), 290 inflated_bounds.y(),
289 inflated_bounds.width(), 291 inflated_bounds.width(),
290 inflated_bounds.height())))); 292 inflated_bounds.height()))));
291 } 293 }
292 } 294 }
293 295
294 } // namespace cc 296 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698