Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1398)

Unified Diff: cc/trees/layer_tree_host_common_unittest.cc

Issue 2018983003: cc: Use FilterOperations::MapRect in RenderSurfaceImpl::DrawableContentRect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« cc/layers/render_surface_impl.cc ('K') | « cc/layers/render_surface_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2a2ca196f6278a3fd4e6a6584bc15eaa11e508b9..fa09f14f6eb73dbf56644d8c3dc67410f632afcb 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,33 @@ 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, RenderSurfaceForBlendMode) {
LayerImpl* parent = root_layer();
LayerImpl* child = AddChild<LayerImpl>(parent);
« cc/layers/render_surface_impl.cc ('K') | « cc/layers/render_surface_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698