OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrSWMaskHelper_DEFINED | 8 #ifndef GrSWMaskHelper_DEFINED |
9 #define GrSWMaskHelper_DEFINED | 9 #define GrSWMaskHelper_DEFINED |
10 | 10 |
11 #include "SkAutoPixmapStorage.h" | 11 #include "SkAutoPixmapStorage.h" |
12 #include "GrColor.h" | 12 #include "GrColor.h" |
13 #include "GrPipelineBuilder.h" | 13 #include "GrPipelineBuilder.h" |
14 #include "SkBitmap.h" | 14 #include "SkBitmap.h" |
15 #include "SkDraw.h" | 15 #include "SkDraw.h" |
16 #include "SkMatrix.h" | 16 #include "SkMatrix.h" |
17 #include "SkRasterClip.h" | 17 #include "SkRasterClip.h" |
18 #include "SkRegion.h" | 18 #include "SkRegion.h" |
19 #include "SkTypes.h" | 19 #include "SkTypes.h" |
20 | 20 |
21 class GrClip; | 21 class GrClip; |
22 class GrTextureProvider; | 22 class GrTextureProvider; |
23 class GrTexture; | 23 class GrTexture; |
24 class SkPath; | 24 class SkPath; |
25 class SkStrokeRec; | 25 class SkStrokeRec; |
26 class GrDrawTarget; | |
27 | 26 |
28 /** | 27 /** |
29 * The GrSWMaskHelper helps generate clip masks using the software rendering | 28 * The GrSWMaskHelper helps generate clip masks using the software rendering |
30 * path. It is intended to be used as: | 29 * path. It is intended to be used as: |
31 * | 30 * |
32 * GrSWMaskHelper helper(context); | 31 * GrSWMaskHelper helper(context); |
33 * helper.init(...); | 32 * helper.init(...); |
34 * | 33 * |
35 * draw one or more paths/rects specifying the required boolean ops | 34 * draw one or more paths/rects specifying the required boolean ops |
36 * | 35 * |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // The ClipMaskManager uses it to accumulate clip masks while the | 79 // The ClipMaskManager uses it to accumulate clip masks while the |
81 // GrSoftwarePathRenderer uses it to fulfill a drawPath call. | 80 // GrSoftwarePathRenderer uses it to fulfill a drawPath call. |
82 // It draws with "texture" as a path mask into "target" using "rect" as | 81 // It draws with "texture" as a path mask into "target" using "rect" as |
83 // geometry and the current drawState. The current drawState is altered to | 82 // geometry and the current drawState. The current drawState is altered to |
84 // accommodate the mask. | 83 // accommodate the mask. |
85 // Note that this method assumes that the GrPaint::kTotalStages slot in | 84 // Note that this method assumes that the GrPaint::kTotalStages slot in |
86 // the draw state can be used to hold the mask texture stage. | 85 // the draw state can be used to hold the mask texture stage. |
87 // This method is really only intended to be used with the | 86 // This method is really only intended to be used with the |
88 // output of DrawPathMaskToTexture. | 87 // output of DrawPathMaskToTexture. |
89 static void DrawToTargetWithPathMask(GrTexture* texture, | 88 static void DrawToTargetWithPathMask(GrTexture* texture, |
90 GrDrawTarget* target, | 89 GrDrawContext*, |
91 GrPipelineBuilder* pipelineBuilder, | 90 const GrPaint* paint, |
| 91 const GrUserStencilSettings* userStenci
lSettings, |
92 const GrClip&, | 92 const GrClip&, |
93 GrColor, | 93 GrColor, |
94 const SkMatrix& viewMatrix, | 94 const SkMatrix& viewMatrix, |
95 const SkIRect& rect); | 95 const SkIRect& rect); |
96 | 96 |
97 private: | 97 private: |
98 // Helper function to get a scratch texture suitable for capturing the | 98 // Helper function to get a scratch texture suitable for capturing the |
99 // result (i.e., right size & format) | 99 // result (i.e., right size & format) |
100 GrTexture* createTexture(); | 100 GrTexture* createTexture(); |
101 | 101 |
102 GrTextureProvider* fTexProvider; | 102 GrTextureProvider* fTexProvider; |
103 SkMatrix fMatrix; | 103 SkMatrix fMatrix; |
104 SkAutoPixmapStorage fPixels; | 104 SkAutoPixmapStorage fPixels; |
105 SkDraw fDraw; | 105 SkDraw fDraw; |
106 SkRasterClip fRasterClip; | 106 SkRasterClip fRasterClip; |
107 | 107 |
108 typedef SkNoncopyable INHERITED; | 108 typedef SkNoncopyable INHERITED; |
109 }; | 109 }; |
110 | 110 |
111 #endif // GrSWMaskHelper_DEFINED | 111 #endif // GrSWMaskHelper_DEFINED |
OLD | NEW |