| 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/trees/quad_culler.h" | 5 #include "cc/trees/quad_culler.h" |
| 6 | 6 |
| 7 #include "cc/debug/debug_colors.h" | 7 #include "cc/debug/debug_colors.h" |
| 8 #include "cc/debug/overdraw_metrics.h" | |
| 9 #include "cc/layers/append_quads_data.h" | 8 #include "cc/layers/append_quads_data.h" |
| 10 #include "cc/layers/layer_impl.h" | 9 #include "cc/layers/layer_impl.h" |
| 11 #include "cc/quads/debug_border_draw_quad.h" | 10 #include "cc/quads/debug_border_draw_quad.h" |
| 12 #include "cc/quads/render_pass.h" | 11 #include "cc/quads/render_pass.h" |
| 13 #include "cc/trees/occlusion_tracker.h" | 12 #include "cc/trees/occlusion_tracker.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 13 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "ui/gfx/transform.h" | 14 #include "ui/gfx/transform.h" |
| 16 | 15 |
| 17 namespace cc { | 16 namespace cc { |
| 18 | 17 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 44 scoped_ptr<DrawQuad> draw_quad, | 43 scoped_ptr<DrawQuad> draw_quad, |
| 45 const gfx::Rect& culled_rect, | 44 const gfx::Rect& culled_rect, |
| 46 QuadList* quad_list, | 45 QuadList* quad_list, |
| 47 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 46 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| 48 const LayerImpl* layer, | 47 const LayerImpl* layer, |
| 49 bool create_debug_border_quads) { | 48 bool create_debug_border_quads) { |
| 50 bool keep_quad = !culled_rect.IsEmpty(); | 49 bool keep_quad = !culled_rect.IsEmpty(); |
| 51 if (keep_quad) | 50 if (keep_quad) |
| 52 draw_quad->visible_rect = culled_rect; | 51 draw_quad->visible_rect = culled_rect; |
| 53 | 52 |
| 54 occlusion_tracker.overdraw_metrics()->DidCullForDrawing( | |
| 55 draw_quad->quadTransform(), draw_quad->rect, culled_rect); | |
| 56 gfx::Rect opaque_draw_rect = | |
| 57 draw_quad->opacity() == 1.0f ? draw_quad->opaque_rect : gfx::Rect(); | |
| 58 occlusion_tracker.overdraw_metrics()-> | |
| 59 DidDraw(draw_quad->quadTransform(), culled_rect, opaque_draw_rect); | |
| 60 | |
| 61 if (keep_quad) { | 53 if (keep_quad) { |
| 62 if (create_debug_border_quads && !draw_quad->IsDebugQuad() && | 54 if (create_debug_border_quads && !draw_quad->IsDebugQuad() && |
| 63 draw_quad->visible_rect != draw_quad->rect) { | 55 draw_quad->visible_rect != draw_quad->rect) { |
| 64 SkColor color = DebugColors::CulledTileBorderColor(); | 56 SkColor color = DebugColors::CulledTileBorderColor(); |
| 65 float width = DebugColors::CulledTileBorderWidth( | 57 float width = DebugColors::CulledTileBorderWidth( |
| 66 layer ? layer->layer_tree_impl() : NULL); | 58 layer ? layer->layer_tree_impl() : NULL); |
| 67 scoped_ptr<DebugBorderDrawQuad> debug_border_quad = | 59 scoped_ptr<DebugBorderDrawQuad> debug_border_quad = |
| 68 DebugBorderDrawQuad::Create(); | 60 DebugBorderDrawQuad::Create(); |
| 69 debug_border_quad->SetNew(draw_quad->shared_quad_state, | 61 debug_border_quad->SetNew(draw_quad->shared_quad_state, |
| 70 draw_quad->visible_rect, | 62 draw_quad->visible_rect, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 99 | 91 |
| 100 return AppendQuadInternal(draw_quad.Pass(), | 92 return AppendQuadInternal(draw_quad.Pass(), |
| 101 culled_rect, | 93 culled_rect, |
| 102 quad_list_, | 94 quad_list_, |
| 103 occlusion_tracker_, | 95 occlusion_tracker_, |
| 104 layer_, | 96 layer_, |
| 105 show_culling_with_debug_border_quads_); | 97 show_culling_with_debug_border_quads_); |
| 106 } | 98 } |
| 107 | 99 |
| 108 } // namespace cc | 100 } // namespace cc |
| OLD | NEW |