| Index: cc/trees/layer_tree_host_common_unittest.cc
|
| diff --git a/cc/trees/layer_tree_host_common_unittest.cc b/cc/trees/layer_tree_host_common_unittest.cc
|
| index a115de7c112bf0eab1388ceed14c2e7eadd1211e..21ee55e32e4bb75fba2ae8a6c3e3f8e693b7ddec 100644
|
| --- a/cc/trees/layer_tree_host_common_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_common_unittest.cc
|
| @@ -46,6 +46,7 @@
|
| #include "cc/trees/task_runner_provider.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include "third_party/skia/include/effects/SkOffsetImageFilter.h"
|
| #include "ui/gfx/geometry/quad_f.h"
|
| #include "ui/gfx/geometry/vector2d_conversions.h"
|
| #include "ui/gfx/transform.h"
|
| @@ -1411,6 +1412,64 @@ TEST_F(LayerTreeHostCommonTest, RenderSurfaceListForFilter) {
|
| parent->render_surface()->DrawableContentRect());
|
| }
|
|
|
| +TEST_F(LayerTreeHostCommonTest, DrawableContentRectForReferenceFilter) {
|
| + LayerImpl* root = root_layer();
|
| + LayerImpl* child = AddChild<LayerImpl>(root);
|
| + child->SetDrawsContent(true);
|
| +
|
| + SetLayerPropertiesForTesting(root, gfx::Transform(), gfx::Point3F(),
|
| + gfx::PointF(), gfx::Size(100, 100), true, false,
|
| + true);
|
| + SetLayerPropertiesForTesting(child, gfx::Transform(), gfx::Point3F(),
|
| + gfx::PointF(), gfx::Size(25, 25), true, false,
|
| + true);
|
| +
|
| + FilterOperations filters;
|
| + filters.Append(FilterOperation::CreateReferenceFilter(
|
| + SkOffsetImageFilter::Make(50, 50, nullptr)));
|
| + child->SetFilters(filters);
|
| +
|
| + ExecuteCalculateDrawProperties(root);
|
| +
|
| + // The render surface's size should be unaffected by the offset image filter;
|
| + // it need only have a drawable content rect large enough to contain the
|
| + // contents (at the new offset).
|
| + ASSERT_TRUE(child->render_surface());
|
| + EXPECT_EQ(gfx::RectF(50, 50, 25, 25),
|
| + child->render_surface()->DrawableContentRect());
|
| +}
|
| +
|
| +TEST_F(LayerTreeHostCommonTest, DrawableContentRectForReferenceFilterHighDpi) {
|
| + const float device_scale_factor = 2.0f;
|
| +
|
| + LayerImpl* root = root_layer();
|
| + root->layer_tree_impl()->SetDeviceScaleFactor(device_scale_factor);
|
| + LayerImpl* child = AddChild<LayerImpl>(root);
|
| + child->SetDrawsContent(true);
|
| +
|
| + SetLayerPropertiesForTesting(root, gfx::Transform(), gfx::Point3F(),
|
| + gfx::PointF(), gfx::Size(100, 100), true, false,
|
| + true);
|
| + SetLayerPropertiesForTesting(child, gfx::Transform(), gfx::Point3F(),
|
| + gfx::PointF(), gfx::Size(25, 25), true, false,
|
| + true);
|
| +
|
| + FilterOperations filters;
|
| + filters.Append(FilterOperation::CreateReferenceFilter(
|
| + SkOffsetImageFilter::Make(50, 50, nullptr)));
|
| + child->SetFilters(filters);
|
| +
|
| + ExecuteCalculateDrawProperties(root, device_scale_factor);
|
| +
|
| + // The render surface's size should be unaffected by the offset image filter;
|
| + // it need only have a drawable content rect large enough to contain the
|
| + // contents (at the new offset). All coordinates should be scaled by 2,
|
| + // corresponding to the device scale factor.
|
| + ASSERT_TRUE(child->render_surface());
|
| + EXPECT_EQ(gfx::RectF(100, 100, 50, 50),
|
| + child->render_surface()->DrawableContentRect());
|
| +}
|
| +
|
| TEST_F(LayerTreeHostCommonTest, RenderSurfaceForBlendMode) {
|
| LayerImpl* parent = root_layer();
|
| LayerImpl* child = AddChild<LayerImpl>(parent);
|
|
|