OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2013 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef SkImageGenerator_DEFINED |
| 9 #define SkImageGenerator_DEFINED |
| 10 |
| 11 #include "SkImageInfo.h" |
| 12 |
| 13 class SkData; |
| 14 |
| 15 /** |
| 16 * An interface that allows a purgable PixelRef to re-decode an image. |
| 17 */ |
| 18 class SkImageGenerator { |
| 19 public: |
| 20 virtual ~SkImageGenerator(); |
| 21 |
| 22 /** |
| 23 * Return a ref to the encoded (i.e. compressed) representation, |
| 24 * of this data. |
| 25 * |
| 26 * If non-NULL is returned, the caller is responsible for calling |
| 27 * unref() on the data when it is finished. |
| 28 */ |
| 29 virtual SkData* refEncodedData() { return NULL; } |
| 30 |
| 31 /** |
| 32 * Return some information about the image, allowing the owner fo |
| 33 * this ojbect to allocate pixels. |
| 34 * |
| 35 * @return false if anything goes wrong. |
| 36 */ |
| 37 virtual bool getInfo(SkImageInfo* info) = 0; |
| 38 |
| 39 /** |
| 40 * Decode into the given pixels, a block of memory of size at |
| 41 * least (info.fHeight - 1) * rowBytes + (info.fWidth * |
| 42 * bytesPerPixel) |
| 43 * |
| 44 * @param info Should be identical to the info returned by |
| 45 * getInfo so that the implementation can confirm that the |
| 46 * caller knows what it is asking for (config, size). |
| 47 * This contract also allows the caller to specify |
| 48 * different output-configs, which the implementation can |
| 49 * decide to support or not. |
| 50 * |
| 51 * @return false if anything goes wrong. |
| 52 */ |
| 53 virtual bool getPixels(const SkImageInfo& info, |
| 54 void* pixels, |
| 55 size_t rowBytes) = 0; |
| 56 }; |
| 57 |
| 58 #endif // SkImageGenerator_DEFINED |
OLD | NEW |