summaryrefslogtreecommitdiffstats
path: root/cc/test/render_pass_test_utils.cc
diff options
context:
space:
mode:
authorclholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-26 22:47:24 +0000
committerclholgat@chromium.org <clholgat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-26 22:47:24 +0000
commit1ab91054908884d72b418b24e533dc02fc3dc46e (patch)
treef53fb0078a105ada06bb9a2eaaa3ebccdacfe87c /cc/test/render_pass_test_utils.cc
parent833c1dab9e02316e31804e3049169b7ceb5c6495 (diff)
downloadchromium_src-1ab91054908884d72b418b24e533dc02fc3dc46e.zip
chromium_src-1ab91054908884d72b418b24e533dc02fc3dc46e.tar.gz
chromium_src-1ab91054908884d72b418b24e533dc02fc3dc46e.tar.bz2
Optimize SkColorFilters when drawing RenderPassQuads
Pull the color transformation matrix from the SkImageFilter if possible and apply with a shader. Handles all permutations of shaders. BUG=168719 Review URL: https://chromiumcodereview.appspot.com/12803003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190786 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/render_pass_test_utils.cc')
-rw-r--r--cc/test/render_pass_test_utils.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc
index 94d0f64..24cb778 100644
--- a/cc/test/render_pass_test_utils.cc
+++ b/cc/test/render_pass_test_utils.cc
@@ -9,6 +9,7 @@
#include "cc/quads/render_pass_draw_quad.h"
#include "cc/quads/shared_quad_state.h"
#include "cc/quads/solid_color_draw_quad.h"
+#include "cc/resources/resource_provider.h"
#include "cc/test/mock_quad_culler.h"
#include "cc/test/render_pass_test_common.h"
#include "ui/gfx/rect.h"
@@ -73,4 +74,25 @@ void AddRenderPassQuad(TestRenderPass* to_pass,
quad_sink.Append(quad.PassAs<DrawQuad>(), &data);
}
+void AddRenderPassQuad(TestRenderPass* to_pass,
+ TestRenderPass* contributing_pass,
+ ResourceProvider::ResourceId mask_resource_id,
+ skia::RefPtr<SkImageFilter> filter,
+ gfx::Transform transform) {
+ MockQuadCuller quad_sink(&to_pass->quad_list,
+ &to_pass->shared_quad_state_list);
+ AppendQuadsData data(to_pass->id);
+ gfx::Rect output_rect = contributing_pass->output_rect;
+ SharedQuadState* shared_state =
+ quad_sink.UseSharedQuadState(SharedQuadState::Create());
+ shared_state->SetAll(
+ transform, output_rect.size(), output_rect, output_rect, false, 1);
+ scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create();
+ quad->SetNew(shared_state, output_rect, contributing_pass->id, false,
+ mask_resource_id, output_rect, gfx::RectF(),
+ WebKit::WebFilterOperations(),
+ filter, WebKit::WebFilterOperations());
+ quad_sink.Append(quad.PassAs<DrawQuad>(), &data);
+}
+
} // namespace cc