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

Unified Diff: cc/quads/render_pass_unittest.cc

Issue 2543473004: cc: Move filters from RenderPassDrawQuad to RenderPass (Closed)
Patch Set: Rebase again Created 4 years 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
« no previous file with comments | « cc/quads/render_pass_draw_quad.cc ('k') | cc/surfaces/surface_aggregator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/quads/render_pass_unittest.cc
diff --git a/cc/quads/render_pass_unittest.cc b/cc/quads/render_pass_unittest.cc
index ba4e9ad17d51a0c7c69e4d46fed4a2a5b439259c..3854471e82e2bfa958dfd818bd918f570ae96675 100644
--- a/cc/quads/render_pass_unittest.cc
+++ b/cc/quads/render_pass_unittest.cc
@@ -23,13 +23,15 @@ struct RenderPassSize {
// If you add a new field to this class, make sure to add it to the
// Copy() tests.
int id;
- QuadList quad_list;
- SharedQuadStateList shared_quad_state_list;
- gfx::Transform transform_to_root_target;
gfx::Rect output_rect;
gfx::Rect damage_rect;
+ gfx::Transform transform_to_root_target;
+ FilterOperations filters;
+ FilterOperations background_filters;
bool has_transparent_background;
std::vector<std::unique_ptr<CopyOutputRequest>> copy_callbacks;
+ QuadList quad_list;
+ SharedQuadStateList shared_quad_state_list;
};
static void CompareRenderPassLists(const RenderPassList& expected_list,
@@ -44,6 +46,8 @@ static void CompareRenderPassLists(const RenderPassList& expected_list,
EXPECT_EQ(expected->transform_to_root_target,
actual->transform_to_root_target);
EXPECT_EQ(expected->damage_rect, actual->damage_rect);
+ EXPECT_EQ(expected->filters, actual->filters);
+ EXPECT_EQ(expected->background_filters, expected->background_filters);
EXPECT_EQ(expected->has_transparent_background,
actual->has_transparent_background);
@@ -68,14 +72,15 @@ TEST(RenderPassTest, CopyShouldBeIdenticalExceptIdAndQuads) {
gfx::Transform transform_to_root =
gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0);
gfx::Rect damage_rect(56, 123, 19, 43);
+ FilterOperations filters;
+ filters.Append(FilterOperation::CreateOpacityFilter(0.5));
+ FilterOperations background_filters;
+ background_filters.Append(FilterOperation::CreateInvertFilter(1.0));
bool has_transparent_background = true;
std::unique_ptr<RenderPass> pass = RenderPass::Create();
- pass->SetAll(id,
- output_rect,
- damage_rect,
- transform_to_root,
- has_transparent_background);
+ pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters,
+ background_filters, has_transparent_background);
pass->copy_requests.push_back(CopyOutputRequest::CreateEmptyRequest());
// Stick a quad in the pass, this should not get copied.
@@ -95,6 +100,8 @@ TEST(RenderPassTest, CopyShouldBeIdenticalExceptIdAndQuads) {
EXPECT_EQ(pass->output_rect, copy->output_rect);
EXPECT_EQ(pass->transform_to_root_target, copy->transform_to_root_target);
EXPECT_EQ(pass->damage_rect, copy->damage_rect);
+ EXPECT_EQ(pass->filters, copy->filters);
+ EXPECT_EQ(pass->background_filters, copy->background_filters);
EXPECT_EQ(pass->has_transparent_background, copy->has_transparent_background);
EXPECT_EQ(0u, copy->quad_list.size());
@@ -113,14 +120,15 @@ TEST(RenderPassTest, CopyAllShouldBeIdentical) {
gfx::Transform transform_to_root =
gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0);
gfx::Rect damage_rect(56, 123, 19, 43);
+ FilterOperations filters;
+ filters.Append(FilterOperation::CreateOpacityFilter(0.5));
+ FilterOperations background_filters;
+ background_filters.Append(FilterOperation::CreateInvertFilter(1.0));
bool has_transparent_background = true;
std::unique_ptr<RenderPass> pass = RenderPass::Create();
- pass->SetAll(id,
- output_rect,
- damage_rect,
- transform_to_root,
- has_transparent_background);
+ pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters,
+ background_filters, has_transparent_background);
// Two quads using one shared state.
SharedQuadState* shared_state1 = pass->CreateAndAppendSharedQuadState();
@@ -162,13 +170,16 @@ TEST(RenderPassTest, CopyAllShouldBeIdentical) {
gfx::Transform contrib_transform_to_root =
gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0);
gfx::Rect contrib_damage_rect(11, 16, 10, 15);
+ FilterOperations contrib_filters;
+ contrib_filters.Append(FilterOperation::CreateSepiaFilter(0.5));
+ FilterOperations contrib_background_filters;
+ contrib_background_filters.Append(FilterOperation::CreateSaturateFilter(1));
bool contrib_has_transparent_background = true;
std::unique_ptr<RenderPass> contrib = RenderPass::Create();
- contrib->SetAll(contrib_id,
- contrib_output_rect,
- contrib_damage_rect,
- contrib_transform_to_root,
+ contrib->SetAll(contrib_id, contrib_output_rect, contrib_damage_rect,
+ contrib_transform_to_root, contrib_filters,
+ contrib_background_filters,
contrib_has_transparent_background);
SharedQuadState* contrib_shared_state =
@@ -187,8 +198,7 @@ TEST(RenderPassTest, CopyAllShouldBeIdentical) {
base::WrapUnique(new RenderPassDrawQuad);
pass_quad->SetNew(pass->shared_quad_state_list.back(), contrib_output_rect,
contrib_output_rect, contrib_id, 0, gfx::Vector2dF(),
- gfx::Size(), FilterOperations(), gfx::Vector2dF(),
- gfx::PointF(), FilterOperations());
+ gfx::Size(), gfx::Vector2dF(), gfx::PointF());
pass_list.push_back(std::move(pass));
pass_list.push_back(std::move(contrib));
@@ -208,14 +218,15 @@ TEST(RenderPassTest, CopyAllWithCulledQuads) {
gfx::Transform transform_to_root =
gfx::Transform(1.0, 0.5, 0.5, -0.5, -1.0, 0.0);
gfx::Rect damage_rect(56, 123, 19, 43);
+ FilterOperations filters;
+ filters.Append(FilterOperation::CreateOpacityFilter(0.5));
+ FilterOperations background_filters;
+ background_filters.Append(FilterOperation::CreateInvertFilter(1.0));
bool has_transparent_background = true;
std::unique_ptr<RenderPass> pass = RenderPass::Create();
- pass->SetAll(id,
- output_rect,
- damage_rect,
- transform_to_root,
- has_transparent_background);
+ pass->SetAll(id, output_rect, damage_rect, transform_to_root, filters,
+ background_filters, has_transparent_background);
// A shared state with a quad.
SharedQuadState* shared_state1 = pass->CreateAndAppendSharedQuadState();
« no previous file with comments | « cc/quads/render_pass_draw_quad.cc ('k') | cc/surfaces/surface_aggregator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698