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