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

Side by Side Diff: src/effects/SkXfermodeImageFilter.cpp

Issue 1393283008: Image filters: refactor input GPU processing into filterInputGPU(). (Closed) Base URL: https://skia.googlesource.com/skia.git@filter-input
Patch Set: Update to ToT Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The Android Open Source Project 2 * Copyright 2013 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkXfermodeImageFilter.h" 8 #include "SkXfermodeImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return fMode && fMode->asFragmentProcessor(nullptr, nullptr) && !cropRectIsS et(); 123 return fMode && fMode->asFragmentProcessor(nullptr, nullptr) && !cropRectIsS et();
124 } 124 }
125 125
126 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, 126 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
127 const SkBitmap& src, 127 const SkBitmap& src,
128 const Context& ctx, 128 const Context& ctx,
129 SkBitmap* result, 129 SkBitmap* result,
130 SkIPoint* offset) const { 130 SkIPoint* offset) const {
131 SkBitmap background = src; 131 SkBitmap background = src;
132 SkIPoint backgroundOffset = SkIPoint::Make(0, 0); 132 SkIPoint backgroundOffset = SkIPoint::Make(0, 0);
133 if (this->getInput(0) && 133 if (!this->filterInputGPU(0, proxy, src, ctx, &background, &backgroundOffset )) {
134 !this->getInput(0)->getInputResultGPU(proxy, src, ctx, &background, &bac kgroundOffset)) {
135 return false; 134 return false;
136 } 135 }
137 136
138 GrTexture* backgroundTex = background.getTexture(); 137 GrTexture* backgroundTex = background.getTexture();
139 if (nullptr == backgroundTex) { 138 if (nullptr == backgroundTex) {
140 SkASSERT(false); 139 SkASSERT(false);
141 return false; 140 return false;
142 } 141 }
143 142
144 SkBitmap foreground = src; 143 SkBitmap foreground = src;
145 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); 144 SkIPoint foregroundOffset = SkIPoint::Make(0, 0);
146 if (this->getInput(1) && 145 if (!this->filterInputGPU(1, proxy, src, ctx, &foreground, &foregroundOffset )) {
147 !this->getInput(1)->getInputResultGPU(proxy, src, ctx, &foreground, &for egroundOffset)) {
148 return false; 146 return false;
149 } 147 }
150 GrTexture* foregroundTex = foreground.getTexture(); 148 GrTexture* foregroundTex = foreground.getTexture();
151 GrContext* context = foregroundTex->getContext(); 149 GrContext* context = foregroundTex->getContext();
152 150
153 const GrFragmentProcessor* xferFP = nullptr; 151 const GrFragmentProcessor* xferFP = nullptr;
154 152
155 GrSurfaceDesc desc; 153 GrSurfaceDesc desc;
156 desc.fFlags = kRenderTarget_GrSurfaceFlag; 154 desc.fFlags = kRenderTarget_GrSurfaceFlag;
157 desc.fWidth = src.width(); 155 desc.fWidth = src.width();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), srcRect); 199 drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), srcRect);
202 200
203 offset->fX = backgroundOffset.fX; 201 offset->fX = backgroundOffset.fX;
204 offset->fY = backgroundOffset.fY; 202 offset->fY = backgroundOffset.fY;
205 WrapTexture(dst, src.width(), src.height(), result); 203 WrapTexture(dst, src.width(), src.height(), result);
206 return true; 204 return true;
207 } 205 }
208 206
209 #endif 207 #endif
210 208
OLDNEW
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698