OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkPixelRef_DEFINED | 10 #ifndef SkPixelRef_DEFINED |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 * For pixelrefs that don't have access to their raw pixels, they may be | 250 * For pixelrefs that don't have access to their raw pixels, they may be |
251 * able to make a copy of them (e.g. if the pixels are on the GPU). | 251 * able to make a copy of them (e.g. if the pixels are on the GPU). |
252 * | 252 * |
253 * The base class implementation returns false; | 253 * The base class implementation returns false; |
254 */ | 254 */ |
255 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subsetOrNull); | 255 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subsetOrNull); |
256 | 256 |
257 // default impl returns NULL. | 257 // default impl returns NULL. |
258 virtual SkData* onRefEncodedData(); | 258 virtual SkData* onRefEncodedData(); |
259 | 259 |
| 260 /** |
| 261 * Returns the size (in bytes) of the internally allocated memory. |
| 262 * This should be implemented in all serializable SkPixelRef derived classe
s. |
| 263 * SkBitmap::fPixelRefOffset + SkBitmap::getSafeSize() should never overflo
w this value, |
| 264 * otherwise the rendering code may attempt to read memory out of bounds. |
| 265 * |
| 266 * @return default impl returns 0. |
| 267 */ |
| 268 virtual size_t getAllocatedSizeInBytes() const; |
| 269 |
260 /** Return the mutex associated with this pixelref. This value is assigned | 270 /** Return the mutex associated with this pixelref. This value is assigned |
261 in the constructor, and cannot change during the lifetime of the object. | 271 in the constructor, and cannot change during the lifetime of the object. |
262 */ | 272 */ |
263 SkBaseMutex* mutex() const { return fMutex; } | 273 SkBaseMutex* mutex() const { return fMutex; } |
264 | 274 |
265 // serialization | 275 // serialization |
266 SkPixelRef(SkFlattenableReadBuffer&, SkBaseMutex*); | 276 SkPixelRef(SkFlattenableReadBuffer&, SkBaseMutex*); |
267 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 277 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
268 | 278 |
269 // only call from constructor. Flags this to always be locked, removing | 279 // only call from constructor. Flags this to always be locked, removing |
(...skipping 26 matching lines...) Expand all Loading... |
296 | 306 |
297 // When copying a bitmap to another with the same shape and config, we can s
afely | 307 // When copying a bitmap to another with the same shape and config, we can s
afely |
298 // clone the pixelref generation ID too, which makes them equivalent under c
aching. | 308 // clone the pixelref generation ID too, which makes them equivalent under c
aching. |
299 friend class SkBitmap; // only for cloneGenID | 309 friend class SkBitmap; // only for cloneGenID |
300 void cloneGenID(const SkPixelRef&); | 310 void cloneGenID(const SkPixelRef&); |
301 | 311 |
302 typedef SkFlattenable INHERITED; | 312 typedef SkFlattenable INHERITED; |
303 }; | 313 }; |
304 | 314 |
305 #endif | 315 #endif |
OLD | NEW |