| 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/layers/append_quads_data.h" | 9 #include "cc/layers/append_quads_data.h" |
| 10 #include "cc/quads/solid_color_draw_quad.h" | 10 #include "cc/quads/solid_color_draw_quad.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 SolidColorLayerImpl::~SolidColorLayerImpl() {} | 23 SolidColorLayerImpl::~SolidColorLayerImpl() {} |
| 24 | 24 |
| 25 scoped_ptr<LayerImpl> SolidColorLayerImpl::CreateLayerImpl( | 25 scoped_ptr<LayerImpl> SolidColorLayerImpl::CreateLayerImpl( |
| 26 LayerTreeImpl* tree_impl) { | 26 LayerTreeImpl* tree_impl) { |
| 27 return SolidColorLayerImpl::Create(tree_impl, id()); | 27 return SolidColorLayerImpl::Create(tree_impl, id()); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void SolidColorLayerImpl::AppendSolidQuads( | 30 void SolidColorLayerImpl::AppendSolidQuads( |
| 31 RenderPass* render_pass, | 31 RenderPass* render_pass, |
| 32 const Occlusion& occlusion_in_content_space, | 32 const Occlusion& occlusion_in_layer_space, |
| 33 SharedQuadState* shared_quad_state, | 33 SharedQuadState* shared_quad_state, |
| 34 const gfx::Rect& visible_content_rect, | 34 const gfx::Rect& visible_layer_rect, |
| 35 SkColor color, | 35 SkColor color, |
| 36 AppendQuadsData* append_quads_data) { | 36 AppendQuadsData* append_quads_data) { |
| 37 // We create a series of smaller quads instead of just one large one so that | 37 // We create a series of smaller quads instead of just one large one so that |
| 38 // the culler can reduce the total pixels drawn. | 38 // the culler can reduce the total pixels drawn. |
| 39 int right = visible_content_rect.right(); | 39 int right = visible_layer_rect.right(); |
| 40 int bottom = visible_content_rect.bottom(); | 40 int bottom = visible_layer_rect.bottom(); |
| 41 for (int x = visible_content_rect.x(); x < visible_content_rect.right(); | 41 for (int x = visible_layer_rect.x(); x < visible_layer_rect.right(); |
| 42 x += kSolidQuadTileSize) { | 42 x += kSolidQuadTileSize) { |
| 43 for (int y = visible_content_rect.y(); y < visible_content_rect.bottom(); | 43 for (int y = visible_layer_rect.y(); y < visible_layer_rect.bottom(); |
| 44 y += kSolidQuadTileSize) { | 44 y += kSolidQuadTileSize) { |
| 45 gfx::Rect quad_rect(x, | 45 gfx::Rect quad_rect(x, |
| 46 y, | 46 y, |
| 47 std::min(right - x, kSolidQuadTileSize), | 47 std::min(right - x, kSolidQuadTileSize), |
| 48 std::min(bottom - y, kSolidQuadTileSize)); | 48 std::min(bottom - y, kSolidQuadTileSize)); |
| 49 gfx::Rect visible_quad_rect = | 49 gfx::Rect visible_quad_rect = |
| 50 occlusion_in_content_space.GetUnoccludedContentRect(quad_rect); | 50 occlusion_in_layer_space.GetUnoccludedContentRect(quad_rect); |
| 51 if (visible_quad_rect.IsEmpty()) | 51 if (visible_quad_rect.IsEmpty()) |
| 52 continue; | 52 continue; |
| 53 | 53 |
| 54 append_quads_data->visible_content_area += | 54 append_quads_data->visible_layer_area += |
| 55 visible_quad_rect.width() * visible_quad_rect.height(); | 55 visible_quad_rect.width() * visible_quad_rect.height(); |
| 56 | 56 |
| 57 SolidColorDrawQuad* quad = | 57 SolidColorDrawQuad* quad = |
| 58 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 58 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 59 quad->SetNew( | 59 quad->SetNew( |
| 60 shared_quad_state, quad_rect, visible_quad_rect, color, false); | 60 shared_quad_state, quad_rect, visible_quad_rect, color, false); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 77 AppendSolidQuads(render_pass, draw_properties().occlusion_in_content_space, | 77 AppendSolidQuads(render_pass, draw_properties().occlusion_in_content_space, |
| 78 shared_quad_state, gfx::Rect(bounds()), background_color(), | 78 shared_quad_state, gfx::Rect(bounds()), background_color(), |
| 79 append_quads_data); | 79 append_quads_data); |
| 80 } | 80 } |
| 81 | 81 |
| 82 const char* SolidColorLayerImpl::LayerTypeAsString() const { | 82 const char* SolidColorLayerImpl::LayerTypeAsString() const { |
| 83 return "cc::SolidColorLayerImpl"; | 83 return "cc::SolidColorLayerImpl"; |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace cc | 86 } // namespace cc |
| OLD | NEW |