Index: cc/resources/picture_pile.cc |
diff --git a/cc/resources/picture_pile.cc b/cc/resources/picture_pile.cc |
index 2b15aeadb7c9ada7fee2003e0d0c465fd7a91785..7e94e18e44477c536e40ce94a0d0dc3fb0d1f729 100644 |
--- a/cc/resources/picture_pile.cc |
+++ b/cc/resources/picture_pile.cc |
@@ -166,6 +166,7 @@ PicturePile::PicturePile(float min_contents_scale, |
const gfx::Size& tile_grid_size) |
: min_contents_scale_(0), |
slow_down_raster_scale_factor_for_debug_(0), |
+ can_use_lcd_text_(true), |
has_any_recordings_(false), |
clear_canvas_with_debug_color_(kDefaultClearCanvasSetting), |
requires_clear_(true), |
@@ -185,17 +186,22 @@ PicturePile::~PicturePile() { |
bool PicturePile::UpdateAndExpandInvalidation( |
ContentLayerClient* painter, |
Region* invalidation, |
+ bool can_use_lcd_text, |
const gfx::Size& layer_size, |
const gfx::Rect& visible_layer_rect, |
int frame_number, |
RecordingSource::RecordingMode recording_mode) { |
+ bool can_use_lcd_text_changed = can_use_lcd_text_ != can_use_lcd_text; |
+ can_use_lcd_text_ = can_use_lcd_text; |
+ |
gfx::Rect interest_rect = visible_layer_rect; |
interest_rect.Inset(-pixel_record_distance_, -pixel_record_distance_); |
recorded_viewport_ = interest_rect; |
recorded_viewport_.Intersect(gfx::Rect(layer_size)); |
- bool updated = ApplyInvalidationAndResize(interest_rect, invalidation, |
- layer_size, frame_number); |
+ bool updated = |
+ ApplyInvalidationAndResize(interest_rect, invalidation, layer_size, |
+ frame_number, can_use_lcd_text_changed); |
std::vector<gfx::Rect> invalid_tiles; |
GetInvalidTileRects(interest_rect, invalidation, visible_layer_rect, |
frame_number, &invalid_tiles); |
@@ -217,7 +223,8 @@ bool PicturePile::UpdateAndExpandInvalidation( |
bool PicturePile::ApplyInvalidationAndResize(const gfx::Rect& interest_rect, |
Region* invalidation, |
const gfx::Size& layer_size, |
- int frame_number) { |
+ int frame_number, |
+ bool can_use_lcd_text_changed) { |
bool updated = false; |
Region synthetic_invalidation; |
@@ -226,6 +233,14 @@ bool PicturePile::ApplyInvalidationAndResize(const gfx::Rect& interest_rect, |
tiling_.SetTilingSize(layer_size); |
updated = true; |
} |
+ if (can_use_lcd_text_changed) { |
+ // When LCD text is enabled/disabled, we must drop any raster tiles for |
+ // the pile, so they can be recreated in a manner consistent with the new |
+ // setting. We do this with |synthetic_invalidation| since we don't need to |
+ // do a new recording, just invalidate rastered content. |
+ synthetic_invalidation.Union(gfx::Rect(GetSize())); |
+ updated = true; |
+ } |
gfx::Rect interest_rect_over_tiles = |
tiling_.ExpandRectToTileBounds(interest_rect); |
@@ -578,10 +593,9 @@ void PicturePile::CreatePictures(ContentLayerClient* painter, |
} |
} |
-scoped_refptr<RasterSource> PicturePile::CreateRasterSource( |
- bool can_use_lcd_text) const { |
+scoped_refptr<RasterSource> PicturePile::CreateRasterSource() const { |
return scoped_refptr<RasterSource>( |
- PicturePileImpl::CreateFromPicturePile(this, can_use_lcd_text)); |
+ PicturePileImpl::CreateFromPicturePile(this)); |
} |
gfx::Size PicturePile::GetSize() const { |