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

Unified Diff: cc/layers/content_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
« no previous file with comments | « cc/layers/content_layer.h ('k') | cc/layers/content_layer_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/content_layer.cc
diff --git a/cc/layers/content_layer.cc b/cc/layers/content_layer.cc
index d3e9a2873a8f77e482e9ab645d5d326ad175e1e5..b0c8bf41bcfd4ebd48808f5b2e28104ffec118eb 100644
--- a/cc/layers/content_layer.cc
+++ b/cc/layers/content_layer.cc
@@ -25,9 +25,13 @@ scoped_ptr<ContentLayerPainter> ContentLayerPainter::Create(
}
void ContentLayerPainter::Paint(SkCanvas* canvas,
- const gfx::Rect& content_rect) {
+ const gfx::Rect& content_rect,
+ bool can_use_lcd_text,
+ bool contents_opaque) {
client_->PaintContents(canvas,
content_rect,
+ can_use_lcd_text,
+ contents_opaque,
ContentLayerClient::GRAPHICS_CONTEXT_ENABLED);
}
@@ -38,7 +42,8 @@ scoped_refptr<ContentLayer> ContentLayer::Create(ContentLayerClient* client) {
ContentLayer::ContentLayer(ContentLayerClient* client)
: TiledLayer(),
client_(client),
- can_use_lcd_text_last_frame_(can_use_lcd_text()) {
+ can_use_lcd_text_last_frame_(false),
+ first_update_lcd_text_occured_(false) {
}
ContentLayer::~ContentLayer() {}
@@ -127,12 +132,18 @@ void ContentLayer::SetContentsOpaque(bool opaque) {
}
void ContentLayer::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();
enne (OOO) 2014/11/12 18:51:05 I don't think this can go. The reason this was im
danakj 2014/11/12 18:52:48 Ah okay, makes sense now that I saw the ui::Layer
+ updater_->SetCanUseLCDText(can_use_lcd_text_last_frame_);
+ first_update_lcd_text_occured_ = true;
+ SetNeedsDisplay();
}
bool ContentLayer::SupportsLCDText() const {
@@ -150,6 +161,8 @@ skia::RefPtr<SkPicture> ContentLayer::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;
« no previous file with comments | « cc/layers/content_layer.h ('k') | cc/layers/content_layer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698