| Index: cc/layers/picture_layer.cc
|
| diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
|
| index e7918e220625cf3f7b90aa246deee79164b0b5cf..0ca2ae77005b32bb5d98de58a0ae9a4ba6612bc9 100644
|
| --- a/cc/layers/picture_layer.cc
|
| +++ b/cc/layers/picture_layer.cc
|
| @@ -23,6 +23,7 @@ PictureLayer::PictureLayer(ContentLayerClient* client)
|
| : client_(client),
|
| instrumentation_object_tracker_(id()),
|
| update_source_frame_number_(-1),
|
| + can_use_lcd_text_for_update_(true),
|
| is_mask_(false),
|
| nearest_neighbor_(false) {
|
| }
|
| @@ -68,10 +69,8 @@ void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
|
|
|
| layer_impl->SetNearestNeighbor(nearest_neighbor_);
|
|
|
| - // Preserve lcd text settings from the current raster source.
|
| - bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText();
|
| scoped_refptr<RasterSource> raster_source =
|
| - recording_source_->CreateRasterSource(can_use_lcd_text);
|
| + recording_source_->CreateRasterSource();
|
| layer_impl->UpdateRasterSource(raster_source, &recording_invalidation_,
|
| nullptr);
|
| DCHECK(recording_invalidation_.IsEmpty());
|
| @@ -108,12 +107,14 @@ bool PictureLayer::Update(ResourceUpdateQueue* queue,
|
| update_source_frame_number_ = layer_tree_host()->source_frame_number();
|
| bool updated = Layer::Update(queue, occlusion);
|
|
|
| + bool can_use_lcd_text_changed = UpdateCanUseLCDText();
|
| +
|
| gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect(
|
| visible_content_rect(), 1.f / contents_scale_x());
|
| gfx::Size layer_size = paint_properties().bounds;
|
|
|
| if (last_updated_visible_content_rect_ == visible_content_rect() &&
|
| - recording_source_->GetSize() == layer_size &&
|
| + recording_source_->GetSize() == layer_size && !can_use_lcd_text_changed &&
|
| pending_invalidation_.IsEmpty()) {
|
| // Only early out if the visible content rect of this layer hasn't changed.
|
| return updated;
|
| @@ -146,8 +147,9 @@ bool PictureLayer::Update(ResourceUpdateQueue* queue,
|
| // for them.
|
| DCHECK(client_);
|
| updated |= recording_source_->UpdateAndExpandInvalidation(
|
| - client_, &recording_invalidation_, layer_size, visible_layer_rect,
|
| - update_source_frame_number_, RecordingSource::RECORD_NORMALLY);
|
| + client_, &recording_invalidation_, can_use_lcd_text_for_update_,
|
| + layer_size, visible_layer_rect, update_source_frame_number_,
|
| + RecordingSource::RECORD_NORMALLY);
|
| last_updated_visible_content_rect_ = visible_content_rect();
|
|
|
| if (updated) {
|
| @@ -165,6 +167,20 @@ void PictureLayer::SetIsMask(bool is_mask) {
|
| is_mask_ = is_mask;
|
| }
|
|
|
| +bool PictureLayer::SupportsLCDText() const {
|
| + return true;
|
| +}
|
| +
|
| +bool PictureLayer::UpdateCanUseLCDText() {
|
| + if (!can_use_lcd_text_for_update_)
|
| + return false; // Don't allow the LCD text state to change once disabled.
|
| + if (can_use_lcd_text_for_update_ == can_use_lcd_text())
|
| + return false;
|
| +
|
| + can_use_lcd_text_for_update_ = can_use_lcd_text();
|
| + return true;
|
| +}
|
| +
|
| skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
|
| // We could either flatten the RecordingSource into a single SkPicture,
|
| // or paint a fresh one depending on what we intend to do with the
|
|
|