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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 * | 30 * |
31 * If non-NULL is returned, the caller is responsible for calling | 31 * If non-NULL is returned, the caller is responsible for calling |
32 * unref() on the data when it is finished. | 32 * unref() on the data when it is finished. |
33 */ | 33 */ |
34 virtual SkData* refEncodedData() { return NULL; } | 34 virtual SkData* refEncodedData() { return NULL; } |
35 | 35 |
36 /** | 36 /** |
37 * Return some information about the image, allowing the owner of | 37 * Return some information about the image, allowing the owner of |
38 * this object to allocate pixels. | 38 * this object to allocate pixels. |
39 * | 39 * |
| 40 * Repeated calls to this function should give the same results, |
| 41 * allowing the PixelRef to be immutable. |
| 42 * |
40 * @return false if anything goes wrong. | 43 * @return false if anything goes wrong. |
41 */ | 44 */ |
42 virtual bool getInfo(SkImageInfo* info) = 0; | 45 virtual bool getInfo(SkImageInfo* info) = 0; |
43 | 46 |
44 /** | 47 /** |
45 * Decode into the given pixels, a block of memory of size at | 48 * Decode into the given pixels, a block of memory of size at |
46 * least (info.fHeight - 1) * rowBytes + (info.fWidth * | 49 * least (info.fHeight - 1) * rowBytes + (info.fWidth * |
47 * bytesPerPixel) | 50 * bytesPerPixel) |
48 * | 51 * |
| 52 * Repeated calls to this function should give the same results, |
| 53 * allowing the PixelRef to be immutable. |
| 54 * |
49 * @param info A description of the format (config, size) | 55 * @param info A description of the format (config, size) |
50 * expected by the caller. This can simply be identical | 56 * expected by the caller. This can simply be identical |
51 * to the info returned by getInfo(). | 57 * to the info returned by getInfo(). |
52 * | 58 * |
53 * This contract also allows the caller to specify | 59 * This contract also allows the caller to specify |
54 * different output-configs, which the implementation can | 60 * different output-configs, which the implementation can |
55 * decide to support or not. | 61 * decide to support or not. |
56 * | 62 * |
57 * @return false if anything goes wrong or if the image info is | 63 * @return false if anything goes wrong or if the image info is |
58 * unsupported. | 64 * unsupported. |
59 */ | 65 */ |
60 virtual bool getPixels(const SkImageInfo& info, | 66 virtual bool getPixels(const SkImageInfo& info, |
61 void* pixels, | 67 void* pixels, |
62 size_t rowBytes) = 0; | 68 size_t rowBytes) = 0; |
63 }; | 69 }; |
64 | 70 |
65 #endif // SkImageGenerator_DEFINED | 71 #endif // SkImageGenerator_DEFINED |
OLD | NEW |