| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|    62 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, |    62 PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, | 
|    63                                    int id, |    63                                    int id, | 
|    64                                    bool is_mask) |    64                                    bool is_mask) | 
|    65     : LayerImpl(tree_impl, id), |    65     : LayerImpl(tree_impl, id), | 
|    66       twin_layer_(nullptr), |    66       twin_layer_(nullptr), | 
|    67       tilings_(CreatePictureLayerTilingSet()), |    67       tilings_(CreatePictureLayerTilingSet()), | 
|    68       ideal_page_scale_(0.f), |    68       ideal_page_scale_(0.f), | 
|    69       ideal_device_scale_(0.f), |    69       ideal_device_scale_(0.f), | 
|    70       ideal_source_scale_(0.f), |    70       ideal_source_scale_(0.f), | 
|    71       ideal_contents_scale_(0.f), |    71       ideal_contents_scale_(0.f), | 
 |    72       last_ideal_source_scale_(0.f), | 
|    72       raster_page_scale_(0.f), |    73       raster_page_scale_(0.f), | 
|    73       raster_device_scale_(0.f), |    74       raster_device_scale_(0.f), | 
|    74       raster_source_scale_(0.f), |    75       raster_source_scale_(0.f), | 
|    75       raster_contents_scale_(0.f), |    76       raster_contents_scale_(0.f), | 
|    76       low_res_raster_contents_scale_(0.f), |    77       low_res_raster_contents_scale_(0.f), | 
|    77       raster_source_scale_is_fixed_(false), |    78       raster_source_scale_is_fixed_(false), | 
|    78       was_screen_space_transform_animating_(false), |    79       was_screen_space_transform_animating_(false), | 
|    79       only_used_low_res_last_append_quads_(false), |    80       only_used_low_res_last_append_quads_(false), | 
|    80       is_mask_(is_mask), |    81       is_mask_(is_mask), | 
|    81       nearest_neighbor_(false) { |    82       nearest_neighbor_(false) { | 
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   426   if (layer_tree_impl()->IsActiveTree()) |   427   if (layer_tree_impl()->IsActiveTree()) | 
|   427     CleanUpTilingsOnActiveLayer(last_append_quads_tilings_); |   428     CleanUpTilingsOnActiveLayer(last_append_quads_tilings_); | 
|   428  |   429  | 
|   429   UpdateIdealScales(); |   430   UpdateIdealScales(); | 
|   430  |   431  | 
|   431   if (!raster_contents_scale_ || ShouldAdjustRasterScale()) { |   432   if (!raster_contents_scale_ || ShouldAdjustRasterScale()) { | 
|   432     RecalculateRasterScales(); |   433     RecalculateRasterScales(); | 
|   433     AddTilingsForRasterScale(); |   434     AddTilingsForRasterScale(); | 
|   434   } |   435   } | 
|   435  |   436  | 
 |   437   // Inform layer tree impl if we will have blurry content because of fixed | 
 |   438   // raster scale (note that this check should happen after we | 
 |   439   // ReclaculateRasterScales, since that's the function that will determine | 
 |   440   // whether our raster scale is fixed. | 
 |   441   if (raster_source_scale_is_fixed_ && !has_will_change_transform_hint()) { | 
 |   442     if (raster_source_scale_ != ideal_source_scale_) | 
 |   443       layer_tree_impl()->SetFixedRasterScaleHasBlurryContent(); | 
 |   444     if (ideal_source_scale_ != last_ideal_source_scale_) | 
 |   445       layer_tree_impl()->SetFixedRasterScaleAttemptedToChangeScale(); | 
 |   446   } | 
 |   447  | 
|   436   if (layer_tree_impl()->IsActiveTree()) |   448   if (layer_tree_impl()->IsActiveTree()) | 
|   437     AddLowResolutionTilingIfNeeded(); |   449     AddLowResolutionTilingIfNeeded(); | 
|   438  |   450  | 
|   439   DCHECK(raster_page_scale_); |   451   DCHECK(raster_page_scale_); | 
|   440   DCHECK(raster_device_scale_); |   452   DCHECK(raster_device_scale_); | 
|   441   DCHECK(raster_source_scale_); |   453   DCHECK(raster_source_scale_); | 
|   442   DCHECK(raster_contents_scale_); |   454   DCHECK(raster_contents_scale_); | 
|   443   DCHECK(low_res_raster_contents_scale_); |   455   DCHECK(low_res_raster_contents_scale_); | 
|   444  |   456  | 
|   445   was_screen_space_transform_animating_ = |   457   was_screen_space_transform_animating_ = | 
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1199   DCHECK(CanHaveTilings()); |  1211   DCHECK(CanHaveTilings()); | 
|  1200  |  1212  | 
|  1201   float min_contents_scale = MinimumContentsScale(); |  1213   float min_contents_scale = MinimumContentsScale(); | 
|  1202   DCHECK_GT(min_contents_scale, 0.f); |  1214   DCHECK_GT(min_contents_scale, 0.f); | 
|  1203  |  1215  | 
|  1204   ideal_page_scale_ = IsAffectedByPageScale() |  1216   ideal_page_scale_ = IsAffectedByPageScale() | 
|  1205                           ? layer_tree_impl()->current_page_scale_factor() |  1217                           ? layer_tree_impl()->current_page_scale_factor() | 
|  1206                           : 1.f; |  1218                           : 1.f; | 
|  1207   ideal_device_scale_ = layer_tree_impl()->device_scale_factor(); |  1219   ideal_device_scale_ = layer_tree_impl()->device_scale_factor(); | 
|  1208   ideal_contents_scale_ = std::max(GetIdealContentsScale(), min_contents_scale); |  1220   ideal_contents_scale_ = std::max(GetIdealContentsScale(), min_contents_scale); | 
 |  1221   last_ideal_source_scale_ = ideal_source_scale_; | 
|  1209   ideal_source_scale_ = |  1222   ideal_source_scale_ = | 
|  1210       ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; |  1223       ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; | 
|  1211 } |  1224 } | 
|  1212  |  1225  | 
|  1213 void PictureLayerImpl::GetDebugBorderProperties( |  1226 void PictureLayerImpl::GetDebugBorderProperties( | 
|  1214     SkColor* color, |  1227     SkColor* color, | 
|  1215     float* width) const { |  1228     float* width) const { | 
|  1216   *color = DebugColors::TiledContentLayerBorderColor(); |  1229   *color = DebugColors::TiledContentLayerBorderColor(); | 
|  1217   *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); |  1230   *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 
|  1218 } |  1231 } | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1278 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |  1291 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 
|  1279   return !layer_tree_impl()->IsRecycleTree(); |  1292   return !layer_tree_impl()->IsRecycleTree(); | 
|  1280 } |  1293 } | 
|  1281  |  1294  | 
|  1282 bool PictureLayerImpl::HasValidTilePriorities() const { |  1295 bool PictureLayerImpl::HasValidTilePriorities() const { | 
|  1283   return IsOnActiveOrPendingTree() && |  1296   return IsOnActiveOrPendingTree() && | 
|  1284          is_drawn_render_surface_layer_list_member(); |  1297          is_drawn_render_surface_layer_list_member(); | 
|  1285 } |  1298 } | 
|  1286  |  1299  | 
|  1287 }  // namespace cc |  1300 }  // namespace cc | 
| OLD | NEW |