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 SkSurface_DEFINED | 8 #ifndef SkSurface_DEFINED |
9 #define SkSurface_DEFINED | 9 #define SkSurface_DEFINED |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 /** | 70 /** |
71 * This will use the standard text rendering method | 71 * This will use the standard text rendering method |
72 */ | 72 */ |
73 kStandard_TextRenderMode, | 73 kStandard_TextRenderMode, |
74 /** | 74 /** |
75 * This will use signed distance fields for text rendering when possibl
e | 75 * This will use signed distance fields for text rendering when possibl
e |
76 */ | 76 */ |
77 kDistanceField_TextRenderMode, | 77 kDistanceField_TextRenderMode, |
78 }; | 78 }; |
79 | 79 |
| 80 enum RenderTargetFlags { |
| 81 kNone_RenderTargetFlag = 0x0, |
| 82 /* |
| 83 * By default a RenderTarget-based surface will be cleared on creation. |
| 84 * Pass in this flag to prevent the clear from happening. |
| 85 */ |
| 86 kDontClear_RenderTargetFlag = 0x01, |
| 87 }; |
| 88 |
80 /** | 89 /** |
81 * Return a new surface using the specified render target. | 90 * Return a new surface using the specified render target. |
82 */ | 91 */ |
83 static SkSurface* NewRenderTargetDirect(GrRenderTarget*, | 92 static SkSurface* NewRenderTargetDirect(GrRenderTarget*, |
84 TextRenderMode trm = kStandard_TextR
enderMode); | 93 TextRenderMode trm = kStandard_TextR
enderMode, |
| 94 RenderTargetFlags flags = kNone_Rend
erTargetFlag); |
85 | 95 |
86 /** | 96 /** |
87 * Return a new surface whose contents will be drawn to an offscreen | 97 * Return a new surface whose contents will be drawn to an offscreen |
88 * render target, allocated by the surface. | 98 * render target, allocated by the surface. |
89 */ | 99 */ |
90 static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sample
Count = 0, | 100 static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sample
Count = 0, |
91 TextRenderMode trm = kStandard_TextRenderM
ode); | 101 TextRenderMode trm = kStandard_TextRenderM
ode, |
| 102 RenderTargetFlags flags = kNone_RenderTarg
etFlag); |
92 | 103 |
93 /** | 104 /** |
94 * Return a new surface whose contents will be drawn to an offscreen | 105 * Return a new surface whose contents will be drawn to an offscreen |
95 * render target, allocated by the surface from the scratch texture pool | 106 * render target, allocated by the surface from the scratch texture pool |
96 * managed by the GrContext. The scratch texture pool serves the purpose | 107 * managed by the GrContext. The scratch texture pool serves the purpose |
97 * of retaining textures after they are no longer in use in order to | 108 * of retaining textures after they are no longer in use in order to |
98 * re-use them later without having to re-allocate. Scratch textures | 109 * re-use them later without having to re-allocate. Scratch textures |
99 * should be used in cases where high turnover is expected. This allows, | 110 * should be used in cases where high turnover is expected. This allows, |
100 * for example, the copy on write to recycle a texture from a recently | 111 * for example, the copy on write to recycle a texture from a recently |
101 * released SkImage snapshot of the surface. | 112 * released SkImage snapshot of the surface. |
102 * Note: Scratch textures count against the GrContext's cached resource | 113 * Note: Scratch textures count against the GrContext's cached resource |
103 * budget. | 114 * budget. |
104 */ | 115 */ |
105 static SkSurface* NewScratchRenderTarget(GrContext*, const SkImageInfo&, int
sampleCount = 0, | 116 static SkSurface* NewScratchRenderTarget(GrContext*, const SkImageInfo&, int
sampleCount = 0, |
106 TextRenderMode trm = kStandard_Text
RenderMode); | 117 TextRenderMode trm = kStandard_Text
RenderMode, |
| 118 RenderTargetFlags flags = kNone_Ren
derTargetFlag); |
107 | 119 |
108 int width() const { return fWidth; } | 120 int width() const { return fWidth; } |
109 int height() const { return fHeight; } | 121 int height() const { return fHeight; } |
110 | 122 |
111 /** | 123 /** |
112 * Returns a unique non-zero, unique value identifying the content of this | 124 * Returns a unique non-zero, unique value identifying the content of this |
113 * surface. Each time the content is changed changed, either by drawing | 125 * surface. Each time the content is changed changed, either by drawing |
114 * into this surface, or explicitly calling notifyContentChanged()) this | 126 * into this surface, or explicitly calling notifyContentChanged()) this |
115 * method will return a new value. | 127 * method will return a new value. |
116 * | 128 * |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 215 |
204 private: | 216 private: |
205 const int fWidth; | 217 const int fWidth; |
206 const int fHeight; | 218 const int fHeight; |
207 uint32_t fGenerationID; | 219 uint32_t fGenerationID; |
208 | 220 |
209 typedef SkRefCnt INHERITED; | 221 typedef SkRefCnt INHERITED; |
210 }; | 222 }; |
211 | 223 |
212 #endif | 224 #endif |
OLD | NEW |