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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void toTexture(GrTexture* texture); | 66 void toTexture(GrTexture* texture); |
67 | 67 |
68 GrTexture* toLATCTexture(GrContext* ctx); | |
69 | |
70 // Reset the internal bitmap | 68 // Reset the internal bitmap |
71 void clear(uint8_t alpha) { | 69 void clear(uint8_t alpha) { |
72 fBM.eraseColor(SkColorSetARGB(alpha, alpha, alpha, alpha)); | 70 fBM.eraseColor(SkColorSetARGB(alpha, alpha, alpha, alpha)); |
73 } | 71 } |
74 | 72 |
75 // Canonical usage utility that draws a single path and uploads it | 73 // Canonical usage utility that draws a single path and uploads it |
76 // to the GPU. The result is returned in "result". | 74 // to the GPU. The result is returned in "result". |
77 static GrTexture* DrawPathMaskToTexture(GrContext* context, | 75 static GrTexture* DrawPathMaskToTexture(GrContext* context, |
78 const SkPath& path, | 76 const SkPath& path, |
79 const SkStrokeRec& stroke, | 77 const SkStrokeRec& stroke, |
(...skipping 16 matching lines...) Expand all Loading... |
96 const SkIRect& rect); | 94 const SkIRect& rect); |
97 | 95 |
98 protected: | 96 protected: |
99 private: | 97 private: |
100 GrContext* fContext; | 98 GrContext* fContext; |
101 SkMatrix fMatrix; | 99 SkMatrix fMatrix; |
102 SkBitmap fBM; | 100 SkBitmap fBM; |
103 SkDraw fDraw; | 101 SkDraw fDraw; |
104 SkRasterClip fRasterClip; | 102 SkRasterClip fRasterClip; |
105 | 103 |
| 104 // Actually sends the texture data to the GPU. This is called from |
| 105 // toTexture with the data filled in depending on the texture config. |
| 106 void sendTextureData(GrTexture *texture, const GrTextureDesc& desc, |
| 107 const void *data, int rowbytes); |
| 108 |
106 typedef SkNoncopyable INHERITED; | 109 typedef SkNoncopyable INHERITED; |
107 }; | 110 }; |
108 | 111 |
109 #endif // GrSWMaskHelper_DEFINED | 112 #endif // GrSWMaskHelper_DEFINED |
OLD | NEW |