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 24 matching lines...) Expand all Loading... | |
35 * draw one or more paths/rects specifying the required boolean ops | 35 * draw one or more paths/rects specifying the required boolean ops |
36 * | 36 * |
37 * toTexture(); // to get it from the internal bitmap to the GPU | 37 * toTexture(); // to get it from the internal bitmap to the GPU |
38 * | 38 * |
39 * The result of this process will be the final mask (on the GPU) in the | 39 * The result of this process will be the final mask (on the GPU) in the |
40 * upper left hand corner of the texture. | 40 * upper left hand corner of the texture. |
41 */ | 41 */ |
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), fCompressMask(false) { |
46 } | 46 } |
47 | 47 |
48 // set up the internal state in preparation for draws. Since many masks | 48 // set up the internal state in preparation for draws. Since many masks |
49 // may be accumulated in the helper during creation, "resultBounds" | 49 // may be accumulated in the helper during creation, "resultBounds" |
50 // allows the caller to specify the region of interest - to limit the | 50 // allows the caller to specify the region of interest - to limit the |
51 // amount of work. | 51 // amount of work. |
52 bool init(const SkIRect& resultBounds, const SkMatrix* matrix); | 52 bool init(const SkIRect& resultBounds, const SkMatrix* matrix); |
53 | 53 |
54 // Draw a single rect into the accumulation bitmap using the specified op | 54 // Draw a single rect into the accumulation bitmap using the specified op |
55 void draw(const SkRect& rect, SkRegion::Op op, | 55 void draw(const SkRect& rect, SkRegion::Op op, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 GrDrawTarget* target, | 94 GrDrawTarget* target, |
95 const SkIRect& rect); | 95 const SkIRect& rect); |
96 | 96 |
97 protected: | 97 protected: |
98 private: | 98 private: |
99 GrContext* fContext; | 99 GrContext* fContext; |
100 SkMatrix fMatrix; | 100 SkMatrix fMatrix; |
101 SkBitmap fBM; | 101 SkBitmap fBM; |
102 SkDraw fDraw; | 102 SkDraw fDraw; |
103 SkRasterClip fRasterClip; | 103 SkRasterClip fRasterClip; |
104 | 104 |
robertphillips
2014/07/30 12:15:50
// Should the mask be compressed? If true, fCompre
krajcevski
2014/07/30 15:10:19
Done.
| |
105 #if GR_COMPRESS_ALPHA_MASK | 105 bool fCompressMask; |
robertphillips
2014/07/30 12:15:49
// Only set when 'fCompressMask' is true. ?
krajcevski
2014/07/30 15:10:19
Done.
| |
106 SkTextureCompressor::Format fCompressedFormat; | 106 SkTextureCompressor::Format fCompressedFormat; |
107 #endif | |
108 | 107 |
109 // Actually sends the texture data to the GPU. This is called from | 108 // Actually sends the texture data to the GPU. This is called from |
110 // toTexture with the data filled in depending on the texture config. | 109 // toTexture with the data filled in depending on the texture config. |
111 void sendTextureData(GrTexture *texture, const GrTextureDesc& desc, | 110 void sendTextureData(GrTexture *texture, const GrTextureDesc& desc, |
112 const void *data, int rowbytes); | 111 const void *data, int rowbytes); |
113 | 112 |
114 // Compresses the bitmap stored in fBM and sends the compressed data | 113 // Compresses the bitmap stored in fBM and sends the compressed data |
115 // to the GPU to be stored in 'texture' using sendTextureData. | 114 // to the GPU to be stored in 'texture' using sendTextureData. |
116 void compressTextureData(GrTexture *texture, const GrTextureDesc& desc); | 115 void compressTextureData(GrTexture *texture, const GrTextureDesc& desc); |
117 | 116 |
118 typedef SkNoncopyable INHERITED; | 117 typedef SkNoncopyable INHERITED; |
119 }; | 118 }; |
120 | 119 |
121 #endif // GrSWMaskHelper_DEFINED | 120 #endif // GrSWMaskHelper_DEFINED |
OLD | NEW |