| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 // Draw a single path into the accumuation bitmap using the specified op | 57 // Draw a single path into the accumuation bitmap using the specified op |
| 58 void draw(const SkPath& path, const SkStrokeRec& stroke, SkRegion::Op op, | 58 void draw(const SkPath& path, const SkStrokeRec& stroke, SkRegion::Op op, |
| 59 bool antiAlias, uint8_t alpha); | 59 bool antiAlias, uint8_t alpha); |
| 60 | 60 |
| 61 // Helper function to get a scratch texture suitable for capturing the | 61 // Helper function to get a scratch texture suitable for capturing the |
| 62 // result (i.e., right size & format) | 62 // result (i.e., right size & format) |
| 63 bool getTexture(GrAutoScratchTexture* texture); | 63 bool getTexture(GrAutoScratchTexture* texture); |
| 64 | 64 |
| 65 // Move the mask generation results from the internal bitmap to the gpu. | 65 // Move the mask generation results from the internal bitmap to the gpu. |
| 66 // The space outside of the mask is cleared using "alpha" | 66 void toTexture(GrTexture* texture); |
| 67 void toTexture(GrTexture* texture, uint8_t alpha); | |
| 68 | 67 |
| 69 // Reset the internal bitmap | 68 // Reset the internal bitmap |
| 70 void clear(uint8_t alpha) { | 69 void clear(uint8_t alpha) { |
| 71 fBM.eraseColor(SkColorSetARGB(alpha, alpha, alpha, alpha)); | 70 fBM.eraseColor(SkColorSetARGB(alpha, alpha, alpha, alpha)); |
| 72 } | 71 } |
| 73 | 72 |
| 74 // Canonical usage utility that draws a single path and uploads it | 73 // Canonical usage utility that draws a single path and uploads it |
| 75 // to the GPU. The result is returned in "result". | 74 // to the GPU. The result is returned in "result". |
| 76 static GrTexture* DrawPathMaskToTexture(GrContext* context, | 75 static GrTexture* DrawPathMaskToTexture(GrContext* context, |
| 77 const SkPath& path, | 76 const SkPath& path, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 99 GrContext* fContext; | 98 GrContext* fContext; |
| 100 SkMatrix fMatrix; | 99 SkMatrix fMatrix; |
| 101 SkBitmap fBM; | 100 SkBitmap fBM; |
| 102 SkDraw fDraw; | 101 SkDraw fDraw; |
| 103 SkRasterClip fRasterClip; | 102 SkRasterClip fRasterClip; |
| 104 | 103 |
| 105 typedef GrNoncopyable INHERITED; | 104 typedef GrNoncopyable INHERITED; |
| 106 }; | 105 }; |
| 107 | 106 |
| 108 #endif // GrSWMaskHelper_DEFINED | 107 #endif // GrSWMaskHelper_DEFINED |
| OLD | NEW |