Don't create a GXPFactory when blend is SrcOver
BUG=skia:
Review URL: https://codereview.chromium.org/1471053002
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 348cdba..920e3c4 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -276,7 +276,6 @@
SkAutoTUnref<const GrFragmentProcessor> fp;
SkMatrix textureMatrix;
textureMatrix.setIDiv(tempTexture->width(), tempTexture->height());
- GrPaint paint;
if (applyPremulToSrc) {
fp.reset(this->createUPMToPMEffect(tempTexture, tempDrawInfo.fSwapRAndB,
textureMatrix));
@@ -324,7 +323,9 @@
if (!drawContext) {
return false;
}
+ GrPaint paint;
paint.addColorFragmentProcessor(fp);
+ paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
drawContext->drawRect(GrClip::WideOpen(), paint, matrix, rect, nullptr);
@@ -412,7 +413,6 @@
SkMatrix textureMatrix;
textureMatrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top));
textureMatrix.postIDiv(src->width(), src->height());
- GrPaint paint;
SkAutoTUnref<const GrFragmentProcessor> fp;
if (unpremul) {
fp.reset(this->createPMToUPMEffect(src->asTexture(), tempDrawInfo.fSwapRAndB,
@@ -430,7 +430,9 @@
GrConfigConversionEffect::kNone_PMConversion, textureMatrix));
}
if (fp) {
+ GrPaint paint;
paint.addColorFragmentProcessor(fp);
+ paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
SkRect rect = SkRect::MakeWH(SkIntToScalar(width), SkIntToScalar(height));
SkAutoTUnref<GrDrawContext> drawContext(this->drawContext(temp->asRenderTarget()));
drawContext->drawRect(GrClip::WideOpen(), paint, SkMatrix::I(), rect, nullptr);