diff options
author | robertphillips <robertphillips@google.com> | 2015-10-29 12:12:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-29 12:12:21 -0700 |
commit | 687378229aecefc0ab7e639181593774ec8a4290 (patch) | |
tree | 18eef745eb26d302a6bf90bcb2615984b5dfea10 /src/gpu/GrPathRendererChain.h | |
parent | 89fe56bb98de55c7bd2b547c875b74a98bd5a1ca (diff) |
Remove GrPipelineBuilder from getPathRenderer call
Logically this CL:
Moves the PathRendererChain from GrContext to GrDrawManager
- this was needed to untangled the Path-Chain/Renderer header mess
- this entailed adding getDrawingMgr so the CMM could access the PathRenderingChain
- this also entailed re-adding freeGpuResources to the GrDrawingMgr
Moves the CanDrawArgs struct up stack
Removes the GrPipelineBuilder from the CanDrawArgs struct
Review URL: https://codereview.chromium.org/1407883004
Diffstat (limited to 'src/gpu/GrPathRendererChain.h')
-rw-r--r-- | src/gpu/GrPathRendererChain.h | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/src/gpu/GrPathRendererChain.h b/src/gpu/GrPathRendererChain.h new file mode 100644 index 0000000000..e0e7d46f06 --- /dev/null +++ b/src/gpu/GrPathRendererChain.h @@ -0,0 +1,72 @@ +/* + * Copyright 2011 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrPathRendererChain_DEFINED +#define GrPathRendererChain_DEFINED + +#include "GrPathRenderer.h" + +#include "SkRefCnt.h" +#include "SkTArray.h" + +class GrContext; +class GrPipelineBuilder; +class GrShaderCaps; +class GrStrokeInfo; +class SkMatrix; +class SkPath; + +/** + * Keeps track of an ordered list of path renderers. When a path needs to be + * drawn this list is scanned to find the most preferred renderer. To add your + * path renderer to the list implement the GrPathRenderer::AddPathRenderers + * function. + */ +class GrPathRendererChain : public SkRefCnt { +public: + GrPathRendererChain(GrContext* context); + + ~GrPathRendererChain(); + + /** Documents how the caller plans to use a GrPathRenderer to draw a path. It affects the PR + returned by getPathRenderer */ + enum DrawType { + kColor_DrawType, // draw to the color buffer, no AA + kColorAntiAlias_DrawType, // draw to color buffer, with partial coverage AA + kStencilOnly_DrawType, // draw just to the stencil buffer + kStencilAndColor_DrawType, // draw the stencil and color buffer, no AA + kStencilAndColorAntiAlias_DrawType // draw the stencil and color buffer, with partial + // coverage AA. + }; + + /** Returns a GrPathRenderer compatible with the request if one is available. If the caller + is drawing the path to the stencil buffer then stencilSupport can be used to determine + whether the path can be rendered with arbitrary stencil rules or not. See comments on + StencilSupport in GrPathRenderer.h. */ + GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, + DrawType drawType, + GrPathRenderer::StencilSupport* stencilSupport); + +private: + GrPathRendererChain(); + + // takes a ref and unrefs in destructor + GrPathRenderer* addPathRenderer(GrPathRenderer* pr); + + void init(); + + enum { + kPreAllocCount = 8, + }; + bool fInit; + GrContext* fOwner; + SkSTArray<kPreAllocCount, GrPathRenderer*, true> fChain; + + typedef SkRefCnt INHERITED; +}; + +#endif |