Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1813)

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 519583003: Use the solid color detection to create solid layers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Passed the right color to the quad Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/layers/picture_layer_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 43348fa5000e31ca26b34a48665d1d26598b47c6..80b9d29c833cb963806c947c51256e6edf4c9ae5 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -75,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);
}
@@ -96,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
@@ -117,6 +120,10 @@ void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) {
layer_impl->SetIsMask(is_mask_);
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_);
@@ -151,6 +158,12 @@ void PictureLayerImpl::AppendQuads(
RenderPass* render_pass,
const OcclusionTracker<LayerImpl>& occlusion_tracker,
AppendQuadsData* append_quads_data) {
+ if (IsSolidColor()) {
+ AppendSolidQuads(
+ render_pass, occlusion_tracker, append_quads_data, solid_color_);
+ return;
+ }
+
DCHECK(!needs_post_commit_initialization_);
float max_contents_scale = MaximumTilingContentsScale();
@@ -584,6 +597,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>();
@@ -1317,6 +1331,8 @@ void PictureLayerImpl::ResetRasterScale() {
}
bool PictureLayerImpl::CanHaveTilings() const {
+ if (IsSolidColor())
+ return false;
if (!DrawsContent())
return false;
if (!pile_->HasRecordings())
@@ -1780,4 +1796,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

Powered by Google App Engine
This is Rietveld 408576698