OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 SkImageGenerator_DEFINED | 8 #ifndef SkImageGenerator_DEFINED |
9 #define SkImageGenerator_DEFINED | 9 #define SkImageGenerator_DEFINED |
10 | 10 |
11 #include "SkDiscardableMemory.h" | 11 #include "SkDiscardableMemory.h" |
12 #include "SkImageInfo.h" | 12 #include "SkImageInfo.h" |
13 | 13 |
14 class SkBitmap; | 14 class SkBitmap; |
15 class SkData; | 15 class SkData; |
16 class SkImageGenerator; | 16 class SkImageGenerator; |
17 | 17 |
18 /** | 18 /** |
19 * Takes ownership of SkImageGenerator. If this method fails for | 19 * Takes ownership of SkImageGenerator. If this method fails for |
20 * whatever reason, it will return false and immediatetely delete | 20 * whatever reason, it will return false and immediatetely delete |
21 * the generator. If it succeeds, it will modify destination | 21 * the generator. If it succeeds, it will modify destination |
22 * bitmap. | 22 * bitmap. |
23 * | 23 * |
| 24 * If generator is NULL, will safely return false. |
| 25 * |
24 * If this fails or when the SkDiscardablePixelRef that is | 26 * If this fails or when the SkDiscardablePixelRef that is |
25 * installed into destination is destroyed, it will call | 27 * installed into destination is destroyed, it will call |
26 * SkDELETE() on the generator. Therefore, generator should be | 28 * SkDELETE() on the generator. Therefore, generator should be |
27 * allocated with SkNEW() or SkNEW_ARGS(). | 29 * allocated with SkNEW() or SkNEW_ARGS(). |
28 * | 30 * |
29 * @param destination Upon success, this bitmap will be | 31 * @param destination Upon success, this bitmap will be |
30 * configured and have a pixelref installed. | 32 * configured and have a pixelref installed. |
31 * | 33 * |
32 * @param factory If not NULL, this object will be used as a | 34 * @param factory If not NULL, this object will be used as a |
33 * source of discardable memory when decoding. If NULL, then | 35 * source of discardable memory when decoding. If NULL, then |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 * | 92 * |
91 * @return false if anything goes wrong or if the image info is | 93 * @return false if anything goes wrong or if the image info is |
92 * unsupported. | 94 * unsupported. |
93 */ | 95 */ |
94 virtual bool getPixels(const SkImageInfo& info, | 96 virtual bool getPixels(const SkImageInfo& info, |
95 void* pixels, | 97 void* pixels, |
96 size_t rowBytes) = 0; | 98 size_t rowBytes) = 0; |
97 }; | 99 }; |
98 | 100 |
99 #endif // SkImageGenerator_DEFINED | 101 #endif // SkImageGenerator_DEFINED |
OLD | NEW |