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..7ceaefb418156812ef8ec579cef20eef0c9b8fd7 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,12 +117,18 @@ 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_); |
+ |
layer_impl->tilings_->SetClient(layer_impl); |
if (tilings_) |
tilings_->SetClient(this); |
+ // Ensure that the recycle tree doesn't have any unshared tiles. |
+ if (tilings_ && pile_->is_solid_color()) |
+ tilings_->RemoveAllTilings(); |
+ |
// Remove invalidated tiles from what will become a recycle tree. |
if (tilings_) |
tilings_->RemoveTilesInRegion(invalidation_); |
@@ -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>(); |
@@ -1295,6 +1324,8 @@ void PictureLayerImpl::ResetRasterScale() { |
} |
bool PictureLayerImpl::CanHaveTilings() const { |
+ if (pile_->is_solid_color()) |
+ return false; |
if (!DrawsContent()) |
return false; |
if (!pile_->HasRecordings()) |