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..092106adb1f62c4d5bf305bdbea630be7c197d2b 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,6 +117,8 @@ void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { |
layer_impl->pile_ = pile_; |
+ DCHECK(!pile_->is_solid_color() || !tilings_->num_tilings()); |
vmpstr
2014/09/15 15:45:07
I like this dcheck, and I think you should put it
hendrikw
2014/09/15 16:59:40
This is the only place in the code that the state
|
+ |
// Tilings would be expensive to push, so we swap. |
layer_impl->tilings_.swap(tilings_); |
vmpstr
2014/09/15 15:45:07
In the case where a non-solid layer becomes solid,
danakj
2014/09/15 16:26:35
Please add a test for that also.
hendrikw
2014/09/15 16:59:40
We had discussed this a couple of weeks ago, you s
vmpstr
2014/09/15 18:30:38
Yeah, in retrospect, this is important to do right
|
layer_impl->tilings_->SetClient(layer_impl); |
@@ -150,6 +154,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, |
vmpstr
2014/09/15 15:45:07
Here we pass a target_space_transform, but below w
danakj
2014/09/15 16:26:35
This is cool. The transform is consistent with the
|
+ pile_->get_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 +185,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, |
@@ -570,6 +592,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 +1318,8 @@ void PictureLayerImpl::ResetRasterScale() { |
} |
bool PictureLayerImpl::CanHaveTilings() const { |
+ if (pile_->is_solid_color()) |
+ return false; |
if (!DrawsContent()) |
return false; |
if (!pile_->HasRecordings()) |