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 SkImage_DEFINED | 8 #ifndef SkImage_DEFINED |
9 #define SkImage_DEFINED | 9 #define SkImage_DEFINED |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 /** | 170 /** |
171 * If the image has direct access to its pixels (i.e. they are in local | 171 * If the image has direct access to its pixels (i.e. they are in local |
172 * RAM) return the (const) address of those pixels, and if not null, return | 172 * RAM) return the (const) address of those pixels, and if not null, return |
173 * true, and if pixmap is not NULL, set it to point into the image. | 173 * true, and if pixmap is not NULL, set it to point into the image. |
174 * | 174 * |
175 * On failure, return false and ignore the pixmap parameter. | 175 * On failure, return false and ignore the pixmap parameter. |
176 */ | 176 */ |
177 bool peekPixels(SkPixmap* pixmap) const; | 177 bool peekPixels(SkPixmap* pixmap) const; |
178 | 178 |
| 179 /** |
| 180 * Some images have to perform preliminary work in preparation for drawing.
This can be |
| 181 * decoding, uploading to a GPU, or other tasks. These happen automatically
when an image |
| 182 * is drawn, and often they are cached so that the cost is only paid the fi
rst time. |
| 183 * |
| 184 * Preroll() can be called before drawing to try to perform this prepatory
work ahead of time. |
| 185 * For images that have no such work, this returns instantly. Others may do
some thing to |
| 186 * prepare their cache and then return. |
| 187 * |
| 188 * If the image will drawn to a GPU-backed canvas or surface, pass the asso
ciated GrContext. |
| 189 * If the image will be drawn to any other type of canvas or surface, pass
null. |
| 190 */ |
| 191 void preroll(GrContext* = nullptr) const; |
| 192 |
179 // DEPRECATED | 193 // DEPRECATED |
180 GrTexture* getTexture() const; | 194 GrTexture* getTexture() const; |
181 | 195 |
182 /** | 196 /** |
183 * Returns true if the image is texture backed. | 197 * Returns true if the image is texture backed. |
184 */ | 198 */ |
185 bool isTextureBacked() const; | 199 bool isTextureBacked() const; |
186 | 200 |
187 /** | 201 /** |
188 * Retrieves the backend API handle of the texture. If flushPendingGrContex
tIO then the | 202 * Retrieves the backend API handle of the texture. If flushPendingGrContex
tIO then the |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 313 |
300 private: | 314 private: |
301 const int fWidth; | 315 const int fWidth; |
302 const int fHeight; | 316 const int fHeight; |
303 const uint32_t fUniqueID; | 317 const uint32_t fUniqueID; |
304 | 318 |
305 typedef SkRefCnt INHERITED; | 319 typedef SkRefCnt INHERITED; |
306 }; | 320 }; |
307 | 321 |
308 #endif | 322 #endif |
OLD | NEW |