OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 SkCodec_DEFINED | 8 #ifndef SkCodec_DEFINED |
9 #define SkCodec_DEFINED | 9 #define SkCodec_DEFINED |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 /** | 23 /** |
24 * Abstraction layer directly on top of an image codec. | 24 * Abstraction layer directly on top of an image codec. |
25 */ | 25 */ |
26 class SkCodec : SkNoncopyable { | 26 class SkCodec : SkNoncopyable { |
27 public: | 27 public: |
28 /** | 28 /** |
29 * If this stream represents an encoded image that we know how to decode, | 29 * If this stream represents an encoded image that we know how to decode, |
30 * return an SkCodec that can decode it. Otherwise return NULL. | 30 * return an SkCodec that can decode it. Otherwise return NULL. |
31 * | 31 * |
32 * If SkPngChunkReader is not NULL, take a ref and pass it to libpng if | 32 * If the SkPngChunkReader is not NULL then: |
33 * the image is a png. | 33 * If the image is not a PNG, the SkPngChunkReader will be ignored. |
| 34 * If the image is a PNG, the SkPngChunkReader will be reffed. |
| 35 * If the PNG has unknown chunks, the SkPngChunkReader will be used |
| 36 * to handle these chunks. SkPngChunkReader will be called to read |
| 37 * any unknown chunk at any point during the creation of the codec |
| 38 * or the decode. Note that if SkPngChunkReader fails to read a |
| 39 * chunk, this could result in a failure to create the codec or a |
| 40 * failure to decode the image. |
| 41 * If the PNG does not contain unknown chunks, the SkPngChunkReader |
| 42 * will not be used or modified. |
34 * | 43 * |
35 * If NULL is returned, the stream is deleted immediately. Otherwise, the | 44 * If NULL is returned, the stream is deleted immediately. Otherwise, the |
36 * SkCodec takes ownership of it, and will delete it when done with it. | 45 * SkCodec takes ownership of it, and will delete it when done with it. |
37 */ | 46 */ |
38 static SkCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL); | 47 static SkCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL); |
39 | 48 |
40 /** | 49 /** |
41 * If this data represents an encoded image that we know how to decode, | 50 * If this data represents an encoded image that we know how to decode, |
42 * return an SkCodec that can decode it. Otherwise return NULL. | 51 * return an SkCodec that can decode it. Otherwise return NULL. |
43 * | 52 * |
44 * If SkPngChunkReader is not NULL, take a ref and pass it to libpng if | 53 * If the SkPngChunkReader is not NULL then: |
45 * the image is a png. | 54 * If the image is not a PNG, the SkPngChunkReader will be ignored. |
| 55 * If the image is a PNG, the SkPngChunkReader will be reffed. |
| 56 * If the PNG has unknown chunks, the SkPngChunkReader will be used |
| 57 * to handle these chunks. SkPngChunkReader will be called to read |
| 58 * any unknown chunk at any point during the creation of the codec |
| 59 * or the decode. Note that if SkPngChunkReader fails to read a |
| 60 * chunk, this could result in a failure to create the codec or a |
| 61 * failure to decode the image. |
| 62 * If the PNG does not contain unknown chunks, the SkPngChunkReader |
| 63 * will not be used or modified. |
46 * | 64 * |
47 * Will take a ref if it returns a codec, else will not affect the data. | 65 * Will take a ref if it returns a codec, else will not affect the data. |
48 */ | 66 */ |
49 static SkCodec* NewFromData(SkData*, SkPngChunkReader* = NULL); | 67 static SkCodec* NewFromData(SkData*, SkPngChunkReader* = NULL); |
50 | 68 |
51 virtual ~SkCodec(); | 69 virtual ~SkCodec(); |
52 | 70 |
53 /** | 71 /** |
54 * Return the ImageInfo associated with this codec. | 72 * Return the ImageInfo associated with this codec. |
55 */ | 73 */ |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 * May create a sampler, if one is not currently being used. Otherwise, doe
s | 605 * May create a sampler, if one is not currently being used. Otherwise, doe
s |
588 * not affect ownership. | 606 * not affect ownership. |
589 * | 607 * |
590 * Only valid during scanline decoding. | 608 * Only valid during scanline decoding. |
591 */ | 609 */ |
592 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} | 610 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} |
593 | 611 |
594 friend class SkSampledCodec; | 612 friend class SkSampledCodec; |
595 }; | 613 }; |
596 #endif // SkCodec_DEFINED | 614 #endif // SkCodec_DEFINED |
OLD | NEW |