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

Unified Diff: cc/layers/picture_layer.cc

Issue 684653004: Plumb can_use_lcd_text, contents_opaque directly to ContentLayerClient. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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.cc
diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
index f608ba7ae92e6eb6863084ea963dc0c08f5b6956..f2910c0689e9db5a292b00b3e857ae7e3ee69867 100644
--- a/cc/layers/picture_layer.cc
+++ b/cc/layers/picture_layer.cc
@@ -21,7 +21,8 @@ PictureLayer::PictureLayer(ContentLayerClient* client)
: client_(client),
instrumentation_object_tracker_(id()),
update_source_frame_number_(-1),
- can_use_lcd_text_last_frame_(can_use_lcd_text()) {
+ can_use_lcd_text_last_frame_(false),
+ first_update_lcd_text_occured_(false) {
}
PictureLayer::~PictureLayer() {
@@ -124,6 +125,7 @@ bool PictureLayer::Update(ResourceUpdateQueue* queue,
SafeOpaqueBackgroundColor(),
contents_opaque(),
client_->FillsBoundsCompletely(),
+ can_use_lcd_text_last_frame_,
layer_size,
visible_layer_rect,
update_source_frame_number_,
@@ -151,12 +153,17 @@ bool PictureLayer::SupportsLCDText() const {
}
void PictureLayer::UpdateCanUseLCDText() {
- if (can_use_lcd_text_last_frame_ == can_use_lcd_text())
- return;
+ if (first_update_lcd_text_occured_) {
+ if (can_use_lcd_text_last_frame_ == can_use_lcd_text())
+ return;
+ // LCD text can turn off but never on.
+ if (!can_use_lcd_text_last_frame_)
+ return;
+ }
can_use_lcd_text_last_frame_ = can_use_lcd_text();
- if (client_)
- client_->DidChangeLayerCanUseLCDText();
+ first_update_lcd_text_occured_ = true;
+ SetNeedsDisplay();
}
skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
@@ -173,6 +180,8 @@ skia::RefPtr<SkPicture> PictureLayer::GetPicture() const {
SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0);
client_->PaintContents(canvas,
gfx::Rect(width, height),
+ can_use_lcd_text_last_frame_,
+ contents_opaque(),
ContentLayerClient::GRAPHICS_CONTEXT_ENABLED);
skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
return picture;

Powered by Google App Engine
This is Rietveld 408576698