| 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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 visible_rect_in_content_space; | 517 visible_rect_in_content_space; |
| 518 } | 518 } |
| 519 | 519 |
| 520 PictureLayerImpl* PictureLayerImpl::GetPendingOrActiveTwinLayer() const { | 520 PictureLayerImpl* PictureLayerImpl::GetPendingOrActiveTwinLayer() const { |
| 521 if (!twin_layer_ || !twin_layer_->IsOnActiveOrPendingTree()) | 521 if (!twin_layer_ || !twin_layer_->IsOnActiveOrPendingTree()) |
| 522 return nullptr; | 522 return nullptr; |
| 523 return twin_layer_; | 523 return twin_layer_; |
| 524 } | 524 } |
| 525 | 525 |
| 526 void PictureLayerImpl::UpdateRasterSource( | 526 void PictureLayerImpl::UpdateRasterSource( |
| 527 scoped_refptr<RasterSource> raster_source, | 527 scoped_refptr<DisplayListRasterSource> raster_source, |
| 528 Region* new_invalidation, | 528 Region* new_invalidation, |
| 529 const PictureLayerTilingSet* pending_set) { | 529 const PictureLayerTilingSet* pending_set) { |
| 530 // The bounds and the pile size may differ if the pile wasn't updated (ie. | 530 // The bounds and the pile size may differ if the pile wasn't updated (ie. |
| 531 // PictureLayer::Update didn't happen). In that case the pile will be empty. | 531 // PictureLayer::Update didn't happen). In that case the pile will be empty. |
| 532 DCHECK_IMPLIES(!raster_source->GetSize().IsEmpty(), | 532 DCHECK_IMPLIES(!raster_source->GetSize().IsEmpty(), |
| 533 bounds() == raster_source->GetSize()) | 533 bounds() == raster_source->GetSize()) |
| 534 << " bounds " << bounds().ToString() << " pile " | 534 << " bounds " << bounds().ToString() << " pile " |
| 535 << raster_source->GetSize().ToString(); | 535 << raster_source->GetSize().ToString(); |
| 536 | 536 |
| 537 // The |raster_source_| is initially null, so have to check for that for the | 537 // The |raster_source_| is initially null, so have to check for that for the |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 DCHECK(layer_tree_impl()->IsSyncTree()); | 579 DCHECK(layer_tree_impl()->IsSyncTree()); |
| 580 | 580 |
| 581 // Don't allow the LCD text state to change once disabled. | 581 // Don't allow the LCD text state to change once disabled. |
| 582 if (!RasterSourceUsesLCDText()) | 582 if (!RasterSourceUsesLCDText()) |
| 583 return; | 583 return; |
| 584 if (can_use_lcd_text() == RasterSourceUsesLCDText()) | 584 if (can_use_lcd_text() == RasterSourceUsesLCDText()) |
| 585 return; | 585 return; |
| 586 | 586 |
| 587 // Raster sources are considered const, so in order to update the state | 587 // Raster sources are considered const, so in order to update the state |
| 588 // a new one must be created and all tiles recreated. | 588 // a new one must be created and all tiles recreated. |
| 589 scoped_refptr<RasterSource> new_raster_source = | 589 scoped_refptr<DisplayListRasterSource> new_raster_source = |
| 590 raster_source_->CreateCloneWithoutLCDText(); | 590 raster_source_->CreateCloneWithoutLCDText(); |
| 591 raster_source_.swap(new_raster_source); | 591 raster_source_.swap(new_raster_source); |
| 592 | 592 |
| 593 // Synthetically invalidate everything. | 593 // Synthetically invalidate everything. |
| 594 gfx::Rect bounds_rect(bounds()); | 594 gfx::Rect bounds_rect(bounds()); |
| 595 invalidation_ = Region(bounds_rect); | 595 invalidation_ = Region(bounds_rect); |
| 596 tilings_->UpdateRasterSourceDueToLCDChange(raster_source_, invalidation_); | 596 tilings_->UpdateRasterSourceDueToLCDChange(raster_source_, invalidation_); |
| 597 SetUpdateRect(bounds_rect); | 597 SetUpdateRect(bounds_rect); |
| 598 | 598 |
| 599 DCHECK(!RasterSourceUsesLCDText()); | 599 DCHECK(!RasterSourceUsesLCDText()); |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 | 1263 |
| 1264 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1264 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1265 return !layer_tree_impl()->IsRecycleTree(); | 1265 return !layer_tree_impl()->IsRecycleTree(); |
| 1266 } | 1266 } |
| 1267 | 1267 |
| 1268 bool PictureLayerImpl::HasValidTilePriorities() const { | 1268 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1269 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1269 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
| 1270 } | 1270 } |
| 1271 | 1271 |
| 1272 } // namespace cc | 1272 } // namespace cc |
| OLD | NEW |