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

Unified Diff: src/effects/SkXfermodeImageFilter.cpp

Issue 1334293003: Create fragment processor for performing input color blend with child processor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 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
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/gpu/GrBlend.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkXfermodeImageFilter.cpp
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 9ffbe62bdc9c76358ac0f407191d3c0b7d743735..e357b0f23d20268b24b9ac8dd03371768a61e13e 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -16,6 +16,7 @@
#include "GrContext.h"
#include "GrDrawContext.h"
#include "effects/GrTextureDomain.h"
+#include "effects/GrSimpleTextureEffect.h"
#include "SkGr.h"
#endif
@@ -153,7 +154,7 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
GrTexture* foregroundTex = foreground.getTexture();
GrContext* context = foregroundTex->getContext();
- GrFragmentProcessor* xferProcessor = nullptr;
+ const GrFragmentProcessor* xferFP = nullptr;
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
@@ -166,8 +167,11 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
}
GrPaint paint;
- if (!fMode || !fMode->asFragmentProcessor(&xferProcessor, paint.getProcessorDataManager(),
- backgroundTex)) {
+ SkMatrix bgMatrix;
+ bgMatrix.setIDiv(backgroundTex->width(), backgroundTex->height());
+ SkAutoTUnref<const GrFragmentProcessor> bgFP(
+ GrSimpleTextureEffect::Create(paint.getProcessorDataManager(), backgroundTex, bgMatrix));
+ if (!fMode || !fMode->asFragmentProcessor(&xferFP, paint.getProcessorDataManager(), bgFP)) {
// canFilterImageGPU() should've taken care of this
SkASSERT(false);
return false;
@@ -190,7 +194,9 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
);
paint.addColorFragmentProcessor(foregroundDomain.get());
- paint.addColorFragmentProcessor(xferProcessor)->unref();
+ if (xferFP) {
+ paint.addColorFragmentProcessor(xferFP)->unref();
+ }
SkAutoTUnref<GrDrawContext> drawContext(context->drawContext());
if (!drawContext) {
« no previous file with comments | « src/effects/SkTableColorFilter.cpp ('k') | src/gpu/GrBlend.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698