| Index: cc/layers/solid_color_layer_impl.cc
|
| diff --git a/cc/layers/solid_color_layer_impl.cc b/cc/layers/solid_color_layer_impl.cc
|
| index a88c53e8e58aa9279065fb5b22cc9c5f1494f31f..87ff835cfc4a58428e6c5cc446f50f044b106deb 100644
|
| --- a/cc/layers/solid_color_layer_impl.cc
|
| +++ b/cc/layers/solid_color_layer_impl.cc
|
| @@ -11,6 +11,10 @@
|
|
|
| namespace cc {
|
|
|
| +namespace {
|
| +const int kSolidQuadTileSize = 256;
|
| +}
|
| +
|
| SolidColorLayerImpl::SolidColorLayerImpl(LayerTreeImpl* tree_impl, int id)
|
| : LayerImpl(tree_impl, id),
|
| tile_size_(256) {}
|
| @@ -22,43 +26,57 @@ scoped_ptr<LayerImpl> SolidColorLayerImpl::CreateLayerImpl(
|
| return SolidColorLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>();
|
| }
|
|
|
| -void SolidColorLayerImpl::AppendQuads(
|
| +void SolidColorLayerImpl::AppendSolidQuads(
|
| RenderPass* render_pass,
|
| const OcclusionTracker<LayerImpl>& occlusion_tracker,
|
| - AppendQuadsData* append_quads_data) {
|
| - SharedQuadState* shared_quad_state =
|
| - render_pass->CreateAndAppendSharedQuadState();
|
| - PopulateSharedQuadState(shared_quad_state);
|
| -
|
| - AppendDebugBorderQuad(
|
| - render_pass, content_bounds(), shared_quad_state, append_quads_data);
|
| -
|
| + AppendQuadsData* append_quads_data,
|
| + SharedQuadState* shared_quad_state,
|
| + const gfx::Size& content_bounds,
|
| + const gfx::Transform& target_space_transform,
|
| + SkColor color) {
|
| // We create a series of smaller quads instead of just one large one so that
|
| // the culler can reduce the total pixels drawn.
|
| - int width = content_bounds().width();
|
| - int height = content_bounds().height();
|
| - for (int x = 0; x < width; x += tile_size_) {
|
| - for (int y = 0; y < height; y += tile_size_) {
|
| + int width = content_bounds.width();
|
| + int height = content_bounds.height();
|
| + for (int x = 0; x < width; x += kSolidQuadTileSize) {
|
| + for (int y = 0; y < height; y += kSolidQuadTileSize) {
|
| gfx::Rect quad_rect(x,
|
| y,
|
| - std::min(width - x, tile_size_),
|
| - std::min(height - y, tile_size_));
|
| + std::min(width - x, kSolidQuadTileSize),
|
| + std::min(height - y, kSolidQuadTileSize));
|
| gfx::Rect visible_quad_rect = occlusion_tracker.UnoccludedContentRect(
|
| - quad_rect, draw_properties().target_space_transform);
|
| + quad_rect, target_space_transform);
|
| if (visible_quad_rect.IsEmpty())
|
| continue;
|
|
|
| SolidColorDrawQuad* quad =
|
| render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>();
|
| - quad->SetNew(shared_quad_state,
|
| - quad_rect,
|
| - visible_quad_rect,
|
| - background_color(),
|
| - false);
|
| + quad->SetNew(
|
| + shared_quad_state, quad_rect, visible_quad_rect, color, false);
|
| }
|
| }
|
| }
|
|
|
| +void SolidColorLayerImpl::AppendQuads(
|
| + RenderPass* render_pass,
|
| + const OcclusionTracker<LayerImpl>& occlusion_tracker,
|
| + AppendQuadsData* append_quads_data) {
|
| + SharedQuadState* shared_quad_state =
|
| + render_pass->CreateAndAppendSharedQuadState();
|
| + PopulateSharedQuadState(shared_quad_state);
|
| +
|
| + AppendDebugBorderQuad(
|
| + render_pass, content_bounds(), shared_quad_state, append_quads_data);
|
| +
|
| + AppendSolidQuads(render_pass,
|
| + occlusion_tracker,
|
| + append_quads_data,
|
| + shared_quad_state,
|
| + content_bounds(),
|
| + draw_properties().target_space_transform,
|
| + background_color());
|
| +}
|
| +
|
| const char* SolidColorLayerImpl::LayerTypeAsString() const {
|
| return "cc::SolidColorLayerImpl";
|
| }
|
|
|