| 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.h" | 5 #include "cc/layers/picture_layer.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "cc/layers/content_layer_client.h" | 9 #include "cc/layers/content_layer_client.h" |
| 10 #include "cc/layers/picture_layer_impl.h" | 10 #include "cc/layers/picture_layer_impl.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 picture_layer_inputs_.recorded_viewport = gfx::Rect(); | 241 picture_layer_inputs_.recorded_viewport = gfx::Rect(); |
| 242 picture_layer_inputs_.display_list = nullptr; | 242 picture_layer_inputs_.display_list = nullptr; |
| 243 picture_layer_inputs_.painter_reported_memory_usage = 0; | 243 picture_layer_inputs_.painter_reported_memory_usage = 0; |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 | 246 |
| 247 bool PictureLayer::ShouldUseTransformedRasterization() const { | 247 bool PictureLayer::ShouldUseTransformedRasterization() const { |
| 248 if (!picture_layer_inputs_.allow_transformed_rasterization) | 248 if (!picture_layer_inputs_.allow_transformed_rasterization) |
| 249 return false; | 249 return false; |
| 250 | 250 |
| 251 // Background color overfill is undesirable with transformed rasterization. |
| 252 // However, without background overfill, the tiles will be non-opaque on |
| 253 // external edges, and layer opaque region can't be computed in layer space |
| 254 // due to rounding under extreme scaling. This defeats many opaque layer |
| 255 // optimization. Prefer optimization over quality for this particular case. |
| 256 if (contents_opaque()) |
| 257 return false; |
| 258 |
| 251 const TransformTree& transform_tree = | 259 const TransformTree& transform_tree = |
| 252 layer_tree_host()->property_trees()->transform_tree; | 260 layer_tree_host()->property_trees()->transform_tree; |
| 253 DCHECK(!transform_tree.needs_update()); | 261 DCHECK(!transform_tree.needs_update()); |
| 254 if (transform_tree.Node(transform_tree_index()) | 262 if (transform_tree.Node(transform_tree_index()) |
| 255 ->to_screen_is_potentially_animated) | 263 ->to_screen_is_potentially_animated) |
| 256 return false; | 264 return false; |
| 257 | 265 |
| 258 const gfx::Transform& to_screen = | 266 const gfx::Transform& to_screen = |
| 259 transform_tree.ToScreen(transform_tree_index()); | 267 transform_tree.ToScreen(transform_tree_index()); |
| 260 if (!to_screen.IsScaleOrTranslation()) | 268 if (!to_screen.IsScaleOrTranslation()) |
| 261 return false; | 269 return false; |
| 262 | 270 |
| 263 float origin_x = | 271 float origin_x = |
| 264 to_screen.matrix().getFloat(0, 3) + offset_to_transform_parent().x(); | 272 to_screen.matrix().getFloat(0, 3) + offset_to_transform_parent().x(); |
| 265 float origin_y = | 273 float origin_y = |
| 266 to_screen.matrix().getFloat(1, 3) + offset_to_transform_parent().y(); | 274 to_screen.matrix().getFloat(1, 3) + offset_to_transform_parent().y(); |
| 267 if (origin_x - floorf(origin_x) == 0.f && origin_y - floorf(origin_y) == 0.f) | 275 if (origin_x - floorf(origin_x) == 0.f && origin_y - floorf(origin_y) == 0.f) |
| 268 return false; | 276 return false; |
| 269 | 277 |
| 270 return true; | 278 return true; |
| 271 } | 279 } |
| 272 | 280 |
| 273 const DisplayItemList* PictureLayer::GetDisplayItemList() { | 281 const DisplayItemList* PictureLayer::GetDisplayItemList() { |
| 274 return picture_layer_inputs_.display_list.get(); | 282 return picture_layer_inputs_.display_list.get(); |
| 275 } | 283 } |
| 276 | 284 |
| 277 } // namespace cc | 285 } // namespace cc |
| OLD | NEW |