| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 | 641 |
| 642 DCHECK(!RasterSourceUsesLCDText()); | 642 DCHECK(!RasterSourceUsesLCDText()); |
| 643 } | 643 } |
| 644 | 644 |
| 645 bool PictureLayerImpl::RasterSourceUsesLCDText() const { | 645 bool PictureLayerImpl::RasterSourceUsesLCDText() const { |
| 646 return raster_source_ ? raster_source_->CanUseLCDText() | 646 return raster_source_ ? raster_source_->CanUseLCDText() |
| 647 : layer_tree_impl()->settings().can_use_lcd_text; | 647 : layer_tree_impl()->settings().can_use_lcd_text; |
| 648 } | 648 } |
| 649 | 649 |
| 650 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { | 650 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
| 651 if (layer_tree_impl()->IsActiveTree()) { | 651 if (layer_tree_impl()->IsActiveTree()) |
| 652 gfx::Rect layer_damage_rect = gfx::ScaleToEnclosingRect( | 652 AddDamageRect(tile->enclosing_layer_rect()); |
| 653 tile->content_rect(), 1.f / tile->raster_scales().width(), | |
| 654 1.f / tile->raster_scales().height()); | |
| 655 AddDamageRect(layer_damage_rect); | |
| 656 } | |
| 657 if (tile->draw_info().NeedsRaster()) { | 653 if (tile->draw_info().NeedsRaster()) { |
| 658 PictureLayerTiling* tiling = | 654 PictureLayerTiling* tiling = |
| 659 tilings_->FindTilingWithScaleKey(tile->contents_scale_key()); | 655 tilings_->FindTilingWithScaleKey(tile->contents_scale_key()); |
| 660 if (tiling) | 656 if (tiling) |
| 661 tiling->set_all_tiles_done(false); | 657 tiling->set_all_tiles_done(false); |
| 662 } | 658 } |
| 663 } | 659 } |
| 664 | 660 |
| 665 SimpleEnclosedRegion PictureLayerImpl::VisibleOpaqueRegion() const { | 661 SimpleEnclosedRegion PictureLayerImpl::VisibleOpaqueRegion() const { |
| 666 if (use_transformed_rasterization_) | 662 if (use_transformed_rasterization_) |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 if (PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer()) | 721 if (PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer()) |
| 726 return &twin_layer->invalidation_; | 722 return &twin_layer->invalidation_; |
| 727 return nullptr; | 723 return nullptr; |
| 728 } | 724 } |
| 729 | 725 |
| 730 const PictureLayerTiling* PictureLayerImpl::GetPendingOrActiveTwinTiling( | 726 const PictureLayerTiling* PictureLayerImpl::GetPendingOrActiveTwinTiling( |
| 731 const PictureLayerTiling* tiling) const { | 727 const PictureLayerTiling* tiling) const { |
| 732 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer(); | 728 PictureLayerImpl* twin_layer = GetPendingOrActiveTwinLayer(); |
| 733 if (!twin_layer) | 729 if (!twin_layer) |
| 734 return nullptr; | 730 return nullptr; |
| 735 return twin_layer->tilings_->FindTilingWithScaleKey( | 731 const PictureLayerTiling* twin_tiling = twin_layer->tilings_->FindTilingWithSc
aleKey(tiling->contents_scale_key()); |
| 736 tiling->contents_scale_key()); | 732 DCHECK(tiling->raster_transform().translation() == gfx::Vector2dF()); |
| 733 DCHECK(!twin_tiling || twin_tiling->raster_transform().translation() == gfx::V
ector2dF()); |
| 734 return twin_tiling; |
| 737 } | 735 } |
| 738 | 736 |
| 739 bool PictureLayerImpl::RequiresHighResToDraw() const { | 737 bool PictureLayerImpl::RequiresHighResToDraw() const { |
| 740 return layer_tree_impl()->RequiresHighResToDraw(); | 738 return layer_tree_impl()->RequiresHighResToDraw(); |
| 741 } | 739 } |
| 742 | 740 |
| 743 gfx::Rect PictureLayerImpl::GetEnclosingRectInTargetSpace() const { | 741 gfx::Rect PictureLayerImpl::GetEnclosingRectInTargetSpace() const { |
| 744 return GetScaledEnclosingRectInTargetSpace(MaximumTilingContentsScale()); | 742 return GetScaledEnclosingRectInTargetSpace(MaximumTilingContentsScale()); |
| 745 } | 743 } |
| 746 | 744 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 887 | 885 |
| 888 use_transformed_rasterization_ = use; | 886 use_transformed_rasterization_ = use; |
| 889 NoteLayerPropertyChanged(); | 887 NoteLayerPropertyChanged(); |
| 890 } | 888 } |
| 891 | 889 |
| 892 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { | 890 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { |
| 893 DCHECK(CanHaveTilings()); | 891 DCHECK(CanHaveTilings()); |
| 894 DCHECK_GE(contents_scale, MinimumContentsScale()); | 892 DCHECK_GE(contents_scale, MinimumContentsScale()); |
| 895 DCHECK_LE(contents_scale, MaximumContentsScale()); | 893 DCHECK_LE(contents_scale, MaximumContentsScale()); |
| 896 DCHECK(raster_source_->HasRecordings()); | 894 DCHECK(raster_source_->HasRecordings()); |
| 897 return tilings_->AddTiling(contents_scale, raster_source_); | 895 return tilings_->AddTiling(ScaleTranslate2d(contents_scale, gfx::Vector2dF()),
raster_source_); |
| 898 } | 896 } |
| 899 | 897 |
| 900 void PictureLayerImpl::RemoveAllTilings() { | 898 void PictureLayerImpl::RemoveAllTilings() { |
| 901 tilings_->RemoveAllTilings(); | 899 tilings_->RemoveAllTilings(); |
| 902 // If there are no tilings, then raster scales are no longer meaningful. | 900 // If there are no tilings, then raster scales are no longer meaningful. |
| 903 ResetRasterScale(); | 901 ResetRasterScale(); |
| 904 } | 902 } |
| 905 | 903 |
| 906 void PictureLayerImpl::AddTilingsForRasterScale() { | 904 void PictureLayerImpl::AddTilingsForRasterScale() { |
| 907 // Reset all resolution enums on tilings, we'll be setting new values in this | 905 // Reset all resolution enums on tilings, we'll be setting new values in this |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1356 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1359 return !layer_tree_impl()->IsRecycleTree(); | 1357 return !layer_tree_impl()->IsRecycleTree(); |
| 1360 } | 1358 } |
| 1361 | 1359 |
| 1362 bool PictureLayerImpl::HasValidTilePriorities() const { | 1360 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1363 return IsOnActiveOrPendingTree() && | 1361 return IsOnActiveOrPendingTree() && |
| 1364 is_drawn_render_surface_layer_list_member(); | 1362 is_drawn_render_surface_layer_list_member(); |
| 1365 } | 1363 } |
| 1366 | 1364 |
| 1367 } // namespace cc | 1365 } // namespace cc |
| OLD | NEW |