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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 * Return a new surface using the specified render target. | 66 * Return a new surface using the specified render target. |
67 */ | 67 */ |
68 static SkSurface* NewRenderTargetDirect(GrRenderTarget*); | 68 static SkSurface* NewRenderTargetDirect(GrRenderTarget*); |
69 | 69 |
70 /** | 70 /** |
71 * Return a new surface whose contents will be drawn to an offscreen | 71 * Return a new surface whose contents will be drawn to an offscreen |
72 * render target, allocated by the surface. | 72 * render target, allocated by the surface. |
73 */ | 73 */ |
74 static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sample
Count = 0); | 74 static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sample
Count = 0); |
75 | 75 |
| 76 /** |
| 77 * Return a new surface whose contents will be drawn to an offscreen |
| 78 * render target, allocated by the surface from the scratch texture pool |
| 79 * managed by the GrContext. The scratch texture pool serves the purpose |
| 80 * of retaining textures after they are no longer in use in order to |
| 81 * re-use them later without having to re-allocate. Scratch textures |
| 82 * should be used in cases where high turnover is expected. This allows, |
| 83 * for example, the copy on write to recycle a texture from a recently |
| 84 * released SkImage snapshot of the surface. |
| 85 * Note: Scratch textures count against the GrContext's cached resource |
| 86 * budget. |
| 87 */ |
| 88 static SkSurface* NewScratchRenderTarget(GrContext*, const SkImageInfo&, int
sampleCount = 0); |
| 89 |
76 int width() const { return fWidth; } | 90 int width() const { return fWidth; } |
77 int height() const { return fHeight; } | 91 int height() const { return fHeight; } |
78 | 92 |
79 /** | 93 /** |
80 * Returns a unique non-zero, unique value identifying the content of this | 94 * Returns a unique non-zero, unique value identifying the content of this |
81 * surface. Each time the content is changed changed, either by drawing | 95 * surface. Each time the content is changed changed, either by drawing |
82 * into this surface, or explicitly calling notifyContentChanged()) this | 96 * into this surface, or explicitly calling notifyContentChanged()) this |
83 * method will return a new value. | 97 * method will return a new value. |
84 * | 98 * |
85 * If this surface is empty (i.e. has a zero-dimention), this will return | 99 * If this surface is empty (i.e. has a zero-dimention), this will return |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 185 |
172 private: | 186 private: |
173 const int fWidth; | 187 const int fWidth; |
174 const int fHeight; | 188 const int fHeight; |
175 uint32_t fGenerationID; | 189 uint32_t fGenerationID; |
176 | 190 |
177 typedef SkRefCnt INHERITED; | 191 typedef SkRefCnt INHERITED; |
178 }; | 192 }; |
179 | 193 |
180 #endif | 194 #endif |
OLD | NEW |