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

Unified Diff: src/core/SkImageFilter.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkImageFilter.h ('k') | src/effects/SkBlurImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 9cadc3f920b097c13d093316d8d2faaa13cdc7e1..d7af4e65d0656c13572683b08a429c52f13f87ad 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -329,8 +329,7 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont
SkBitmap input = src;
SkASSERT(fInputCount == 1);
SkIPoint srcOffset = SkIPoint::Make(0, 0);
- if (this->getInput(0) &&
- !this->getInput(0)->getInputResultGPU(proxy, src, ctx, &input, &srcOffset)) {
+ if (!this->filterInputGPU(0, proxy, src, ctx, &input, &srcOffset)) {
return false;
}
GrTexture* srcTexture = input.getTexture();
@@ -466,18 +465,22 @@ void SkImageFilter::WrapTexture(GrTexture* texture, int width, int height, SkBit
result->setPixelRef(new SkGrPixelRef(info, texture))->unref();
}
-bool SkImageFilter::getInputResultGPU(SkImageFilter::Proxy* proxy,
- const SkBitmap& src, const Context& ctx,
- SkBitmap* result, SkIPoint* offset) const {
+bool SkImageFilter::filterInputGPU(int index, SkImageFilter::Proxy* proxy,
+ const SkBitmap& src, const Context& ctx,
+ SkBitmap* result, SkIPoint* offset) const {
+ SkImageFilter* input = this->getInput(index);
+ if (!input) {
+ return true;
+ }
// Ensure that GrContext calls under filterImage and filterImageGPU below will see an identity
// matrix with no clip and that the matrix, clip, and render target set before this function was
// called are restored before we return to the caller.
GrContext* context = src.getTexture()->getContext();
- if (this->canFilterImageGPU()) {
- return this->filterImageGPU(proxy, src, ctx, result, offset);
+ if (input->canFilterImageGPU()) {
+ return input->filterImageGPU(proxy, src, ctx, result, offset);
} else {
- if (this->filterImage(proxy, src, ctx, result, offset)) {
+ if (input->filterImage(proxy, src, ctx, result, offset)) {
if (!result->getTexture()) {
const SkImageInfo info = result->info();
if (kUnknown_SkColorType == info.colorType()) {
« no previous file with comments | « include/core/SkImageFilter.h ('k') | src/effects/SkBlurImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698