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

Unified Diff: cc/layers/picture_layer.cc

Issue 684543006: cc: Toggle LCD text at raster time instead of record time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lcdraster: . Created 6 years, 1 month 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.cc
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index dbfa63c76cbbb84bbf0c344bfd49e85ad38dfcee..630832fbe9872250a6f77a119a957e7617a803eb 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -23,7 +23,7 @@ PictureLayer::PictureLayer(ContentLayerClient* client)
recording_source_(new PicturePile),
instrumentation_object_tracker_(id()),
update_source_frame_number_(-1),
- can_use_lcd_text_last_frame_(can_use_lcd_text()) {
+ can_use_lcd_text_for_update_(true) {
}
PictureLayer::PictureLayer(ContentLayerClient* client,
@@ -95,18 +95,14 @@ bool PictureLayer::Update(ResourceUpdateQueue* queue,
update_source_frame_number_ = layer_tree_host()->source_frame_number();
bool updated = Layer::Update(queue, occlusion);
- {
- base::AutoReset<bool> ignore_set_needs_commit(&ignore_set_needs_commit_,
- true);
- UpdateCanUseLCDText();
- }
+ 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;
@@ -136,9 +132,9 @@ bool PictureLayer::Update(ResourceUpdateQueue* queue,
DCHECK(client_);
updated |= recording_source_->UpdateAndExpandInvalidation(
client_, &recording_invalidation_, SafeOpaqueBackgroundColor(),
- contents_opaque(), client_->FillsBoundsCompletely(), layer_size,
- visible_layer_rect, update_source_frame_number_,
- Picture::RECORD_NORMALLY);
+ contents_opaque(), client_->FillsBoundsCompletely(),
+ can_use_lcd_text_for_update_, layer_size, visible_layer_rect,
+ update_source_frame_number_, Picture::RECORD_NORMALLY);
last_updated_visible_content_rect_ = visible_content_rect();
if (updated) {
@@ -160,13 +156,14 @@ bool PictureLayer::SupportsLCDText() const {
return true;
}
-void PictureLayer::UpdateCanUseLCDText() {
- if (can_use_lcd_text_last_frame_ == can_use_lcd_text())
- return;
+bool PictureLayer::UpdateCanUseLCDText() {
+ if (!can_use_lcd_text_for_update_)
+ return false; // Don't allow the LcdTextState to change once disabled.
+ if (can_use_lcd_text_for_update_ == can_use_lcd_text())
+ return false;
- can_use_lcd_text_last_frame_ = can_use_lcd_text();
- if (client_)
- client_->DidChangeLayerCanUseLCDText();
+ can_use_lcd_text_for_update_ = can_use_lcd_text();
+ return true;
}
skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {

Powered by Google App Engine
This is Rietveld 408576698