Index: cc/layers/picture_layer_impl.cc |
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc |
index cb8141b66b83d56a7f334ef4cdbaea4717d172f2..87b54d416137b099839cdb284d1fdfe2ea025cbd 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" |
@@ -74,7 +75,9 @@ PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, int id) |
raster_source_scale_is_fixed_(false), |
was_screen_space_transform_animating_(false), |
needs_post_commit_initialization_(true), |
- should_update_tile_priorities_(false) { |
+ should_update_tile_priorities_(false), |
+ is_solid_color_(false), |
+ solid_color_(SK_ColorBLACK) { |
layer_tree_impl()->RegisterPictureLayerImpl(this); |
} |
@@ -95,6 +98,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 +119,10 @@ void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { |
layer_impl->pile_ = pile_; |
+ DCHECK(!IsSolidColor() || !tilings_->num_tilings()); |
+ layer_impl->is_solid_color_ = is_solid_color_; |
+ layer_impl->solid_color_ = solid_color_; |
+ |
// Tilings would be expensive to push, so we swap. |
layer_impl->tilings_.swap(tilings_); |
layer_impl->tilings_->SetClient(layer_impl); |
@@ -150,6 +158,25 @@ void PictureLayerImpl::AppendQuads( |
AppendQuadsData* append_quads_data) { |
DCHECK(!needs_post_commit_initialization_); |
+ SharedQuadState* shared_quad_state = |
+ render_pass->CreateAndAppendSharedQuadState(); |
danakj
2014/09/10 18:46:40
nit: whitespace below this to show it's not only u
hendrikw
2014/09/11 00:27:40
Acknowledged.
|
+ if (IsSolidColor()) { |
+ PopulateSharedQuadState(shared_quad_state); |
danakj
2014/09/10 18:46:40
can you add a PLI unittest that hits this code pat
hendrikw
2014/09/11 00:27:40
There are several tests which hit both code paths,
danakj
2014/09/11 23:43:50
A test designed to explictly hit both would be nic
|
+ |
+ 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, |
+ 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 +188,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, |
@@ -577,6 +602,7 @@ skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { |
scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, |
const gfx::Rect& content_rect) { |
+ DCHECK(!IsSolidColor()); |
if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) |
return scoped_refptr<Tile>(); |
@@ -1313,6 +1339,8 @@ void PictureLayerImpl::ResetRasterScale() { |
} |
bool PictureLayerImpl::CanHaveTilings() const { |
+ if (IsSolidColor()) |
+ return false; |
if (!DrawsContent()) |
return false; |
if (!pile_->HasRecordings()) |
@@ -1776,4 +1804,10 @@ size_t PictureLayerImpl::LayerEvictionTileIterator::CurrentTilingIndex() const { |
return 0; |
} |
+void PictureLayerImpl::SetSolidColorState(bool is_solid_color, |
+ SkColor solid_color) { |
+ is_solid_color_ = is_solid_color; |
+ solid_color_ = solid_color; |
+} |
+ |
} // namespace cc |