Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 531 | 531 |
| 532 // Need to call UpdateTiles again if CanHaveTilings changed. | 532 // Need to call UpdateTiles again if CanHaveTilings changed. |
| 533 if (could_have_tilings != can_have_tilings) | 533 if (could_have_tilings != can_have_tilings) |
| 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 tilings_->RemoveTilingsBelowScale(MinimumContentsScale()); | |
|
enne (OOO)
2015/03/31 19:53:02
I'm not 100% on moving this. I agree that somethi
vmpstr
2015/04/01 23:53:41
I moved back into both functions (as it would have
| |
| 542 tilings_->RemoveTilingsAboveScale(MaximumContentsScale()); | |
| 541 // We could do this after doing UpdateTiles, which would avoid doing this for | 543 // 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). | 544 // 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. | 545 // But that would also be more complicated, so we just do it here for now. |
| 544 tilings_->UpdateTilingsToCurrentRasterSource( | 546 if (pending_set) { |
| 545 raster_source_, pending_set, invalidation_, MinimumContentsScale(), | 547 tilings_->UpdateTilingsToCurrentRasterSourceForActivation( |
| 546 MaximumContentsScale()); | 548 raster_source_, pending_set, invalidation_); |
| 549 } else { | |
| 550 tilings_->UpdateTilingsToCurrentRasterSourceForCommit(raster_source_, | |
| 551 invalidation_); | |
| 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 Loading... | |
| 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 |
| OLD | NEW |