| 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 "cc/debug_rect_history.h" | 5 #include "cc/debug_rect_history.h" |
| 6 | 6 |
| 7 #include "cc/damage_tracker.h" | 7 #include "cc/damage_tracker.h" |
| 8 #include "cc/layer_impl.h" | 8 #include "cc/layer_impl.h" |
| 9 #include "cc/layer_tree_host.h" | 9 #include "cc/layer_tree_host.h" |
| 10 #include "cc/math_util.h" | 10 #include "cc/math_util.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 saveNonOccludingRects(nonOccludingScreenSpaceRects); | 49 saveNonOccludingRects(nonOccludingScreenSpaceRects); |
| 50 } | 50 } |
| 51 | 51 |
| 52 | 52 |
| 53 void DebugRectHistory::savePaintRects(LayerImpl* layer) | 53 void DebugRectHistory::savePaintRects(LayerImpl* layer) |
| 54 { | 54 { |
| 55 // We would like to visualize where any layer's paint rect (update rect) has
changed, | 55 // We would like to visualize where any layer's paint rect (update rect) has
changed, |
| 56 // regardless of whether this layer is skipped for actual drawing or not. Th
erefore | 56 // regardless of whether this layer is skipped for actual drawing or not. Th
erefore |
| 57 // we traverse recursively over all layers, not just the render surface list
. | 57 // we traverse recursively over all layers, not just the render surface list
. |
| 58 | 58 |
| 59 if (!layer->updateRect().IsEmpty() && layer->drawsContent()) { | 59 if (!layer->update_rect().IsEmpty() && layer->DrawsContent()) { |
| 60 float widthScale = layer->contentBounds().width() / static_cast<float>(l
ayer->bounds().width()); | 60 float widthScale = layer->content_bounds().width() / static_cast<float>(
layer->bounds().width()); |
| 61 float heightScale = layer->contentBounds().height() / static_cast<float>
(layer->bounds().height()); | 61 float heightScale = layer->content_bounds().height() / static_cast<float
>(layer->bounds().height()); |
| 62 gfx::RectF updateContentRect = gfx::ScaleRect(layer->updateRect(), width
Scale, heightScale); | 62 gfx::RectF updateContentRect = gfx::ScaleRect(layer->update_rect(), widt
hScale, heightScale); |
| 63 m_debugRects.push_back(DebugRect(PaintRectType, MathUtil::mapClippedRect
(layer->screenSpaceTransform(), updateContentRect))); | 63 m_debugRects.push_back(DebugRect(PaintRectType, MathUtil::mapClippedRect
(layer->screen_space_transform(), updateContentRect))); |
| 64 } | 64 } |
| 65 | 65 |
| 66 for (unsigned i = 0; i < layer->children().size(); ++i) | 66 for (unsigned i = 0; i < layer->children().size(); ++i) |
| 67 savePaintRects(layer->children()[i]); | 67 savePaintRects(layer->children()[i]); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void DebugRectHistory::savePropertyChangedRects(const std::vector<LayerImpl*>& r
enderSurfaceLayerList) | 70 void DebugRectHistory::savePropertyChangedRects(const std::vector<LayerImpl*>& r
enderSurfaceLayerList) |
| 71 { | 71 { |
| 72 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0
; --surfaceIndex) { | 72 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0
; --surfaceIndex) { |
| 73 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; | 73 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; |
| 74 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface(); | 74 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->render_surface(); |
| 75 DCHECK(renderSurface); | 75 DCHECK(renderSurface); |
| 76 | 76 |
| 77 const std::vector<LayerImpl*>& layerList = renderSurface->layer_list(); | 77 const std::vector<LayerImpl*>& layerList = renderSurface->layer_list(); |
| 78 for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerInde
x) { | 78 for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerInde
x) { |
| 79 LayerImpl* layer = layerList[layerIndex]; | 79 LayerImpl* layer = layerList[layerIndex]; |
| 80 | 80 |
| 81 if (LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerImpl>
(layer, renderSurfaceLayer->id())) | 81 if (LayerTreeHostCommon::renderSurfaceContributesToTarget<LayerImpl>
(layer, renderSurfaceLayer->id())) |
| 82 continue; | 82 continue; |
| 83 | 83 |
| 84 if (layer->layerIsAlwaysDamaged()) | 84 if (layer->LayerIsAlwaysDamaged()) |
| 85 continue; | 85 continue; |
| 86 | 86 |
| 87 if (layer->layerPropertyChanged() || layer->layerSurfacePropertyChan
ged()) | 87 if (layer->LayerPropertyChanged() || layer->LayerSurfacePropertyChan
ged()) |
| 88 m_debugRects.push_back(DebugRect(PropertyChangedRectType, MathUt
il::mapClippedRect(layer->screenSpaceTransform(), gfx::RectF(gfx::PointF(), laye
r->contentBounds())))); | 88 m_debugRects.push_back(DebugRect(PropertyChangedRectType, MathUt
il::mapClippedRect(layer->screen_space_transform(), gfx::RectF(gfx::PointF(), la
yer->content_bounds())))); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 void DebugRectHistory::saveSurfaceDamageRects(const std::vector<LayerImpl* >& re
nderSurfaceLayerList) | 93 void DebugRectHistory::saveSurfaceDamageRects(const std::vector<LayerImpl* >& re
nderSurfaceLayerList) |
| 94 { | 94 { |
| 95 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0
; --surfaceIndex) { | 95 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0
; --surfaceIndex) { |
| 96 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; | 96 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; |
| 97 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface(); | 97 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->render_surface(); |
| 98 DCHECK(renderSurface); | 98 DCHECK(renderSurface); |
| 99 | 99 |
| 100 m_debugRects.push_back(DebugRect(SurfaceDamageRectType, MathUtil::mapCli
ppedRect(renderSurface->screen_space_transform(), renderSurface->damage_tracker(
)->current_damage_rect()))); | 100 m_debugRects.push_back(DebugRect(SurfaceDamageRectType, MathUtil::mapCli
ppedRect(renderSurface->screen_space_transform(), renderSurface->damage_tracker(
)->current_damage_rect()))); |
| 101 } | 101 } |
| 102 } | 102 } |
| 103 | 103 |
| 104 void DebugRectHistory::saveScreenSpaceRects(const std::vector<LayerImpl* >& rend
erSurfaceLayerList) | 104 void DebugRectHistory::saveScreenSpaceRects(const std::vector<LayerImpl* >& rend
erSurfaceLayerList) |
| 105 { | 105 { |
| 106 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0
; --surfaceIndex) { | 106 for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0
; --surfaceIndex) { |
| 107 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; | 107 LayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex]; |
| 108 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->renderSurface(); | 108 RenderSurfaceImpl* renderSurface = renderSurfaceLayer->render_surface(); |
| 109 DCHECK(renderSurface); | 109 DCHECK(renderSurface); |
| 110 | 110 |
| 111 m_debugRects.push_back(DebugRect(ScreenSpaceRectType, MathUtil::mapClipp
edRect(renderSurface->screen_space_transform(), renderSurface->content_rect())))
; | 111 m_debugRects.push_back(DebugRect(ScreenSpaceRectType, MathUtil::mapClipp
edRect(renderSurface->screen_space_transform(), renderSurface->content_rect())))
; |
| 112 | 112 |
| 113 if (renderSurfaceLayer->replicaLayer()) | 113 if (renderSurfaceLayer->replica_layer()) |
| 114 m_debugRects.push_back(DebugRect(ReplicaScreenSpaceRectType, MathUti
l::mapClippedRect(renderSurface->replica_screen_space_transform(), renderSurface
->content_rect()))); | 114 m_debugRects.push_back(DebugRect(ReplicaScreenSpaceRectType, MathUti
l::mapClippedRect(renderSurface->replica_screen_space_transform(), renderSurface
->content_rect()))); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 void DebugRectHistory::saveOccludingRects(const std::vector<gfx::Rect>& occludin
gRects) | 118 void DebugRectHistory::saveOccludingRects(const std::vector<gfx::Rect>& occludin
gRects) |
| 119 { | 119 { |
| 120 for (size_t i = 0; i < occludingRects.size(); ++i) | 120 for (size_t i = 0; i < occludingRects.size(); ++i) |
| 121 m_debugRects.push_back(DebugRect(OccludingRectType, occludingRects[i])); | 121 m_debugRects.push_back(DebugRect(OccludingRectType, occludingRects[i])); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void DebugRectHistory::saveNonOccludingRects(const std::vector<gfx::Rect>& nonOc
cludingRects) | 124 void DebugRectHistory::saveNonOccludingRects(const std::vector<gfx::Rect>& nonOc
cludingRects) |
| 125 { | 125 { |
| 126 for (size_t i = 0; i < nonOccludingRects.size(); ++i) | 126 for (size_t i = 0; i < nonOccludingRects.size(); ++i) |
| 127 m_debugRects.push_back(DebugRect(NonOccludingRectType, nonOccludingRects
[i])); | 127 m_debugRects.push_back(DebugRect(NonOccludingRectType, nonOccludingRects
[i])); |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace cc | 130 } // namespace cc |
| OLD | NEW |