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 * | |
26 * If this fails or when the SkDiscardablePixelRef that is | 24 * If this fails or when the SkDiscardablePixelRef that is |
27 * installed into destination is destroyed, it will call | 25 * installed into destination is destroyed, it will call |
28 * SkDELETE() on the generator. Therefore, generator should be | 26 * SkDELETE() on the generator. Therefore, generator should be |
29 * allocated with SkNEW() or SkNEW_ARGS(). | 27 * allocated with SkNEW() or SkNEW_ARGS(). |
30 * | 28 * |
31 * @param destination Upon success, this bitmap will be | 29 * @param destination Upon success, this bitmap will be |
32 * configured and have a pixelref installed. | 30 * configured and have a pixelref installed. |
33 * | 31 * |
34 * @param factory If not NULL, this object will be used as a | 32 * @param factory If not NULL, this object will be used as a |
35 * source of discardable memory when decoding. If NULL, then | 33 * source of discardable memory when decoding. If NULL, then |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 * | 90 * |
93 * @return false if anything goes wrong or if the image info is | 91 * @return false if anything goes wrong or if the image info is |
94 * unsupported. | 92 * unsupported. |
95 */ | 93 */ |
96 virtual bool getPixels(const SkImageInfo& info, | 94 virtual bool getPixels(const SkImageInfo& info, |
97 void* pixels, | 95 void* pixels, |
98 size_t rowBytes) = 0; | 96 size_t rowBytes) = 0; |
99 }; | 97 }; |
100 | 98 |
101 #endif // SkImageGenerator_DEFINED | 99 #endif // SkImageGenerator_DEFINED |
OLD | NEW |