| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 visible_rect_in_content_space; | 519 visible_rect_in_content_space; |
| 520 } | 520 } |
| 521 | 521 |
| 522 PictureLayerImpl* PictureLayerImpl::GetPendingOrActiveTwinLayer() const { | 522 PictureLayerImpl* PictureLayerImpl::GetPendingOrActiveTwinLayer() const { |
| 523 if (!twin_layer_ || !twin_layer_->IsOnActiveOrPendingTree()) | 523 if (!twin_layer_ || !twin_layer_->IsOnActiveOrPendingTree()) |
| 524 return nullptr; | 524 return nullptr; |
| 525 return twin_layer_; | 525 return twin_layer_; |
| 526 } | 526 } |
| 527 | 527 |
| 528 void PictureLayerImpl::UpdateRasterSource( | 528 void PictureLayerImpl::UpdateRasterSource( |
| 529 scoped_refptr<DisplayListRasterSource> raster_source, | 529 scoped_refptr<RasterSource> raster_source, |
| 530 Region* new_invalidation, | 530 Region* new_invalidation, |
| 531 const PictureLayerTilingSet* pending_set) { | 531 const PictureLayerTilingSet* pending_set) { |
| 532 // The bounds and the pile size may differ if the pile wasn't updated (ie. | 532 // The bounds and the pile size may differ if the pile wasn't updated (ie. |
| 533 // PictureLayer::Update didn't happen). In that case the pile will be empty. | 533 // PictureLayer::Update didn't happen). In that case the pile will be empty. |
| 534 DCHECK(raster_source->GetSize().IsEmpty() || | 534 DCHECK(raster_source->GetSize().IsEmpty() || |
| 535 bounds() == raster_source->GetSize()) | 535 bounds() == raster_source->GetSize()) |
| 536 << " bounds " << bounds().ToString() << " pile " | 536 << " bounds " << bounds().ToString() << " pile " |
| 537 << raster_source->GetSize().ToString(); | 537 << raster_source->GetSize().ToString(); |
| 538 | 538 |
| 539 // The |raster_source_| is initially null, so have to check for that for the | 539 // The |raster_source_| is initially null, so have to check for that for the |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 DCHECK(layer_tree_impl()->IsSyncTree()); | 586 DCHECK(layer_tree_impl()->IsSyncTree()); |
| 587 | 587 |
| 588 // Don't allow the LCD text state to change once disabled. | 588 // Don't allow the LCD text state to change once disabled. |
| 589 if (!RasterSourceUsesLCDText()) | 589 if (!RasterSourceUsesLCDText()) |
| 590 return; | 590 return; |
| 591 if (can_use_lcd_text() == RasterSourceUsesLCDText()) | 591 if (can_use_lcd_text() == RasterSourceUsesLCDText()) |
| 592 return; | 592 return; |
| 593 | 593 |
| 594 // Raster sources are considered const, so in order to update the state | 594 // Raster sources are considered const, so in order to update the state |
| 595 // a new one must be created and all tiles recreated. | 595 // a new one must be created and all tiles recreated. |
| 596 scoped_refptr<DisplayListRasterSource> new_raster_source = | 596 scoped_refptr<RasterSource> new_raster_source = |
| 597 raster_source_->CreateCloneWithoutLCDText(); | 597 raster_source_->CreateCloneWithoutLCDText(); |
| 598 raster_source_.swap(new_raster_source); | 598 raster_source_.swap(new_raster_source); |
| 599 | 599 |
| 600 // Synthetically invalidate everything. | 600 // Synthetically invalidate everything. |
| 601 gfx::Rect bounds_rect(bounds()); | 601 gfx::Rect bounds_rect(bounds()); |
| 602 invalidation_ = Region(bounds_rect); | 602 invalidation_ = Region(bounds_rect); |
| 603 tilings_->UpdateRasterSourceDueToLCDChange(raster_source_, invalidation_); | 603 tilings_->UpdateRasterSourceDueToLCDChange(raster_source_, invalidation_); |
| 604 SetUpdateRect(bounds_rect); | 604 SetUpdateRect(bounds_rect); |
| 605 | 605 |
| 606 DCHECK(!RasterSourceUsesLCDText()); | 606 DCHECK(!RasterSourceUsesLCDText()); |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 | 1255 |
| 1256 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1256 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1257 return !layer_tree_impl()->IsRecycleTree(); | 1257 return !layer_tree_impl()->IsRecycleTree(); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 bool PictureLayerImpl::HasValidTilePriorities() const { | 1260 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1261 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1261 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
| 1262 } | 1262 } |
| 1263 | 1263 |
| 1264 } // namespace cc | 1264 } // namespace cc |
| OLD | NEW |