diff options
author | 2017-02-24 11:01:15 -0500 | |
---|---|---|
committer | 2017-02-24 18:39:58 +0000 | |
commit | b5cb6835c449c1c292b1ab124691a45d3d113694 (patch) | |
tree | e8d7a6f0867797f092a46f069c52192c40a418c4 /src/gpu/GrPipeline.h | |
parent | fd8f4d502d7c7e861de7b361c8e13aacfbc49fb2 (diff) |
Use construct/init pattern with GrPipeline to replace CreateAt.
Change-Id: Ic6c7432a9a298a143ce4f2431e94c89a0ea79793
Reviewed-on: https://skia-review.googlesource.com/8938
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrPipeline.h')
-rw-r--r-- | src/gpu/GrPipeline.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h index a9d34aea9c..7f2ac79b4f 100644 --- a/src/gpu/GrPipeline.h +++ b/src/gpu/GrPipeline.h @@ -55,27 +55,36 @@ public: kSnapVerticesToPixelCenters_Flag = 0x2, }; - struct CreateArgs { + struct InitArgs { uint32_t fFlags = 0; GrDrawFace fDrawFace = GrDrawFace::kBoth; const GrProcessorSet* fProcessors = nullptr; const GrProcessorSet::FragmentProcessorAnalysis* fAnalysis; const GrUserStencilSettings* fUserStencil = &GrUserStencilSettings::kUnused; - GrAppliedClip* fAppliedClip = nullptr; + const GrAppliedClip* fAppliedClip = nullptr; GrRenderTarget* fRenderTarget = nullptr; const GrCaps* fCaps = nullptr; GrXferProcessor::DstTexture fDstTexture; }; - /** Creates a pipeline into a pre-allocated buffer */ - static GrPipeline* CreateAt(void* memory, const CreateArgs&, GrPipelineOptimizations*); + /** + * A Default constructed pipeline is unusable until init() is called. + **/ + GrPipeline() = default; /** * Creates a simple pipeline with default settings and no processors. The provided blend mode - * must be "Porter Duff" (<= kLastCoeffMode). + * must be "Porter Duff" (<= kLastCoeffMode). This pipeline is initialized without requiring + * a call to init(). **/ GrPipeline(GrRenderTarget*, SkBlendMode); + /** (Re)initializes a pipeline. After initialization the pipeline can be used. */ + GrPipelineOptimizations init(const InitArgs&); + + /** True if the pipeline has been initialized. */ + bool isInitialized() const { return SkToBool(fRenderTarget.get()); } + /// @} /////////////////////////////////////////////////////////////////////////// @@ -195,8 +204,6 @@ public: GrDrawFace getDrawFace() const { return static_cast<GrDrawFace>(fDrawFace); } private: - GrPipeline() { /** Initialized in factory function*/ } - /** This is a continuation of the public "Flags" enum. */ enum PrivateFlags { kDisableOutputConversionToSRGB_Flag = 0x4, |