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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 }; | 152 }; |
153 | 153 |
154 /** | 154 /** |
155 * Call this if the contents are about to change. This will (lazily) force
a new | 155 * Call this if the contents are about to change. This will (lazily) force
a new |
156 * value to be returned from generationID() when it is called next. | 156 * value to be returned from generationID() when it is called next. |
157 * | 157 * |
158 * CAN WE DEPRECATE THIS? | 158 * CAN WE DEPRECATE THIS? |
159 */ | 159 */ |
160 void notifyContentWillChange(ContentChangeMode mode); | 160 void notifyContentWillChange(ContentChangeMode mode); |
161 | 161 |
162 enum TextureHandleAccess { | 162 enum BackendHandleAccess { |
163 kFlushRead_TextureHandleAccess, //!< caller may read from the textur
e | 163 kFlushRead_BackendHandleAccess, //!< caller may read from the backen
d object |
164 kFlushWrite_TextureHandleAccess, //!< caller may write to the texture | 164 kFlushWrite_BackendHandleAccess, //!< caller may write to the backend
object |
165 kDiscardWrite_TextureHandleAccess, //!< caller must over-write the enti
re texture | 165 kDiscardWrite_BackendHandleAccess, //!< caller must over-write the enti
re backend object |
166 }; | 166 }; |
| 167 |
| 168 /* |
| 169 * These are legacy aliases which will be removed soon |
| 170 */ |
| 171 static const BackendHandleAccess kFlushRead_TextureHandleAccess = |
| 172 kFlushRead_BackendHandleAccess; |
| 173 static const BackendHandleAccess kFlushWrite_TextureHandleAccess = |
| 174 kFlushWrite_BackendHandleAccess; |
| 175 static const BackendHandleAccess kDiscardWrite_TextureHandleAccess = |
| 176 kDiscardWrite_BackendHandleAccess; |
| 177 |
| 178 |
167 /** | 179 /** |
168 * Retrieves the backend API handle of the texture used by this surface, or
0 if the surface | 180 * Retrieves the backend API handle of the texture used by this surface, or
0 if the surface |
169 * is not backed by a GPU texture. | 181 * is not backed by a GPU texture. |
170 * | 182 * |
171 * The returned texture-handle is only valid until the next draw-call into
the surface, | 183 * The returned texture-handle is only valid until the next draw-call into
the surface, |
172 * or the surface is deleted. | 184 * or the surface is deleted. |
173 */ | 185 */ |
174 GrBackendObject getTextureHandle(TextureHandleAccess); | 186 GrBackendObject getTextureHandle(BackendHandleAccess); |
| 187 |
| 188 /** |
| 189 * Retrieves the backend API handle of the RenderTarget backing this surfac
e. Callers must |
| 190 * ensure this function returns 'true' or else the GrBackendObject will be
invalid |
| 191 * |
| 192 * In OpenGL this will return the FramebufferObject ID. |
| 193 */ |
| 194 bool getRenderTargetHandle(GrBackendObject*, BackendHandleAccess); |
175 | 195 |
176 /** | 196 /** |
177 * Return a canvas that will draw into this surface. This will always | 197 * Return a canvas that will draw into this surface. This will always |
178 * return the same canvas for a given surface, and is manged/owned by the | 198 * return the same canvas for a given surface, and is manged/owned by the |
179 * surface. It should not be used when its parent surface has gone out of | 199 * surface. It should not be used when its parent surface has gone out of |
180 * scope. | 200 * scope. |
181 */ | 201 */ |
182 SkCanvas* getCanvas(); | 202 SkCanvas* getCanvas(); |
183 | 203 |
184 /** | 204 /** |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 private: | 281 private: |
262 const SkSurfaceProps fProps; | 282 const SkSurfaceProps fProps; |
263 const int fWidth; | 283 const int fWidth; |
264 const int fHeight; | 284 const int fHeight; |
265 uint32_t fGenerationID; | 285 uint32_t fGenerationID; |
266 | 286 |
267 typedef SkRefCnt INHERITED; | 287 typedef SkRefCnt INHERITED; |
268 }; | 288 }; |
269 | 289 |
270 #endif | 290 #endif |
OLD | NEW |