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

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 1041893003: cc: Separate tiling set functionality into explicit separate functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | cc/resources/picture_layer_tiling.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/layers/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 layer_tree_impl()->set_needs_update_draw_properties(); 534 layer_tree_impl()->set_needs_update_draw_properties();
535 535
536 if (!can_have_tilings) { 536 if (!can_have_tilings) {
537 RemoveAllTilings(); 537 RemoveAllTilings();
538 return; 538 return;
539 } 539 }
540 540
541 // We could do this after doing UpdateTiles, which would avoid doing this for 541 // We could do this after doing UpdateTiles, which would avoid doing this for
542 // tilings that are going to disappear on the pending tree (if scale changed). 542 // tilings that are going to disappear on the pending tree (if scale changed).
543 // But that would also be more complicated, so we just do it here for now. 543 // But that would also be more complicated, so we just do it here for now.
544 tilings_->UpdateTilingsToCurrentRasterSource( 544 if (pending_set) {
545 raster_source_, pending_set, invalidation_, MinimumContentsScale(), 545 tilings_->UpdateTilingsToCurrentRasterSourceForActivation(
546 MaximumContentsScale()); 546 raster_source_, pending_set, invalidation_, MinimumContentsScale(),
547 MaximumContentsScale());
548 } else {
549 tilings_->UpdateTilingsToCurrentRasterSourceForCommit(
550 raster_source_, invalidation_, MinimumContentsScale(),
551 MaximumContentsScale());
552 }
547 } 553 }
548 554
549 void PictureLayerImpl::UpdateCanUseLCDTextAfterCommit() { 555 void PictureLayerImpl::UpdateCanUseLCDTextAfterCommit() {
550 // This function is only allowed to be called after commit, due to it not 556 // This function is only allowed to be called after commit, due to it not
551 // being smart about sharing tiles and because otherwise it would cause 557 // being smart about sharing tiles and because otherwise it would cause
552 // flashes by switching out tiles in place that may be currently on screen. 558 // flashes by switching out tiles in place that may be currently on screen.
553 DCHECK(layer_tree_impl()->IsSyncTree()); 559 DCHECK(layer_tree_impl()->IsSyncTree());
554 560
555 // Don't allow the LCD text state to change once disabled. 561 // Don't allow the LCD text state to change once disabled.
556 if (!RasterSourceUsesLCDText()) 562 if (!RasterSourceUsesLCDText())
557 return; 563 return;
558 if (can_use_lcd_text() == RasterSourceUsesLCDText()) 564 if (can_use_lcd_text() == RasterSourceUsesLCDText())
559 return; 565 return;
560 566
561 // Raster sources are considered const, so in order to update the state 567 // Raster sources are considered const, so in order to update the state
562 // a new one must be created and all tiles recreated. 568 // a new one must be created and all tiles recreated.
563 scoped_refptr<RasterSource> new_raster_source = 569 scoped_refptr<RasterSource> new_raster_source =
564 raster_source_->CreateCloneWithoutLCDText(); 570 raster_source_->CreateCloneWithoutLCDText();
571 raster_source_.swap(new_raster_source);
572
565 // Synthetically invalidate everything. 573 // Synthetically invalidate everything.
566 gfx::Rect bounds_rect(bounds()); 574 gfx::Rect bounds_rect(bounds());
567 Region invalidation(bounds_rect); 575 invalidation_ = Region(bounds_rect);
568 UpdateRasterSource(new_raster_source, &invalidation, nullptr); 576 tilings_->UpdateRasterSourceDueToLCDChange(raster_source_, invalidation_);
569 SetUpdateRect(bounds_rect); 577 SetUpdateRect(bounds_rect);
570 578
571 DCHECK(!RasterSourceUsesLCDText()); 579 DCHECK(!RasterSourceUsesLCDText());
572 } 580 }
573 581
574 bool PictureLayerImpl::RasterSourceUsesLCDText() const { 582 bool PictureLayerImpl::RasterSourceUsesLCDText() const {
575 return raster_source_ ? raster_source_->CanUseLCDText() 583 return raster_source_ ? raster_source_->CanUseLCDText()
576 : layer_tree_impl()->settings().can_use_lcd_text; 584 : layer_tree_impl()->settings().can_use_lcd_text;
577 } 585 }
578 586
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 1243
1236 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { 1244 bool PictureLayerImpl::IsOnActiveOrPendingTree() const {
1237 return !layer_tree_impl()->IsRecycleTree(); 1245 return !layer_tree_impl()->IsRecycleTree();
1238 } 1246 }
1239 1247
1240 bool PictureLayerImpl::HasValidTilePriorities() const { 1248 bool PictureLayerImpl::HasValidTilePriorities() const {
1241 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); 1249 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember();
1242 } 1250 }
1243 1251
1244 } // namespace cc 1252 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698