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

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 913203006: cc: Calculate "can use lcd text" on the compositor thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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_impl.cc
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index f62a8664ff89f7e84467dc68813ae18ee56b99c0..5a90f057dace76ecedc44bc4be43100d02428883 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -565,6 +565,31 @@ void PictureLayerImpl::UpdateRasterSource(
MaximumContentsScale());
}
+void PictureLayerImpl::UpdateCanUseLCDText() {
+ // Don't allow the LCD text state to change once disabled.
+ if (!RasterSourceUsesLCDText())
+ return;
+ if (can_use_lcd_text() == RasterSourceUsesLCDText())
+ return;
+
+ // Raster sources are considered const, so in order to update the state
+ // a new one must be created and all tiles recreated.
+ scoped_refptr<RasterSource> new_raster_source =
+ raster_source_->CreateCloneWithoutLCDText();
+ // Synthetically invalidate everything.
+ gfx::Rect bounds_rect(bounds());
+ Region invalidation(bounds_rect);
+ UpdateRasterSource(new_raster_source, &invalidation, nullptr);
danakj 2015/02/18 01:24:10 what if there is a pending tree, would this happen
enne (OOO) 2015/02/18 02:20:02 This should only ever be called on the sync tree r
danakj 2015/02/18 02:28:13 DCHECK is sync tree sounds good.
+ SetUpdateRect(bounds_rect);
+
+ DCHECK(!RasterSourceUsesLCDText());
+}
+
+bool PictureLayerImpl::RasterSourceUsesLCDText() const {
+ return raster_source_ ? raster_source_->CanUseLCDText()
+ : layer_tree_impl()->settings().can_use_lcd_text;
+}
+
void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) {
if (layer_tree_impl()->IsActiveTree()) {
gfx::RectF layer_damage_rect =

Powered by Google App Engine
This is Rietveld 408576698