OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrPathRendererChain_DEFINED | 8 #ifndef GrPathRendererChain_DEFINED |
9 #define GrPathRendererChain_DEFINED | 9 #define GrPathRendererChain_DEFINED |
10 | 10 |
11 #include "GrPathRenderer.h" | 11 #include "GrPathRenderer.h" |
12 | 12 |
13 #include "SkRefCnt.h" | 13 #include "SkTypes.h" |
14 #include "SkTArray.h" | 14 #include "SkTArray.h" |
15 | 15 |
16 class GrContext; | 16 class GrContext; |
17 class GrPipelineBuilder; | |
18 class GrShaderCaps; | |
19 class GrStrokeInfo; | |
20 class SkMatrix; | |
21 class SkPath; | |
22 | 17 |
23 /** | 18 /** |
24 * Keeps track of an ordered list of path renderers. When a path needs to be | 19 * Keeps track of an ordered list of path renderers. When a path needs to be |
25 * drawn this list is scanned to find the most preferred renderer. To add your | 20 * drawn this list is scanned to find the most preferred renderer. To add your |
26 * path renderer to the list implement the GrPathRenderer::AddPathRenderers | 21 * path renderer to the list implement the GrPathRenderer::AddPathRenderers |
27 * function. | 22 * function. |
28 */ | 23 */ |
29 class GrPathRendererChain : public SkRefCnt { | 24 class GrPathRendererChain : public SkNoncopyable { |
30 public: | 25 public: |
31 GrPathRendererChain(GrContext* context); | 26 GrPathRendererChain(GrContext* context); |
32 | 27 |
33 ~GrPathRendererChain(); | 28 ~GrPathRendererChain(); |
34 | 29 |
35 /** Documents how the caller plans to use a GrPathRenderer to draw a path. I
t affects the PR | 30 /** Documents how the caller plans to use a GrPathRenderer to draw a path. I
t affects the PR |
36 returned by getPathRenderer */ | 31 returned by getPathRenderer */ |
37 enum DrawType { | 32 enum DrawType { |
38 kColor_DrawType, // draw to the color buffer, no AA | 33 kColor_DrawType, // draw to the color buffer, no AA |
39 kColorAntiAlias_DrawType, // draw to color buffer, with partia
l coverage AA | 34 kColorAntiAlias_DrawType, // draw to color buffer, with partia
l coverage AA |
40 kStencilOnly_DrawType, // draw just to the stencil buffer | 35 kStencilOnly_DrawType, // draw just to the stencil buffer |
41 kStencilAndColor_DrawType, // draw the stencil and color buffer
, no AA | 36 kStencilAndColor_DrawType, // draw the stencil and color buffer
, no AA |
42 kStencilAndColorAntiAlias_DrawType // draw the stencil and color buffer
, with partial | 37 kStencilAndColorAntiAlias_DrawType // draw the stencil and color buffer
, with partial |
43 // coverage AA. | 38 // coverage AA. |
44 }; | 39 }; |
45 | 40 |
46 /** Returns a GrPathRenderer compatible with the request if one is available
. If the caller | 41 /** Returns a GrPathRenderer compatible with the request if one is available
. If the caller |
47 is drawing the path to the stencil buffer then stencilSupport can be use
d to determine | 42 is drawing the path to the stencil buffer then stencilSupport can be use
d to determine |
48 whether the path can be rendered with arbitrary stencil rules or not. Se
e comments on | 43 whether the path can be rendered with arbitrary stencil rules or not. Se
e comments on |
49 StencilSupport in GrPathRenderer.h. */ | 44 StencilSupport in GrPathRenderer.h. */ |
50 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, | 45 GrPathRenderer* getPathRenderer(const GrPathRenderer::CanDrawPathArgs& args, |
51 DrawType drawType, | 46 DrawType drawType, |
52 GrPathRenderer::StencilSupport* stencilSuppo
rt); | 47 GrPathRenderer::StencilSupport* stencilSuppo
rt); |
53 | 48 |
54 private: | 49 private: |
55 GrPathRendererChain(); | |
56 | |
57 // takes a ref and unrefs in destructor | 50 // takes a ref and unrefs in destructor |
58 GrPathRenderer* addPathRenderer(GrPathRenderer* pr); | 51 GrPathRenderer* addPathRenderer(GrPathRenderer* pr); |
59 | 52 |
60 void init(); | |
61 | |
62 enum { | 53 enum { |
63 kPreAllocCount = 8, | 54 kPreAllocCount = 8, |
64 }; | 55 }; |
65 bool fInit; | |
66 GrContext* fOwner; | |
67 SkSTArray<kPreAllocCount, GrPathRenderer*, true> fChain; | 56 SkSTArray<kPreAllocCount, GrPathRenderer*, true> fChain; |
68 | |
69 typedef SkRefCnt INHERITED; | |
70 }; | 57 }; |
71 | 58 |
72 #endif | 59 #endif |
OLD | NEW |