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

Unified Diff: cc/output/renderer_pixeltest.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/output/overlay_unittest.cc ('k') | cc/output/software_renderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/renderer_pixeltest.cc
diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc
index 56a3d0db991be2137e1e496202459da26c39cc9e..d9decc1c7b59abf34739d5444277c6e27d800ac2 100644
--- a/cc/output/renderer_pixeltest.cc
+++ b/cc/output/renderer_pixeltest.cc
@@ -97,13 +97,11 @@ void CreateTestRenderPassDrawQuad(const SharedQuadState* shared_state,
RenderPassDrawQuad* quad =
render_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
quad->SetNew(shared_state, rect, rect, pass_id,
- 0, // mask_resource_id
- gfx::Vector2dF(), // mask_uv_scale
- gfx::Size(), // mask_texture_size
- FilterOperations(), // foreground filters
- gfx::Vector2dF(), // filters scale
- gfx::PointF(), // filter origin
- FilterOperations()); // background filters
+ 0, // mask_resource_id
+ gfx::Vector2dF(), // mask_uv_scale
+ gfx::Size(), // mask_texture_size
+ gfx::Vector2dF(), // filters scale
+ gfx::PointF()); // filter origin
}
void CreateTestTwoColoredTextureDrawQuad(const gfx::Rect& rect,
@@ -1480,8 +1478,30 @@ TYPED_TEST(RendererPixelTest, FastPassColorFilterAlpha) {
int child_pass_id = 2;
gfx::Rect pass_rect(this->device_viewport_size_);
gfx::Transform transform_to_root;
+ SkScalar matrix[20];
+ float amount = 0.5f;
+ matrix[0] = 0.213f + 0.787f * amount;
+ matrix[1] = 0.715f - 0.715f * amount;
+ matrix[2] = 1.f - (matrix[0] + matrix[1]);
+ matrix[3] = matrix[4] = 0;
+ matrix[5] = 0.213f - 0.213f * amount;
+ matrix[6] = 0.715f + 0.285f * amount;
+ matrix[7] = 1.f - (matrix[5] + matrix[6]);
+ matrix[8] = matrix[9] = 0;
+ matrix[10] = 0.213f - 0.213f * amount;
+ matrix[11] = 0.715f - 0.715f * amount;
+ matrix[12] = 1.f - (matrix[10] + matrix[11]);
+ matrix[13] = matrix[14] = 0;
+ matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
+ matrix[18] = 1;
+ FilterOperations filters;
+ filters.Append(
+ FilterOperation::CreateReferenceFilter(SkColorFilterImageFilter::Make(
+ SkColorFilter::MakeMatrixFilterRowMajor255(matrix), nullptr)));
+
std::unique_ptr<RenderPass> child_pass =
CreateTestRenderPass(child_pass_id, pass_rect, transform_to_root);
+ child_pass->filters = filters;
gfx::Transform quad_to_target_transform;
SharedQuadState* shared_state = CreateTestSharedQuadState(
@@ -1514,33 +1534,11 @@ TYPED_TEST(RendererPixelTest, FastPassColorFilterAlpha) {
SharedQuadState* pass_shared_state =
CreateTestSharedQuadState(gfx::Transform(), pass_rect, root_pass.get());
- SkScalar matrix[20];
- float amount = 0.5f;
- matrix[0] = 0.213f + 0.787f * amount;
- matrix[1] = 0.715f - 0.715f * amount;
- matrix[2] = 1.f - (matrix[0] + matrix[1]);
- matrix[3] = matrix[4] = 0;
- matrix[5] = 0.213f - 0.213f * amount;
- matrix[6] = 0.715f + 0.285f * amount;
- matrix[7] = 1.f - (matrix[5] + matrix[6]);
- matrix[8] = matrix[9] = 0;
- matrix[10] = 0.213f - 0.213f * amount;
- matrix[11] = 0.715f - 0.715f * amount;
- matrix[12] = 1.f - (matrix[10] + matrix[11]);
- matrix[13] = matrix[14] = 0;
- matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
- matrix[18] = 1;
- FilterOperations filters;
- filters.Append(
- FilterOperation::CreateReferenceFilter(SkColorFilterImageFilter::Make(
- SkColorFilter::MakeMatrixFilterRowMajor255(matrix), nullptr)));
-
RenderPassDrawQuad* render_pass_quad =
root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
render_pass_quad->SetNew(pass_shared_state, pass_rect, pass_rect,
child_pass_id, 0, gfx::Vector2dF(), gfx::Size(),
- filters, gfx::Vector2dF(), gfx::PointF(),
- FilterOperations());
+ gfx::Vector2dF(), gfx::PointF());
RenderPassList pass_list;
pass_list.push_back(std::move(child_pass));
@@ -1564,8 +1562,12 @@ TYPED_TEST(RendererPixelTest, FastPassSaturateFilter) {
int child_pass_id = 2;
gfx::Rect pass_rect(this->device_viewport_size_);
gfx::Transform transform_to_root;
+ FilterOperations filters;
+ filters.Append(FilterOperation::CreateSaturateFilter(0.5f));
+
std::unique_ptr<RenderPass> child_pass =
CreateTestRenderPass(child_pass_id, pass_rect, transform_to_root);
+ child_pass->filters = filters;
gfx::Transform quad_to_target_transform;
SharedQuadState* shared_state = CreateTestSharedQuadState(
@@ -1598,15 +1600,11 @@ TYPED_TEST(RendererPixelTest, FastPassSaturateFilter) {
SharedQuadState* pass_shared_state =
CreateTestSharedQuadState(gfx::Transform(), pass_rect, root_pass.get());
- FilterOperations filters;
- filters.Append(FilterOperation::CreateSaturateFilter(0.5f));
-
RenderPassDrawQuad* render_pass_quad =
root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
render_pass_quad->SetNew(pass_shared_state, pass_rect, pass_rect,
child_pass_id, 0, gfx::Vector2dF(), gfx::Size(),
- filters, gfx::Vector2dF(), gfx::PointF(),
- FilterOperations());
+ gfx::Vector2dF(), gfx::PointF());
RenderPassList pass_list;
pass_list.push_back(std::move(child_pass));
@@ -1629,8 +1627,13 @@ TYPED_TEST(RendererPixelTest, FastPassFilterChain) {
int child_pass_id = 2;
gfx::Rect pass_rect(this->device_viewport_size_);
gfx::Transform transform_to_root;
+ FilterOperations filters;
+ filters.Append(FilterOperation::CreateGrayscaleFilter(1.f));
+ filters.Append(FilterOperation::CreateBrightnessFilter(0.5f));
+
std::unique_ptr<RenderPass> child_pass =
CreateTestRenderPass(child_pass_id, pass_rect, transform_to_root);
+ child_pass->filters = filters;
gfx::Transform quad_to_target_transform;
SharedQuadState* shared_state = CreateTestSharedQuadState(
@@ -1663,16 +1666,11 @@ TYPED_TEST(RendererPixelTest, FastPassFilterChain) {
SharedQuadState* pass_shared_state =
CreateTestSharedQuadState(gfx::Transform(), pass_rect, root_pass.get());
- FilterOperations filters;
- filters.Append(FilterOperation::CreateGrayscaleFilter(1.f));
- filters.Append(FilterOperation::CreateBrightnessFilter(0.5f));
-
RenderPassDrawQuad* render_pass_quad =
root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
render_pass_quad->SetNew(pass_shared_state, pass_rect, pass_rect,
child_pass_id, 0, gfx::Vector2dF(), gfx::Size(),
- filters, gfx::Vector2dF(), gfx::PointF(),
- FilterOperations());
+ gfx::Vector2dF(), gfx::PointF());
RenderPassList pass_list;
pass_list.push_back(std::move(child_pass));
@@ -1696,8 +1694,33 @@ TYPED_TEST(RendererPixelTest, FastPassColorFilterAlphaTranslation) {
int child_pass_id = 2;
gfx::Rect pass_rect(this->device_viewport_size_);
gfx::Transform transform_to_root;
+ SkScalar matrix[20];
+ float amount = 0.5f;
+ matrix[0] = 0.213f + 0.787f * amount;
+ matrix[1] = 0.715f - 0.715f * amount;
+ matrix[2] = 1.f - (matrix[0] + matrix[1]);
+ matrix[3] = 0;
+ matrix[4] = 20.f;
+ matrix[5] = 0.213f - 0.213f * amount;
+ matrix[6] = 0.715f + 0.285f * amount;
+ matrix[7] = 1.f - (matrix[5] + matrix[6]);
+ matrix[8] = 0;
+ matrix[9] = 200.f;
+ matrix[10] = 0.213f - 0.213f * amount;
+ matrix[11] = 0.715f - 0.715f * amount;
+ matrix[12] = 1.f - (matrix[10] + matrix[11]);
+ matrix[13] = 0;
+ matrix[14] = 1.5f;
+ matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
+ matrix[18] = 1;
+ FilterOperations filters;
+ filters.Append(
+ FilterOperation::CreateReferenceFilter(SkColorFilterImageFilter::Make(
+ SkColorFilter::MakeMatrixFilterRowMajor255(matrix), nullptr)));
+
std::unique_ptr<RenderPass> child_pass =
CreateTestRenderPass(child_pass_id, pass_rect, transform_to_root);
+ child_pass->filters = filters;
gfx::Transform quad_to_target_transform;
SharedQuadState* shared_state = CreateTestSharedQuadState(
@@ -1730,36 +1753,11 @@ TYPED_TEST(RendererPixelTest, FastPassColorFilterAlphaTranslation) {
SharedQuadState* pass_shared_state =
CreateTestSharedQuadState(gfx::Transform(), pass_rect, root_pass.get());
- SkScalar matrix[20];
- float amount = 0.5f;
- matrix[0] = 0.213f + 0.787f * amount;
- matrix[1] = 0.715f - 0.715f * amount;
- matrix[2] = 1.f - (matrix[0] + matrix[1]);
- matrix[3] = 0;
- matrix[4] = 20.f;
- matrix[5] = 0.213f - 0.213f * amount;
- matrix[6] = 0.715f + 0.285f * amount;
- matrix[7] = 1.f - (matrix[5] + matrix[6]);
- matrix[8] = 0;
- matrix[9] = 200.f;
- matrix[10] = 0.213f - 0.213f * amount;
- matrix[11] = 0.715f - 0.715f * amount;
- matrix[12] = 1.f - (matrix[10] + matrix[11]);
- matrix[13] = 0;
- matrix[14] = 1.5f;
- matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
- matrix[18] = 1;
- FilterOperations filters;
- filters.Append(
- FilterOperation::CreateReferenceFilter(SkColorFilterImageFilter::Make(
- SkColorFilter::MakeMatrixFilterRowMajor255(matrix), nullptr)));
-
RenderPassDrawQuad* render_pass_quad =
root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
render_pass_quad->SetNew(pass_shared_state, pass_rect, pass_rect,
child_pass_id, 0, gfx::Vector2dF(), gfx::Size(),
- filters, gfx::Vector2dF(), gfx::PointF(),
- FilterOperations());
+ gfx::Vector2dF(), gfx::PointF());
RenderPassList pass_list;
@@ -1956,10 +1954,8 @@ TYPED_TEST(RendererPixelTest, RenderPassAndMaskWithPartialQuad) {
gfx::Vector2dF(2.f / mask_rect.width(),
2.f / mask_rect.height()), // mask_uv_scale
gfx::Size(mask_rect.size()), // mask_texture_size
- FilterOperations(), // foreground filters
gfx::Vector2dF(), // filters scale
- gfx::PointF(), // filter origin
- FilterOperations()); // background filters
+ gfx::PointF()); // filter origin
// White background behind the masked render pass.
SolidColorDrawQuad* white =
@@ -2051,10 +2047,8 @@ TYPED_TEST(RendererPixelTest, RenderPassAndMaskWithPartialQuad2) {
gfx::Vector2dF(2.f / mask_rect.width(),
2.f / mask_rect.height()), // mask_uv_scale
gfx::Size(mask_rect.size()), // mask_texture_size
- FilterOperations(), // foreground filters
gfx::Vector2dF(), // filters scale
- gfx::PointF(), // filter origin
- FilterOperations()); // background filters
+ gfx::PointF()); // filter origin
// White background behind the masked render pass.
SolidColorDrawQuad* white =
@@ -2089,6 +2083,7 @@ class RendererPixelTestWithBackgroundFilter
gfx::Transform transform_to_root;
std::unique_ptr<RenderPass> filter_pass = CreateTestRenderPass(
filter_pass_id, filter_pass_layer_rect_, transform_to_root);
+ filter_pass->background_filters = this->background_filters_;
// A non-visible quad in the filtering render pass.
{
@@ -2112,10 +2107,8 @@ class RendererPixelTestWithBackgroundFilter
0, // mask_resource_id
gfx::Vector2dF(), // mask_uv_scale
gfx::Size(), // mask_texture_size
- FilterOperations(), // filters
gfx::Vector2dF(1.0f, 1.0f), // filters_scale
- gfx::PointF(), // filters_origin
- this->background_filters_);
+ gfx::PointF()); // filters_origin
}
const int kColumnWidth = device_viewport_rect.width() / 3;
« no previous file with comments | « cc/output/overlay_unittest.cc ('k') | cc/output/software_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698