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 |
11 #include "GrColor.h" | 11 #include "GrColor.h" |
12 #include "SkMatrix.h" | 12 #include "GrDrawState.h" |
13 #include "GrNoncopyable.h" | |
14 #include "SkBitmap.h" | 13 #include "SkBitmap.h" |
15 #include "SkDraw.h" | 14 #include "SkDraw.h" |
| 15 #include "SkMatrix.h" |
16 #include "SkRasterClip.h" | 16 #include "SkRasterClip.h" |
17 #include "SkRegion.h" | 17 #include "SkRegion.h" |
18 #include "GrDrawState.h" | 18 #include "SkTypes.h" |
19 | 19 |
20 class GrAutoScratchTexture; | 20 class GrAutoScratchTexture; |
21 class GrContext; | 21 class GrContext; |
22 class GrTexture; | 22 class GrTexture; |
23 class SkPath; | 23 class SkPath; |
24 class SkStrokeRec; | 24 class SkStrokeRec; |
25 class GrDrawTarget; | 25 class GrDrawTarget; |
26 | 26 |
27 /** | 27 /** |
28 * The GrSWMaskHelper helps generate clip masks using the software rendering | 28 * The GrSWMaskHelper helps generate clip masks using the software rendering |
29 * path. It is intended to be used as: | 29 * path. It is intended to be used as: |
30 * | 30 * |
31 * GrSWMaskHelper helper(context); | 31 * GrSWMaskHelper helper(context); |
32 * helper.init(...); | 32 * helper.init(...); |
33 * | 33 * |
34 * draw one or more paths/rects specifying the required boolean ops | 34 * draw one or more paths/rects specifying the required boolean ops |
35 * | 35 * |
36 * toTexture(); // to get it from the internal bitmap to the GPU | 36 * toTexture(); // to get it from the internal bitmap to the GPU |
37 * | 37 * |
38 * The result of this process will be the final mask (on the GPU) in the | 38 * The result of this process will be the final mask (on the GPU) in the |
39 * upper left hand corner of the texture. | 39 * upper left hand corner of the texture. |
40 */ | 40 */ |
41 class GrSWMaskHelper : public GrNoncopyable { | 41 class GrSWMaskHelper : public SkNoncopyable { |
42 public: | 42 public: |
43 GrSWMaskHelper(GrContext* context) | 43 GrSWMaskHelper(GrContext* context) |
44 : fContext(context) { | 44 : fContext(context) { |
45 } | 45 } |
46 | 46 |
47 // set up the internal state in preparation for draws. Since many masks | 47 // set up the internal state in preparation for draws. Since many masks |
48 // may be accumulated in the helper during creation, "resultBounds" | 48 // may be accumulated in the helper during creation, "resultBounds" |
49 // allows the caller to specify the region of interest - to limit the | 49 // allows the caller to specify the region of interest - to limit the |
50 // amount of work. | 50 // amount of work. |
51 bool init(const SkIRect& resultBounds, const SkMatrix* matrix); | 51 bool init(const SkIRect& resultBounds, const SkMatrix* matrix); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 const SkIRect& rect); | 94 const SkIRect& rect); |
95 | 95 |
96 protected: | 96 protected: |
97 private: | 97 private: |
98 GrContext* fContext; | 98 GrContext* fContext; |
99 SkMatrix fMatrix; | 99 SkMatrix fMatrix; |
100 SkBitmap fBM; | 100 SkBitmap fBM; |
101 SkDraw fDraw; | 101 SkDraw fDraw; |
102 SkRasterClip fRasterClip; | 102 SkRasterClip fRasterClip; |
103 | 103 |
104 typedef GrNoncopyable INHERITED; | 104 typedef SkNoncopyable INHERITED; |
105 }; | 105 }; |
106 | 106 |
107 #endif // GrSWMaskHelper_DEFINED | 107 #endif // GrSWMaskHelper_DEFINED |
OLD | NEW |