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 mask_type_(mask_type), | 110 mask_type_(mask_type), |
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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 } | 867 } |
866 | 868 |
867 void PictureLayerImpl::SetNearestNeighbor(bool nearest_neighbor) { | 869 void PictureLayerImpl::SetNearestNeighbor(bool nearest_neighbor) { |
868 if (nearest_neighbor_ == nearest_neighbor) | 870 if (nearest_neighbor_ == nearest_neighbor) |
869 return; | 871 return; |
870 | 872 |
871 nearest_neighbor_ = nearest_neighbor; | 873 nearest_neighbor_ = nearest_neighbor; |
872 NoteLayerPropertyChanged(); | 874 NoteLayerPropertyChanged(); |
873 } | 875 } |
874 | 876 |
| 877 void PictureLayerImpl::SetUseTransformedRasterization(bool use) { |
| 878 if (use_transformed_rasterization_ == use) |
| 879 return; |
| 880 |
| 881 use_transformed_rasterization_ = use; |
| 882 NoteLayerPropertyChanged(); |
| 883 } |
| 884 |
875 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { | 885 PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { |
876 DCHECK(CanHaveTilings()); | 886 DCHECK(CanHaveTilings()); |
877 DCHECK_GE(contents_scale, MinimumContentsScale()); | 887 DCHECK_GE(contents_scale, MinimumContentsScale()); |
878 DCHECK_LE(contents_scale, MaximumContentsScale()); | 888 DCHECK_LE(contents_scale, MaximumContentsScale()); |
879 DCHECK(raster_source_->HasRecordings()); | 889 DCHECK(raster_source_->HasRecordings()); |
880 return tilings_->AddTiling(contents_scale, raster_source_); | 890 return tilings_->AddTiling(contents_scale, raster_source_); |
881 } | 891 } |
882 | 892 |
883 void PictureLayerImpl::RemoveAllTilings() { | 893 void PictureLayerImpl::RemoveAllTilings() { |
884 tilings_->RemoveAllTilings(); | 894 tilings_->RemoveAllTilings(); |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 } | 1402 } |
1393 | 1403 |
1394 invalidation_.Union(invalidation); | 1404 invalidation_.Union(invalidation); |
1395 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); | 1405 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); |
1396 SetNeedsPushProperties(); | 1406 SetNeedsPushProperties(); |
1397 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", | 1407 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", |
1398 "Invalidation", invalidation.ToString()); | 1408 "Invalidation", invalidation.ToString()); |
1399 } | 1409 } |
1400 | 1410 |
1401 } // namespace cc | 1411 } // namespace cc |
OLD | NEW |