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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 ideal_contents_scale_(0.f), | 102 ideal_contents_scale_(0.f), |
103 raster_page_scale_(0.f), | 103 raster_page_scale_(0.f), |
104 raster_device_scale_(0.f), | 104 raster_device_scale_(0.f), |
105 raster_source_scale_(0.f), | 105 raster_source_scale_(0.f), |
106 raster_contents_scale_(0.f), | 106 raster_contents_scale_(0.f), |
107 low_res_raster_contents_scale_(0.f), | 107 low_res_raster_contents_scale_(0.f), |
108 was_screen_space_transform_animating_(false), | 108 was_screen_space_transform_animating_(false), |
109 only_used_low_res_last_append_quads_(false), | 109 only_used_low_res_last_append_quads_(false), |
110 is_mask_(is_mask), | 110 is_mask_(is_mask), |
111 nearest_neighbor_(false), | 111 nearest_neighbor_(false), |
| 112 use_transformed_rasterization_(false), |
112 is_directly_composited_image_(false) { | 113 is_directly_composited_image_(false) { |
113 layer_tree_impl()->RegisterPictureLayerImpl(this); | 114 layer_tree_impl()->RegisterPictureLayerImpl(this); |
114 } | 115 } |
115 | 116 |
116 PictureLayerImpl::~PictureLayerImpl() { | 117 PictureLayerImpl::~PictureLayerImpl() { |
117 if (twin_layer_) | 118 if (twin_layer_) |
118 twin_layer_->twin_layer_ = nullptr; | 119 twin_layer_->twin_layer_ = nullptr; |
119 layer_tree_impl()->UnregisterPictureLayerImpl(this); | 120 layer_tree_impl()->UnregisterPictureLayerImpl(this); |
120 } | 121 } |
121 | 122 |
(...skipping 16 matching lines...) Expand all Loading... |
138 DCHECK(!twin_layer_ || twin_layer_ == layer_impl); | 139 DCHECK(!twin_layer_ || twin_layer_ == layer_impl); |
139 DCHECK(!twin_layer_ || layer_impl->twin_layer_ == this); | 140 DCHECK(!twin_layer_ || layer_impl->twin_layer_ == this); |
140 // The twin relationship does not need to exist before the first | 141 // The twin relationship does not need to exist before the first |
141 // PushPropertiesTo from pending to active layer since before that the active | 142 // PushPropertiesTo from pending to active layer since before that the active |
142 // layer can not have a pile or tilings, it has only been created and inserted | 143 // layer can not have a pile or tilings, it has only been created and inserted |
143 // into the tree at that point. | 144 // into the tree at that point. |
144 twin_layer_ = layer_impl; | 145 twin_layer_ = layer_impl; |
145 layer_impl->twin_layer_ = this; | 146 layer_impl->twin_layer_ = this; |
146 | 147 |
147 layer_impl->SetNearestNeighbor(nearest_neighbor_); | 148 layer_impl->SetNearestNeighbor(nearest_neighbor_); |
| 149 layer_impl->SetUseTransformedRasterization(use_transformed_rasterization_); |
148 | 150 |
149 // Solid color layers have no tilings. | 151 // Solid color layers have no tilings. |
150 DCHECK(!raster_source_->IsSolidColor() || tilings_->num_tilings() == 0); | 152 DCHECK(!raster_source_->IsSolidColor() || tilings_->num_tilings() == 0); |
151 // The pending tree should only have a high res (and possibly low res) tiling. | 153 // The pending tree should only have a high res (and possibly low res) tiling. |
152 DCHECK_LE(tilings_->num_tilings(), | 154 DCHECK_LE(tilings_->num_tilings(), |
153 layer_tree_impl()->create_low_res_tiling() ? 2u : 1u); | 155 layer_tree_impl()->create_low_res_tiling() ? 2u : 1u); |
154 | 156 |
155 layer_impl->set_gpu_raster_max_texture_size(gpu_raster_max_texture_size_); | 157 layer_impl->set_gpu_raster_max_texture_size(gpu_raster_max_texture_size_); |
156 layer_impl->UpdateRasterSource(raster_source_, &invalidation_, | 158 layer_impl->UpdateRasterSource(raster_source_, &invalidation_, |
157 tilings_.get()); | 159 tilings_.get()); |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 } | 868 } |
867 | 869 |
868 void PictureLayerImpl::SetNearestNeighbor(bool nearest_neighbor) { | 870 void PictureLayerImpl::SetNearestNeighbor(bool nearest_neighbor) { |
869 if (nearest_neighbor_ == nearest_neighbor) | 871 if (nearest_neighbor_ == nearest_neighbor) |
870 return; | 872 return; |
871 | 873 |
872 nearest_neighbor_ = nearest_neighbor; | 874 nearest_neighbor_ = nearest_neighbor; |
873 NoteLayerPropertyChanged(); | 875 NoteLayerPropertyChanged(); |
874 } | 876 } |
875 | 877 |
| 878 void PictureLayerImpl::SetUseTransformedRasterization(bool use) { |
| 879 if (use_transformed_rasterization_ == use) |
| 880 return; |
| 881 |
| 882 use_transformed_rasterization_ = use; |
| 883 NoteLayerPropertyChanged(); |
| 884 } |
| 885 |
876 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { | 886 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { |
877 DCHECK(CanHaveTilings()); | 887 DCHECK(CanHaveTilings()); |
878 DCHECK_GE(contents_scale, MinimumContentsScale()); | 888 DCHECK_GE(contents_scale, MinimumContentsScale()); |
879 DCHECK_LE(contents_scale, MaximumContentsScale()); | 889 DCHECK_LE(contents_scale, MaximumContentsScale()); |
880 DCHECK(raster_source_->HasRecordings()); | 890 DCHECK(raster_source_->HasRecordings()); |
881 return tilings_->AddTiling(contents_scale, raster_source_); | 891 return tilings_->AddTiling(contents_scale, raster_source_); |
882 } | 892 } |
883 | 893 |
884 void PictureLayerImpl::RemoveAllTilings() { | 894 void PictureLayerImpl::RemoveAllTilings() { |
885 tilings_->RemoveAllTilings(); | 895 tilings_->RemoveAllTilings(); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1352 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1343 return !layer_tree_impl()->IsRecycleTree(); | 1353 return !layer_tree_impl()->IsRecycleTree(); |
1344 } | 1354 } |
1345 | 1355 |
1346 bool PictureLayerImpl::HasValidTilePriorities() const { | 1356 bool PictureLayerImpl::HasValidTilePriorities() const { |
1347 return IsOnActiveOrPendingTree() && | 1357 return IsOnActiveOrPendingTree() && |
1348 is_drawn_render_surface_layer_list_member(); | 1358 is_drawn_render_surface_layer_list_member(); |
1349 } | 1359 } |
1350 | 1360 |
1351 } // namespace cc | 1361 } // namespace cc |
OLD | NEW |