Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
| 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 SkPicture_DEFINED | 8 #ifndef SkPicture_DEFINED |
| 9 #define SkPicture_DEFINED | 9 #define SkPicture_DEFINED |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 * If the installed pixelref has decoded the data into pixels, then the src buffer need not be | 39 * If the installed pixelref has decoded the data into pixels, then the src buffer need not be |
| 40 * copied. If the pixelref defers the actual decode until its lockPixels() is called, then it | 40 * copied. If the pixelref defers the actual decode until its lockPixels() is called, then it |
| 41 * must make a copy of the src buffer. | 41 * must make a copy of the src buffer. |
| 42 * @param src Encoded data. | 42 * @param src Encoded data. |
| 43 * @param length Size of the encoded data, in bytes. | 43 * @param length Size of the encoded data, in bytes. |
| 44 * @param dst SkBitmap to install the pixel ref on. | 44 * @param dst SkBitmap to install the pixel ref on. |
| 45 * @param bool Whether or not a pixel ref was successfully installed. | 45 * @param bool Whether or not a pixel ref was successfully installed. |
| 46 */ | 46 */ |
| 47 typedef bool (*InstallPixelRefProc)(const void* src, size_t length, SkBitmap * dst); | 47 typedef bool (*InstallPixelRefProc)(const void* src, size_t length, SkBitmap * dst); |
| 48 | 48 |
| 49 // FIXME: Replace this with an interface that creates an SkImageGenerator. | |
| 50 // skbug.com/4883 | |
| 51 // skbug.com/4290 | |
| 52 static bool DefaultInstall(const void*, size_t, SkBitmap*); | |
| 53 | |
| 49 /** | 54 /** |
| 50 * Recreate a picture that was serialized into a stream. | 55 * Recreate a picture that was serialized into a stream. |
| 51 * @param SkStream Serialized picture data. Ownership is unchanged by this call. | 56 * @param SkStream Serialized picture data. Ownership is unchanged by this call. |
| 52 * @param proc Function pointer for installing pixelrefs on SkBitmaps repre senting the | 57 * @param proc Function pointer for installing pixelrefs on SkBitmaps repre senting the |
| 53 * encoded bitmap data from the stream. | 58 * encoded bitmap data from the stream. |
| 54 * @return A new SkPicture representing the serialized data, or NULL if the stream is | 59 * @return A new SkPicture representing the serialized data, or NULL if the stream is |
| 55 * invalid. | 60 * invalid. |
| 56 */ | 61 */ |
| 57 static SkPicture* CreateFromStream(SkStream*, | 62 static SkPicture* CreateFromStream(SkStream*, InstallPixelRefProc proc = &De faultInstall); |
|
reed1
2016/02/09 15:29:53
Do we need to expose DefaultInstall() directly? i.
scroggo
2016/02/09 16:12:17
Done.
| |
| 58 InstallPixelRefProc proc = &SkImageDecode r::DecodeMemory); | |
| 59 | 63 |
| 60 /** | 64 /** |
| 61 * Recreate a picture that was serialized into a buffer. If the creation re quires bitmap | 65 * Recreate a picture that was serialized into a buffer. If the creation re quires bitmap |
| 62 * decoding, the decoder must be set on the SkReadBuffer parameter by calli ng | 66 * decoding, the decoder must be set on the SkReadBuffer parameter by calli ng |
| 63 * SkReadBuffer::setBitmapDecoder() before calling SkPicture::CreateFromBuf fer(). | 67 * SkReadBuffer::setBitmapDecoder() before calling SkPicture::CreateFromBuf fer(). |
| 64 * @param SkReadBuffer Serialized picture data. | 68 * @param SkReadBuffer Serialized picture data. |
| 65 * @return A new SkPicture representing the serialized data, or NULL if the buffer is | 69 * @return A new SkPicture representing the serialized data, or NULL if the buffer is |
| 66 * invalid. | 70 * invalid. |
| 67 */ | 71 */ |
| 68 static SkPicture* CreateFromBuffer(SkReadBuffer&); | 72 static SkPicture* CreateFromBuffer(SkReadBuffer&); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 198 static bool IsValidPictInfo(const SkPictInfo& info); | 202 static bool IsValidPictInfo(const SkPictInfo& info); |
| 199 static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*); | 203 static SkPicture* Forwardport(const SkPictInfo&, const SkPictureData*); |
| 200 | 204 |
| 201 SkPictInfo createHeader() const; | 205 SkPictInfo createHeader() const; |
| 202 SkPictureData* backport() const; | 206 SkPictureData* backport() const; |
| 203 | 207 |
| 204 mutable uint32_t fUniqueID; | 208 mutable uint32_t fUniqueID; |
| 205 }; | 209 }; |
| 206 | 210 |
| 207 #endif | 211 #endif |
| OLD | NEW |