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

Unified Diff: src/gpu/GrPipeline.cpp

Issue 1471053002: Don't create a GXPFactory when blend is SrcOver (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 5 years, 1 month 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: src/gpu/GrPipeline.cpp
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 073349be1ed900062964098d85773e416eedd75b..f8e750d340d897dbecbececbe058095ab6a6dacb 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -21,10 +21,17 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
const GrPipelineBuilder& builder = *args.fPipelineBuilder;
// Create XferProcessor from DS's XPFactory
- SkAutoTUnref<GrXferProcessor> xferProcessor(
- builder.getXPFactory()->createXferProcessor(args.fColorPOI, args.fCoveragePOI,
- builder.hasMixedSamples(), &args.fDstTexture,
- *args.fCaps));
+ const GrXPFactory* xpFactory = builder.getXPFactory();
+ GrXferProcessor* xferProcessor;
bsalomon 2015/11/23 20:19:52 Why not SkAutoTUnref xferProcessor; if (xpFactory
egdaniel 2015/11/23 20:49:04 Done.
+ if (xpFactory) {
+ xferProcessor = xpFactory->createXferProcessor(args.fColorPOI, args.fCoveragePOI,
+ builder.hasMixedSamples(), &args.fDstTexture,
+ *args.fCaps);
+ } else {
+ xferProcessor = GrCreateSrcOverXferProcessor(*args.fCaps, args.fColorPOI, args.fCoveragePOI,
+ builder.hasMixedSamples(), &args.fDstTexture);
+ }
+
if (!xferProcessor) {
return nullptr;
}
@@ -46,6 +53,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
// so we must check the draw type. In cases where we will skip drawing we simply return a
// null GrPipeline.
if (GrXferProcessor::kSkipDraw_OptFlag & optFlags) {
+ xferProcessor->unref();
return nullptr;
}
@@ -55,7 +63,7 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
}
GrPipeline* pipeline = new (memory) GrPipeline;
- pipeline->fXferProcessor.reset(xferProcessor.get());
+ pipeline->fXferProcessor.reset(xferProcessor);
pipeline->fRenderTarget.reset(builder.fRenderTarget.get());
SkASSERT(pipeline->fRenderTarget);
@@ -123,11 +131,19 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args,
}
GrXPFactory::InvariantBlendedColor blendedColor;
- builder.fXPFactory->getInvariantBlendedColor(args.fColorPOI, &blendedColor);
+ if (xpFactory) {
+ xpFactory->getInvariantBlendedColor(args.fColorPOI, &blendedColor);
+ } else {
+ GrSrcOverInvariantBlendedColor(args.fColorPOI.color(),
+ args.fColorPOI.validFlags(),
+ args.fColorPOI.isOpaque(),
+ &blendedColor);
+ }
if (blendedColor.fWillBlendWithDst) {
opts->fFlags |= GrPipelineOptimizations::kWillColorBlendWithDst_Flag;
}
+ xferProcessor->unref();
return pipeline;
}
« src/core/SkXfermode.cpp ('K') | « src/gpu/GrPaint.cpp ('k') | src/gpu/GrPipelineBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698