| 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/layers/solid_color_layer_impl.h" | 5 #include "cc/layers/solid_color_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "cc/quads/solid_color_draw_quad.h" | 9 #include "cc/quads/solid_color_draw_quad.h" |
| 10 #include "cc/trees/occlusion_tracker.h" | 10 #include "cc/trees/occlusion_tracker.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 RenderPass* render_pass, | 26 RenderPass* render_pass, |
| 27 const OcclusionTracker<LayerImpl>& occlusion_tracker, | 27 const OcclusionTracker<LayerImpl>& occlusion_tracker, |
| 28 AppendQuadsData* append_quads_data) { | 28 AppendQuadsData* append_quads_data) { |
| 29 SharedQuadState* shared_quad_state = | 29 SharedQuadState* shared_quad_state = |
| 30 render_pass->CreateAndAppendSharedQuadState(); | 30 render_pass->CreateAndAppendSharedQuadState(); |
| 31 PopulateSharedQuadState(shared_quad_state); | 31 PopulateSharedQuadState(shared_quad_state); |
| 32 | 32 |
| 33 AppendDebugBorderQuad( | 33 AppendDebugBorderQuad( |
| 34 render_pass, content_bounds(), shared_quad_state, append_quads_data); | 34 render_pass, content_bounds(), shared_quad_state, append_quads_data); |
| 35 | 35 |
| 36 Occlusion occlusion = occlusion_tracker.GetCurrentOcclusionForLayer( |
| 37 draw_properties().target_space_transform); |
| 38 |
| 36 // We create a series of smaller quads instead of just one large one so that | 39 // We create a series of smaller quads instead of just one large one so that |
| 37 // the culler can reduce the total pixels drawn. | 40 // the culler can reduce the total pixels drawn. |
| 38 int width = content_bounds().width(); | 41 int width = content_bounds().width(); |
| 39 int height = content_bounds().height(); | 42 int height = content_bounds().height(); |
| 40 for (int x = 0; x < width; x += tile_size_) { | 43 for (int x = 0; x < width; x += tile_size_) { |
| 41 for (int y = 0; y < height; y += tile_size_) { | 44 for (int y = 0; y < height; y += tile_size_) { |
| 42 gfx::Rect quad_rect(x, | 45 gfx::Rect quad_rect(x, |
| 43 y, | 46 y, |
| 44 std::min(width - x, tile_size_), | 47 std::min(width - x, tile_size_), |
| 45 std::min(height - y, tile_size_)); | 48 std::min(height - y, tile_size_)); |
| 46 gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect( | 49 gfx::Rect visible_quad_rect = |
| 47 quad_rect, draw_properties().target_space_transform); | 50 occlusion.GetUnoccludedContentRect(quad_rect); |
| 48 if (visible_quad_rect.IsEmpty()) | 51 if (visible_quad_rect.IsEmpty()) |
| 49 continue; | 52 continue; |
| 50 | 53 |
| 51 SolidColorDrawQuad* quad = | 54 SolidColorDrawQuad* quad = |
| 52 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 55 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 53 quad->SetNew(shared_quad_state, | 56 quad->SetNew(shared_quad_state, |
| 54 quad_rect, | 57 quad_rect, |
| 55 visible_quad_rect, | 58 visible_quad_rect, |
| 56 background_color(), | 59 background_color(), |
| 57 false); | 60 false); |
| 58 } | 61 } |
| 59 } | 62 } |
| 60 } | 63 } |
| 61 | 64 |
| 62 const char* SolidColorLayerImpl::LayerTypeAsString() const { | 65 const char* SolidColorLayerImpl::LayerTypeAsString() const { |
| 63 return "cc::SolidColorLayerImpl"; | 66 return "cc::SolidColorLayerImpl"; |
| 64 } | 67 } |
| 65 | 68 |
| 66 } // namespace cc | 69 } // namespace cc |
| OLD | NEW |