| Index: cc/layers/picture_layer.cc
|
| diff --git a/cc/layers/picture_layer.cc b/cc/layers/picture_layer.cc
|
| index 8ed4c8b768a36055971a4d5a1da27b8d7efeadf8..27ec2d57c1a6f8c7202fd4ad35f51a359b69cb08 100644
|
| --- a/cc/layers/picture_layer.cc
|
| +++ b/cc/layers/picture_layer.cc
|
| @@ -16,6 +16,7 @@
|
| #include "cc/proto/layer.pb.h"
|
| #include "cc/trees/layer_tree_host.h"
|
| #include "cc/trees/layer_tree_impl.h"
|
| +#include "cc/trees/transform_node.h"
|
| #include "third_party/skia/include/core/SkPictureRecorder.h"
|
| #include "ui/gfx/geometry/rect_conversions.h"
|
|
|
| @@ -59,6 +60,7 @@ void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) {
|
| DropRecordingSourceContentIfInvalid();
|
|
|
| layer_impl->SetNearestNeighbor(picture_layer_inputs_.nearest_neighbor);
|
| + layer_impl->SetUseTransformedRasterization(UseTransformedRasterization());
|
|
|
| // Preserve lcd text settings from the current raster source.
|
| bool can_use_lcd_text = layer_impl->RasterSourceUsesLCDText();
|
| @@ -198,6 +200,14 @@ void PictureLayer::SetNearestNeighbor(bool nearest_neighbor) {
|
| SetNeedsCommit();
|
| }
|
|
|
| +void PictureLayer::SetAllowTransformedRasterization(bool allowed) {
|
| + if (picture_layer_inputs_.allow_transformed_rasterization == allowed)
|
| + return;
|
| +
|
| + picture_layer_inputs_.allow_transformed_rasterization = allowed;
|
| + SetNeedsCommit();
|
| +}
|
| +
|
| bool PictureLayer::HasDrawableContent() const {
|
| return picture_layer_inputs_.client && Layer::HasDrawableContent();
|
| }
|
| @@ -262,6 +272,27 @@ void PictureLayer::DropRecordingSourceContentIfInvalid() {
|
| }
|
| }
|
|
|
| +bool PictureLayer::UseTransformedRasterization() const {
|
| + if (!picture_layer_inputs_.allow_transformed_rasterization)
|
| + return false;
|
| +
|
| + const TransformTree &transform_tree = GetLayerTree()->property_trees()->transform_tree;
|
| + DCHECK(!transform_tree.needs_update());
|
| + if (transform_tree.Node(transform_tree_index())->to_screen_is_potentially_animated)
|
| + return false;
|
| +
|
| + const gfx::Transform& to_screen = transform_tree.ToScreen(transform_tree_index());
|
| + if (!to_screen.IsScaleOrTranslation())
|
| + return false;
|
| +
|
| + float origin_x = to_screen.matrix().getFloat(0, 3) + offset_to_transform_parent().x();
|
| + float origin_y = to_screen.matrix().getFloat(1, 3) + offset_to_transform_parent().y();
|
| + if (origin_x - floorf(origin_x) == 0.f && origin_y - floorf(origin_y) == 0.f)
|
| + return false;
|
| +
|
| + return true;
|
| +}
|
| +
|
| const DisplayItemList* PictureLayer::GetDisplayItemList() {
|
| return picture_layer_inputs_.display_list.get();
|
| }
|
|
|