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 "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 Loading... |
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 Loading... |
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 |
OLD | NEW |