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 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 fBM.eraseColor(SkColorSetARGB(alpha, alpha, alpha, alpha)); | 71 fBM.eraseColor(SkColorSetARGB(alpha, alpha, alpha, alpha)); |
72 } | 72 } |
73 | 73 |
74 // Canonical usage utility that draws a single path and uploads it | 74 // Canonical usage utility that draws a single path and uploads it |
75 // to the GPU. The result is returned. | 75 // to the GPU. The result is returned. |
76 static GrTexture* DrawPathMaskToTexture(GrContext* context, | 76 static GrTexture* DrawPathMaskToTexture(GrContext* context, |
77 const SkPath& path, | 77 const SkPath& path, |
78 const SkStrokeRec& stroke, | 78 const SkStrokeRec& stroke, |
79 const SkIRect& resultBounds, | 79 const SkIRect& resultBounds, |
80 bool antiAlias, | 80 bool antiAlias, |
81 SkMatrix* matrix); | 81 const SkMatrix* matrix); |
82 | 82 |
83 // This utility routine is used to add a path's mask to some other draw. | 83 // This utility routine is used to add a path's mask to some other draw. |
84 // The ClipMaskManager uses it to accumulate clip masks while the | 84 // The ClipMaskManager uses it to accumulate clip masks while the |
85 // GrSoftwarePathRenderer uses it to fulfill a drawPath call. | 85 // GrSoftwarePathRenderer uses it to fulfill a drawPath call. |
86 // It draws with "texture" as a path mask into "target" using "rect" as | 86 // It draws with "texture" as a path mask into "target" using "rect" as |
87 // geometry and the current drawState. The current drawState is altered to | 87 // geometry and the current drawState. The current drawState is altered to |
88 // accommodate the mask. | 88 // accommodate the mask. |
89 // Note that this method assumes that the GrPaint::kTotalStages slot in | 89 // Note that this method assumes that the GrPaint::kTotalStages slot in |
90 // the draw state can be used to hold the mask texture stage. | 90 // the draw state can be used to hold the mask texture stage. |
91 // This method is really only intended to be used with the | 91 // This method is really only intended to be used with the |
92 // output of DrawPathMaskToTexture. | 92 // output of DrawPathMaskToTexture. |
93 static void DrawToTargetWithPathMask(GrTexture* texture, | 93 static void DrawToTargetWithPathMask(GrTexture* texture, |
94 GrDrawTarget* target, | 94 GrDrawTarget* target, |
95 GrDrawState* drawState, | 95 GrDrawState* drawState, |
96 GrColor, | 96 GrColor, |
| 97 const SkMatrix& viewMatrix, |
97 const SkIRect& rect); | 98 const SkIRect& rect); |
98 | 99 |
99 private: | 100 private: |
100 // Helper function to get a scratch texture suitable for capturing the | 101 // Helper function to get a scratch texture suitable for capturing the |
101 // result (i.e., right size & format) | 102 // result (i.e., right size & format) |
102 GrTexture* createTexture(); | 103 GrTexture* createTexture(); |
103 | 104 |
104 GrContext* fContext; | 105 GrContext* fContext; |
105 SkMatrix fMatrix; | 106 SkMatrix fMatrix; |
106 SkBitmap fBM; | 107 SkBitmap fBM; |
(...skipping 24 matching lines...) Expand all Loading... |
131 const void *data, size_t rowbytes); | 132 const void *data, size_t rowbytes); |
132 | 133 |
133 // Compresses the bitmap stored in fBM and sends the compressed data | 134 // Compresses the bitmap stored in fBM and sends the compressed data |
134 // to the GPU to be stored in 'texture' using sendTextureData. | 135 // to the GPU to be stored in 'texture' using sendTextureData. |
135 void compressTextureData(GrTexture *texture, const GrSurfaceDesc& desc); | 136 void compressTextureData(GrTexture *texture, const GrSurfaceDesc& desc); |
136 | 137 |
137 typedef SkNoncopyable INHERITED; | 138 typedef SkNoncopyable INHERITED; |
138 }; | 139 }; |
139 | 140 |
140 #endif // GrSWMaskHelper_DEFINED | 141 #endif // GrSWMaskHelper_DEFINED |
OLD | NEW |