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

Unified Diff: cc/output/gl_renderer.cc

Issue 21154002: Add support for converting cc::FilterOperations into an SkImageFilter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nit Created 7 years, 3 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
Index: cc/output/gl_renderer.cc
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 3d6607c18fa19c8573752f1b58f0317c3884ce01..51f03ff3ff3329515dc5deb002eee3c589c92908 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -777,25 +777,31 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame,
SkBitmap filter_bitmap;
SkScalar color_matrix[20];
bool use_color_matrix = false;
- if (quad->filter) {
- skia::RefPtr<SkColorFilter> cf;
-
- {
- SkColorFilter* colorfilter_rawptr = NULL;
- quad->filter->asColorFilter(&colorfilter_rawptr);
- cf = skia::AdoptRef(colorfilter_rawptr);
- }
+ // TODO(ajuma): Always use RenderSurfaceFilters::BuildImageFilter, not just
+ // when we have a reference filter.
+ if (quad->filters.HasReferenceFilter()) {
+ skia::RefPtr<SkImageFilter> filter = RenderSurfaceFilters::BuildImageFilter(
+ quad->filters, contents_texture->size());
+ if (filter) {
+ skia::RefPtr<SkColorFilter> cf;
+
+ {
enne (OOO) 2013/09/11 17:57:24 style nit: this is a seemingly unnecessary block.
danakj 2013/09/11 18:02:46 This is to keep the raw pointer scoped and ensure
+ SkColorFilter* colorfilter_rawptr = NULL;
+ filter->asColorFilter(&colorfilter_rawptr);
+ cf = skia::AdoptRef(colorfilter_rawptr);
+ }
- if (cf && cf->asColorMatrix(color_matrix) && !quad->filter->getInput(0)) {
- // We have a single color matrix as a filter; apply it locally
- // in the compositor.
- use_color_matrix = true;
- } else {
- filter_bitmap = ApplyImageFilter(this,
- frame->offscreen_context_provider,
- quad->rect.origin(),
- quad->filter.get(),
- contents_texture);
+ if (cf && cf->asColorMatrix(color_matrix) && !filter->getInput(0)) {
+ // We have a single color matrix as a filter; apply it locally
+ // in the compositor.
+ use_color_matrix = true;
+ } else {
+ filter_bitmap = ApplyImageFilter(this,
+ frame->offscreen_context_provider,
+ quad->rect.origin(),
+ filter.get(),
+ contents_texture);
+ }
}
} else if (!quad->filters.IsEmpty()) {
FilterOperations optimized_filters =

Powered by Google App Engine
This is Rietveld 408576698