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

Unified Diff: cc/layers/picture_layer.cc

Issue 1812733003: Store recording invalidations in DisplayListRecordingSource, save them via Update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/picture_layer.cc
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index 9d7ec691fc13215e40e06b5e2c21a13abf365a92..af5cfb4585db168393a9471f6f97cbcd52e284c4 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -59,9 +59,9 @@ void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
recording_source_->CreateRasterSource(can_use_lcd_text);
layer_impl->set_gpu_raster_max_texture_size(
layer_tree_host()->device_viewport_size());
- layer_impl->UpdateRasterSource(raster_source, invalidation_.region(),
+ layer_impl->UpdateRasterSource(raster_source, &last_updated_invalidation_,
nullptr);
- DCHECK(invalidation_.IsEmpty());
+ DCHECK(last_updated_invalidation_.IsEmpty());
}
void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
@@ -82,10 +82,8 @@ void PictureLayer::SetLayerTreeHost(LayerTreeHost* host) {
void PictureLayer::SetNeedsDisplayRect(const gfx::Rect& layer_rect) {
DCHECK(!layer_tree_host() || !layer_tree_host()->in_paint_layer_contents());
- if (!layer_rect.IsEmpty()) {
- // Clamp invalidation to the layer bounds.
- invalidation_.Union(gfx::IntersectRects(layer_rect, gfx::Rect(bounds())));
- }
+ if (recording_source_)
+ recording_source_->SetNeedsDisplayRect(layer_rect);
Layer::SetNeedsDisplayRect(layer_rect);
}
@@ -96,12 +94,6 @@ bool PictureLayer::Update() {
gfx::Rect update_rect = visible_layer_rect();
gfx::Size layer_size = paint_properties().bounds;
- if (last_updated_visible_layer_rect_ == update_rect &&
- recording_source_->GetSize() == layer_size && invalidation_.IsEmpty()) {
- // Only early out if the visible content rect of this layer hasn't changed.
- return updated;
- }
-
recording_source_->SetBackgroundColor(SafeOpaqueBackgroundColor());
recording_source_->SetRequiresClear(!contents_opaque() &&
!client_->FillsBoundsCompletely());
@@ -118,7 +110,7 @@ bool PictureLayer::Update() {
// for them.
DCHECK(client_);
updated |= recording_source_->UpdateAndExpandInvalidation(
- client_, invalidation_.region(), layer_size, update_rect,
+ client_, &last_updated_invalidation_, layer_size, update_rect,
update_source_frame_number_, DisplayListRecordingSource::RECORD_NORMALLY);
last_updated_visible_layer_rect_ = visible_layer_rect();
@@ -127,7 +119,7 @@ bool PictureLayer::Update() {
} else {
// If this invalidation did not affect the recording source, then it can be
// cleared as an optimization.
- invalidation_.Clear();
+ last_updated_invalidation_.Clear();
}
return updated;
@@ -192,7 +184,7 @@ void PictureLayer::LayerSpecificPropertiesToProto(
recording_source_->ToProtobuf(
picture->mutable_recording_source(),
layer_tree_host()->image_serialization_processor());
- RegionToProto(*invalidation_.region(), picture->mutable_invalidation());
+ RegionToProto(last_updated_invalidation_, picture->mutable_invalidation());
RectToProto(last_updated_visible_layer_rect_,
picture->mutable_last_updated_visible_layer_rect());
picture->set_is_mask(is_mask_);
@@ -200,7 +192,7 @@ void PictureLayer::LayerSpecificPropertiesToProto(
picture->set_update_source_frame_number(update_source_frame_number_);
- invalidation_.Clear();
+ last_updated_invalidation_.Clear();
}
void PictureLayer::FromLayerSpecificPropertiesProto(
@@ -218,7 +210,7 @@ void PictureLayer::FromLayerSpecificPropertiesProto(
layer_tree_host()->image_serialization_processor());
Region new_invalidation = RegionFromProto(picture.invalidation());
- invalidation_.Swap(&new_invalidation);
+ last_updated_invalidation_.Swap(&new_invalidation);
last_updated_visible_layer_rect_ =
ProtoToRect(picture.last_updated_visible_layer_rect());
is_mask_ = picture.is_mask();
« no previous file with comments | « cc/layers/picture_layer.h ('k') | cc/layers/picture_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698