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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class GrSWMaskHelper : SkNoncopyable { | 42 class GrSWMaskHelper : SkNoncopyable { |
43 public: | 43 public: |
44 GrSWMaskHelper(GrContext* context) | 44 GrSWMaskHelper(GrContext* context) |
45 : fContext(context) | 45 : fContext(context) |
46 , fCompressionMode(kNone_CompressionMode) { | 46 , fCompressionMode(kNone_CompressionMode) { |
47 } | 47 } |
48 | 48 |
49 // set up the internal state in preparation for draws. Since many masks | 49 // set up the internal state in preparation for draws. Since many masks |
50 // may be accumulated in the helper during creation, "resultBounds" | 50 // may be accumulated in the helper during creation, "resultBounds" |
51 // allows the caller to specify the region of interest - to limit the | 51 // allows the caller to specify the region of interest - to limit the |
52 // amount of work. | 52 // amount of work. allowCompression should be set to false if you plan on us
ing |
53 bool init(const SkIRect& resultBounds, const SkMatrix* matrix); | 53 // your own texture to draw into, and not a scratch texture via getTexture()
. |
| 54 bool init(const SkIRect& resultBounds, const SkMatrix* matrix, bool allowCom
pression = true); |
54 | 55 |
55 // Draw a single rect into the accumulation bitmap using the specified op | 56 // Draw a single rect into the accumulation bitmap using the specified op |
56 void draw(const SkRect& rect, SkRegion::Op op, | 57 void draw(const SkRect& rect, SkRegion::Op op, |
57 bool antiAlias, uint8_t alpha); | 58 bool antiAlias, uint8_t alpha); |
58 | 59 |
59 // Draw a single path into the accumuation bitmap using the specified op | 60 // Draw a single path into the accumuation bitmap using the specified op |
60 void draw(const SkPath& path, const SkStrokeRec& stroke, SkRegion::Op op, | 61 void draw(const SkPath& path, const SkStrokeRec& stroke, SkRegion::Op op, |
61 bool antiAlias, uint8_t alpha); | 62 bool antiAlias, uint8_t alpha); |
62 | 63 |
63 // Helper function to get a scratch texture suitable for capturing the | 64 // Helper function to get a scratch texture suitable for capturing the |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 const void *data, int rowbytes); | 127 const void *data, int rowbytes); |
127 | 128 |
128 // Compresses the bitmap stored in fBM and sends the compressed data | 129 // Compresses the bitmap stored in fBM and sends the compressed data |
129 // to the GPU to be stored in 'texture' using sendTextureData. | 130 // to the GPU to be stored in 'texture' using sendTextureData. |
130 void compressTextureData(GrTexture *texture, const GrTextureDesc& desc); | 131 void compressTextureData(GrTexture *texture, const GrTextureDesc& desc); |
131 | 132 |
132 typedef SkNoncopyable INHERITED; | 133 typedef SkNoncopyable INHERITED; |
133 }; | 134 }; |
134 | 135 |
135 #endif // GrSWMaskHelper_DEFINED | 136 #endif // GrSWMaskHelper_DEFINED |
OLD | NEW |