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

Side by Side Diff: cc/resources/picture_pile.cc

Issue 733233003: Revert of cc: Toggle LCD text at raster time instead of record time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « cc/resources/picture_pile.h ('k') | cc/resources/picture_pile_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/picture_pile.h" 5 #include "cc/resources/picture_pile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 PicturePile::~PicturePile() { 187 PicturePile::~PicturePile() {
188 } 188 }
189 189
190 bool PicturePile::UpdateAndExpandInvalidation( 190 bool PicturePile::UpdateAndExpandInvalidation(
191 ContentLayerClient* painter, 191 ContentLayerClient* painter,
192 Region* invalidation, 192 Region* invalidation,
193 SkColor background_color, 193 SkColor background_color,
194 bool contents_opaque, 194 bool contents_opaque,
195 bool contents_fill_bounds_completely, 195 bool contents_fill_bounds_completely,
196 bool can_use_lcd_text,
197 const gfx::Size& layer_size, 196 const gfx::Size& layer_size,
198 const gfx::Rect& visible_layer_rect, 197 const gfx::Rect& visible_layer_rect,
199 int frame_number, 198 int frame_number,
200 Picture::RecordingMode recording_mode) { 199 Picture::RecordingMode recording_mode) {
201 background_color_ = background_color; 200 background_color_ = background_color;
202 contents_opaque_ = contents_opaque; 201 contents_opaque_ = contents_opaque;
203 contents_fill_bounds_completely_ = contents_fill_bounds_completely; 202 contents_fill_bounds_completely_ = contents_fill_bounds_completely;
204 bool can_use_lcd_text_changed = can_use_lcd_text_ != can_use_lcd_text;
205 can_use_lcd_text_ = can_use_lcd_text;
206 203
207 bool updated = false; 204 bool updated = false;
208 205
209 Region synthetic_invalidation; 206 Region resize_invalidation;
210 gfx::Size old_tiling_size = GetSize(); 207 gfx::Size old_tiling_size = GetSize();
211 if (old_tiling_size != layer_size) { 208 if (old_tiling_size != layer_size) {
212 tiling_.SetTilingSize(layer_size); 209 tiling_.SetTilingSize(layer_size);
213 updated = true; 210 updated = true;
214 } 211 }
215 if (can_use_lcd_text_changed) {
216 // When LCD text is enabled/disabled, we must drop any raster tiles for
217 // the pile, so they can be recreated in a manner consistent with the new
218 // setting. We do this with |synthetic_invalidation| since we don't need to
219 // do a new recording, just invalidate rastered content.
220 synthetic_invalidation.Union(gfx::Rect(GetSize()));
221 updated = true;
222 }
223 212
224 gfx::Rect interest_rect = visible_layer_rect; 213 gfx::Rect interest_rect = visible_layer_rect;
225 interest_rect.Inset(-pixel_record_distance_, -pixel_record_distance_); 214 interest_rect.Inset(-pixel_record_distance_, -pixel_record_distance_);
226 recorded_viewport_ = interest_rect; 215 recorded_viewport_ = interest_rect;
227 recorded_viewport_.Intersect(gfx::Rect(GetSize())); 216 recorded_viewport_.Intersect(gfx::Rect(GetSize()));
228 217
229 gfx::Rect interest_rect_over_tiles = 218 gfx::Rect interest_rect_over_tiles =
230 tiling_.ExpandRectToTileBounds(interest_rect); 219 tiling_.ExpandRectToTileBounds(interest_rect);
231 220
232 gfx::Size min_tiling_size( 221 gfx::Size min_tiling_size(
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 365
377 gfx::Rect left_rect(left, top, left_until - left, bottom - top); 366 gfx::Rect left_rect(left, top, left_until - left, bottom - top);
378 gfx::Rect right_rect(right_until, top, right - right_until, bottom - top); 367 gfx::Rect right_rect(right_until, top, right - right_until, bottom - top);
379 gfx::Rect top_rect(left, top, right - left, top_until - top); 368 gfx::Rect top_rect(left, top, right - left, top_until - top);
380 gfx::Rect bottom_rect( 369 gfx::Rect bottom_rect(
381 left, bottom_until, right - left, bottom - bottom_until); 370 left, bottom_until, right - left, bottom - bottom_until);
382 gfx::Rect exposed_rect(exposed_left, 371 gfx::Rect exposed_rect(exposed_left,
383 exposed_top, 372 exposed_top,
384 exposed_left_until - exposed_left, 373 exposed_left_until - exposed_left,
385 exposed_bottom - exposed_top); 374 exposed_bottom - exposed_top);
386 synthetic_invalidation.Union(left_rect); 375 resize_invalidation.Union(left_rect);
387 synthetic_invalidation.Union(right_rect); 376 resize_invalidation.Union(right_rect);
388 synthetic_invalidation.Union(top_rect); 377 resize_invalidation.Union(top_rect);
389 synthetic_invalidation.Union(bottom_rect); 378 resize_invalidation.Union(bottom_rect);
390 synthetic_invalidation.Union(exposed_rect); 379 resize_invalidation.Union(exposed_rect);
391 } 380 }
392 if (min_toss_y < tiling_.num_tiles_y()) { 381 if (min_toss_y < tiling_.num_tiles_y()) {
393 // The same thing occurs here as in the case above, but the invalidation 382 // The same thing occurs here as in the case above, but the invalidation
394 // rect is the bounding box around the bottom row of tiles in the min 383 // rect is the bounding box around the bottom row of tiles in the min
395 // pile. This would be tiles {o,r,u,x,a,d,g,j} in the above picture. 384 // pile. This would be tiles {o,r,u,x,a,d,g,j} in the above picture.
396 385
397 int top = tiling_.TilePositionY(min_toss_y); 386 int top = tiling_.TilePositionY(min_toss_y);
398 int bottom = top + tiling_.TileSizeY(min_toss_y); 387 int bottom = top + tiling_.TileSizeY(min_toss_y);
399 int left = min_tiling_rect_over_tiles.x(); 388 int left = min_tiling_rect_over_tiles.x();
400 int right = min_tiling_rect_over_tiles.right(); 389 int right = min_tiling_rect_over_tiles.right();
(...skipping 11 matching lines...) Expand all
412 401
413 gfx::Rect left_rect(left, top, left_until - left, bottom - top); 402 gfx::Rect left_rect(left, top, left_until - left, bottom - top);
414 gfx::Rect right_rect(right_until, top, right - right_until, bottom - top); 403 gfx::Rect right_rect(right_until, top, right - right_until, bottom - top);
415 gfx::Rect top_rect(left, top, right - left, top_until - top); 404 gfx::Rect top_rect(left, top, right - left, top_until - top);
416 gfx::Rect bottom_rect( 405 gfx::Rect bottom_rect(
417 left, bottom_until, right - left, bottom - bottom_until); 406 left, bottom_until, right - left, bottom - bottom_until);
418 gfx::Rect exposed_rect(exposed_left, 407 gfx::Rect exposed_rect(exposed_left,
419 exposed_top, 408 exposed_top,
420 exposed_right - exposed_left, 409 exposed_right - exposed_left,
421 exposed_top_until - exposed_top); 410 exposed_top_until - exposed_top);
422 synthetic_invalidation.Union(left_rect); 411 resize_invalidation.Union(left_rect);
423 synthetic_invalidation.Union(right_rect); 412 resize_invalidation.Union(right_rect);
424 synthetic_invalidation.Union(top_rect); 413 resize_invalidation.Union(top_rect);
425 synthetic_invalidation.Union(bottom_rect); 414 resize_invalidation.Union(bottom_rect);
426 synthetic_invalidation.Union(exposed_rect); 415 resize_invalidation.Union(exposed_rect);
427 } 416 }
428 } 417 }
429 418
430 // Detect cases where the full pile is invalidated, in this situation we 419 // Detect cases where the full pile is invalidated, in this situation we
431 // can just drop/invalidate everything. 420 // can just drop/invalidate everything.
432 if (invalidation->Contains(gfx::Rect(old_tiling_size)) || 421 if (invalidation->Contains(gfx::Rect(old_tiling_size)) ||
433 invalidation->Contains(gfx::Rect(GetSize()))) { 422 invalidation->Contains(gfx::Rect(GetSize()))) {
434 for (auto& it : picture_map_) 423 for (auto& it : picture_map_)
435 updated = it.second.Invalidate(frame_number) || updated; 424 updated = it.second.Invalidate(frame_number) || updated;
436 } else { 425 } else {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 // if it won't be re-recorded below. 467 // if it won't be re-recorded below.
479 DCHECK_IMPLIES(!tiling_.TileBounds(key.first, key.second) 468 DCHECK_IMPLIES(!tiling_.TileBounds(key.first, key.second)
480 .Intersects(interest_rect_over_tiles), 469 .Intersects(interest_rect_over_tiles),
481 invalidation_expanded_to_full_tiles.Contains( 470 invalidation_expanded_to_full_tiles.Contains(
482 tiling_.TileBounds(key.first, key.second))); 471 tiling_.TileBounds(key.first, key.second)));
483 } 472 }
484 } 473 }
485 invalidation->Union(invalidation_expanded_to_full_tiles); 474 invalidation->Union(invalidation_expanded_to_full_tiles);
486 } 475 }
487 476
488 invalidation->Union(synthetic_invalidation); 477 invalidation->Union(resize_invalidation);
489 478
490 // Make a list of all invalid tiles; we will attempt to 479 // Make a list of all invalid tiles; we will attempt to
491 // cluster these into multiple invalidation regions. 480 // cluster these into multiple invalidation regions.
492 std::vector<gfx::Rect> invalid_tiles; 481 std::vector<gfx::Rect> invalid_tiles;
493 bool include_borders = true; 482 bool include_borders = true;
494 for (TilingData::Iterator it(&tiling_, interest_rect, include_borders); it; 483 for (TilingData::Iterator it(&tiling_, interest_rect, include_borders); it;
495 ++it) { 484 ++it) {
496 const PictureMapKey& key = it.index(); 485 const PictureMapKey& key = it.index();
497 PictureInfo& info = picture_map_[key]; 486 PictureInfo& info = picture_map_[key];
498 487
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 const Picture* PicturePile::PictureInfo::GetPicture() const { 759 const Picture* PicturePile::PictureInfo::GetPicture() const {
771 return picture_.get(); 760 return picture_.get();
772 } 761 }
773 762
774 float PicturePile::PictureInfo::GetInvalidationFrequency() const { 763 float PicturePile::PictureInfo::GetInvalidationFrequency() const {
775 return invalidation_history_.count() / 764 return invalidation_history_.count() /
776 static_cast<float>(INVALIDATION_FRAMES_TRACKED); 765 static_cast<float>(INVALIDATION_FRAMES_TRACKED);
777 } 766 }
778 767
779 } // namespace cc 768 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/picture_pile.h ('k') | cc/resources/picture_pile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698