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

Side by Side Diff: cc/debug_rect_history.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScaleAsVector Created 8 years, 1 month 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.h ('k') | cc/delegated_renderer_layer_impl_unittest.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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/debug_rect_history.h" 7 #include "cc/debug_rect_history.h"
8 8
9 #include "cc/damage_tracker.h" 9 #include "cc/damage_tracker.h"
10 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 saveOccludingRects(occludingScreenSpaceRects); 48 saveOccludingRects(occludingScreenSpaceRects);
49 } 49 }
50 50
51 51
52 void DebugRectHistory::savePaintRects(LayerImpl* layer) 52 void DebugRectHistory::savePaintRects(LayerImpl* layer)
53 { 53 {
54 // We would like to visualize where any layer's paint rect (update rect) has changed, 54 // We would like to visualize where any layer's paint rect (update rect) has changed,
55 // regardless of whether this layer is skipped for actual drawing or not. Th erefore 55 // regardless of whether this layer is skipped for actual drawing or not. Th erefore
56 // we traverse recursively over all layers, not just the render surface list . 56 // we traverse recursively over all layers, not just the render surface list .
57 57
58 if (!layer->updateRect().isEmpty() && layer->drawsContent()) { 58 if (!layer->updateRect().IsEmpty() && layer->drawsContent()) {
59 FloatRect updateContentRect = layer->updateRect(); 59 float widthScale = layer->contentBounds().width() / static_cast<float>(l ayer->bounds().width());
60 updateContentRect.scale(layer->contentBounds().width() / static_cast<flo at>(layer->bounds().width()), layer->contentBounds().height() / static_cast<floa t>(layer->bounds().height())); 60 float heightScale = layer->contentBounds().height() / static_cast<float> (layer->bounds().height());
61 gfx::RectF updateContentRect = gfx::ScaleRect(layer->updateRect(), width Scale, heightScale);
61 m_debugRects.push_back(DebugRect(PaintRectType, MathUtil::mapClippedRect (layer->screenSpaceTransform(), updateContentRect))); 62 m_debugRects.push_back(DebugRect(PaintRectType, MathUtil::mapClippedRect (layer->screenSpaceTransform(), updateContentRect)));
62 } 63 }
63 64
64 for (unsigned i = 0; i < layer->children().size(); ++i) 65 for (unsigned i = 0; i < layer->children().size(); ++i)
65 savePaintRects(layer->children()[i]); 66 savePaintRects(layer->children()[i]);
66 } 67 }
67 68
68 void DebugRectHistory::savePropertyChangedRects(const std::vector<LayerImpl*>& r enderSurfaceLayerList) 69 void DebugRectHistory::savePropertyChangedRects(const std::vector<LayerImpl*>& r enderSurfaceLayerList)
69 { 70 {
70 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { 71 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
71 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; 72 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
72 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface(); 73 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface();
73 DCHECK(renderSurface); 74 DCHECK(renderSurface);
74 75
75 const std::vector<LayerImpl*>& layerList = renderSurface->layerList(); 76 const std::vector<LayerImpl*>& layerList = renderSurface->layerList();
76 for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerInde x) { 77 for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerInde x) {
77 LayerImpl* layer = layerList[layerIndex]; 78 LayerImpl* layer = layerList[layerIndex];
78 79
79 if (LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerImpl> (layer, renderSurfaceLayer->id())) 80 if (LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerImpl> (layer, renderSurfaceLayer->id()))
80 continue; 81 continue;
81 82
82 if (layer->layerIsAlwaysDamaged()) 83 if (layer->layerIsAlwaysDamaged())
83 continue; 84 continue;
84 85
85 if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChan ged()) 86 if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChan ged())
86 m_debugRects.push_back(DebugRect(PropertyChangedRectType, MathUt il::mapClippedRect(layer->screenSpaceTransform(), FloatRect(FloatPoint::zero(), layer->contentBounds())))); 87 m_debugRects.push_back(DebugRect(PropertyChangedRectType, MathUt il::mapClippedRect(layer->screenSpaceTransform(), gfx::RectF(gfx::PointF(), laye r->contentBounds()))));
87 } 88 }
88 } 89 }
89 } 90 }
90 91
91 void DebugRectHistory::saveSurfaceDamageRects(const std::vector<LayerImpl* >& re nderSurfaceLayerList) 92 void DebugRectHistory::saveSurfaceDamageRects(const std::vector<LayerImpl* >& re nderSurfaceLayerList)
92 { 93 {
93 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) { 94 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
94 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; 95 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex];
95 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface(); 96 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface();
96 DCHECK(renderSurface); 97 DCHECK(renderSurface);
(...skipping 12 matching lines...) Expand all
109 m_debugRects.push_back(DebugRect(ScreenSpaceRectType, MathUtil::mapClipp edRect(renderSurface->screenSpaceTransform(), renderSurface->contentRect()))); 110 m_debugRects.push_back(DebugRect(ScreenSpaceRectType, MathUtil::mapClipp edRect(renderSurface->screenSpaceTransform(), renderSurface->contentRect())));
110 111
111 if (renderSurfaceLayer->replicaLayer()) 112 if (renderSurfaceLayer->replicaLayer())
112 m_debugRects.push_back(DebugRect(ReplicaScreenSpaceRectType, MathUti l::mapClippedRect(renderSurface->replicaScreenSpaceTransform(), renderSurface->c ontentRect()))); 113 m_debugRects.push_back(DebugRect(ReplicaScreenSpaceRectType, MathUti l::mapClippedRect(renderSurface->replicaScreenSpaceTransform(), renderSurface->c ontentRect())));
113 } 114 }
114 } 115 }
115 116
116 void DebugRectHistory::saveOccludingRects(const std::vector<gfx::Rect>& occludin gRects) 117 void DebugRectHistory::saveOccludingRects(const std::vector<gfx::Rect>& occludin gRects)
117 { 118 {
118 for (size_t i = 0; i < occludingRects.size(); ++i) 119 for (size_t i = 0; i < occludingRects.size(); ++i)
119 m_debugRects.push_back(DebugRect(OccludingRectType, cc::IntRect(occludin gRects[i]))); 120 m_debugRects.push_back(DebugRect(OccludingRectType, cc::FloatRect(occlud ingRects[i])));
120 } 121 }
121 122
122 } // namespace cc 123 } // namespace cc
OLDNEW
« no previous file with comments | « cc/debug_rect_history.h ('k') | cc/delegated_renderer_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698