Chromium Code Reviews| Index: cc/layers/picture_layer_impl.cc |
| diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc |
| index 0fa9f6e136868154770646224dc77cfce3149861..dedf67a0fc4e0fa3dfc9990b1b52fce22fa43844 100644 |
| --- a/cc/layers/picture_layer_impl.cc |
| +++ b/cc/layers/picture_layer_impl.cc |
| @@ -16,6 +16,7 @@ |
| #include "cc/debug/micro_benchmark_impl.h" |
| #include "cc/debug/traced_value.h" |
| #include "cc/layers/append_quads_data.h" |
| +#include "cc/layers/solid_color_layer_impl.h" |
| #include "cc/output/begin_frame_args.h" |
| #include "cc/quads/checkerboard_draw_quad.h" |
| #include "cc/quads/debug_border_draw_quad.h" |
| @@ -95,6 +96,7 @@ void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { |
| // It's possible this layer was never drawn or updated (e.g. because it was |
| // a descendant of an opacity 0 layer). |
| DoPostCommitInitializationIfNeeded(); |
| + |
| PictureLayerImpl* layer_impl = static_cast<PictureLayerImpl*>(base_layer); |
| // We have already synced the important bits from the the active layer, and |
| @@ -115,8 +117,14 @@ void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { |
| layer_impl->pile_ = pile_; |
| + DCHECK(!pile_->is_solid_color() || !tilings_->num_tilings()); |
| // Tilings would be expensive to push, so we swap. |
| layer_impl->tilings_.swap(tilings_); |
| + |
| + // Ensure that the recycle tree doesn't have any unshared tiles. |
| + if (tilings_ && pile_->is_solid_color()) |
| + tilings_->RemoveAllTilings(); |
|
danakj
2014/09/19 20:44:28
can you do this down by RemoveTilesInRegion (ie af
hendrikw
2014/09/19 22:27:13
The only reason we're removing the tiles is becaus
danakj
2014/09/19 22:46:38
Ya, it's the same with RemoveTilesInRegion, but th
|
| + |
| layer_impl->tilings_->SetClient(layer_impl); |
| if (tilings_) |
| tilings_->SetClient(this); |
| @@ -150,6 +158,26 @@ void PictureLayerImpl::AppendQuads( |
| AppendQuadsData* append_quads_data) { |
| DCHECK(!needs_post_commit_initialization_); |
| + SharedQuadState* shared_quad_state = |
| + render_pass->CreateAndAppendSharedQuadState(); |
| + |
| + if (pile_->is_solid_color()) { |
| + PopulateSharedQuadState(shared_quad_state); |
| + |
| + AppendDebugBorderQuad( |
| + render_pass, content_bounds(), shared_quad_state, append_quads_data); |
| + |
| + SolidColorLayerImpl::AppendSolidQuads( |
| + render_pass, |
| + occlusion_tracker, |
| + append_quads_data, |
| + shared_quad_state, |
| + content_bounds(), |
| + draw_properties().target_space_transform, |
| + pile_->solid_color()); |
| + return; |
| + } |
| + |
| float max_contents_scale = MaximumTilingContentsScale(); |
| gfx::Transform scaled_draw_transform = draw_transform(); |
| scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale, |
| @@ -161,8 +189,6 @@ void PictureLayerImpl::AppendQuads( |
| gfx::ScaleToEnclosingRect(visible_content_rect(), max_contents_scale); |
| scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds)); |
| - SharedQuadState* shared_quad_state = |
| - render_pass->CreateAndAppendSharedQuadState(); |
| shared_quad_state->SetAll(scaled_draw_transform, |
| scaled_content_bounds, |
| scaled_visible_content_rect, |
| @@ -469,6 +495,8 @@ void PictureLayerImpl::UpdateTiles( |
| void PictureLayerImpl::UpdateTilePriorities( |
| const Occlusion& occlusion_in_content_space) { |
| + DCHECK(!pile_->is_solid_color() || !tilings_->num_tilings()); |
| + |
| TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); |
| double current_frame_time_in_seconds = |
| @@ -570,6 +598,7 @@ skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
| scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, |
| const gfx::Rect& content_rect) { |
| + DCHECK(!pile_->is_solid_color()); |
| if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) |
| return scoped_refptr<Tile>(); |
| @@ -735,6 +764,8 @@ void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { |
| void PictureLayerImpl::SyncTiling( |
| const PictureLayerTiling* tiling) { |
| + DCHECK(!pile_->is_solid_color() || !tilings_->num_tilings()); |
|
danakj
2014/09/19 20:44:28
this seems like a funny place to dcheck this..
ma
hendrikw
2014/09/19 22:27:13
I added this on request, now I'm removing it on re
danakj
2014/09/19 22:46:38
Darn I tried to find a review request to add it so
|
| + |
| if (!CanHaveTilingWithScale(tiling->contents_scale())) |
| return; |
| tilings_->AddTiling(tiling->contents_scale()); |
| @@ -1295,6 +1326,8 @@ void PictureLayerImpl::ResetRasterScale() { |
| } |
| bool PictureLayerImpl::CanHaveTilings() const { |
| + if (pile_->is_solid_color()) |
| + return false; |
| if (!DrawsContent()) |
| return false; |
| if (!pile_->HasRecordings()) |