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