Chromium Code Reviews| 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: |
|
djsollen
2015/11/30 17:52:52
not NULL then:
msarett
2015/11/30 18:05:49
Done.
| |
| 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 and | |
|
djsollen
2015/11/30 17:52:52
don't say that is is passed to libpng
msarett
2015/11/30 18:05:49
Done.
| |
| 35 * passed to libpng. | |
| 36 * If the PNG has unknown chunks, the SkPngChunkReader will be used | |
| 37 * to handle these chunks. libpng may call the SkPngChunkReader to | |
|
djsollen
2015/11/30 17:52:52
SkPngChunkReader will be called to read any unknow
msarett
2015/11/30 18:05:49
Done.
| |
| 38 * read an unknown chunk at any point during the creation of the | |
| 39 * codec or the decode. Note that if SkPngChunkReader fails to | |
| 40 * read a chunk, this could result in a failure to create the codec | |
| 41 * or a failure to decode the image. | |
| 42 * If the PNG does not contain unknown chunks, the SkPngChunkReader | |
| 43 * will not be used or modified. | |
| 34 * | 44 * |
| 35 * If NULL is returned, the stream is deleted immediately. Otherwise, the | 45 * 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. | 46 * SkCodec takes ownership of it, and will delete it when done with it. |
| 37 */ | 47 */ |
| 38 static SkCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL); | 48 static SkCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL); |
| 39 | 49 |
| 40 /** | 50 /** |
| 41 * If this data represents an encoded image that we know how to decode, | 51 * If this data represents an encoded image that we know how to decode, |
| 42 * return an SkCodec that can decode it. Otherwise return NULL. | 52 * return an SkCodec that can decode it. Otherwise return NULL. |
| 43 * | 53 * |
| 44 * If SkPngChunkReader is not NULL, take a ref and pass it to libpng if | 54 * If the SkPngChunkReader is not NULL: |
| 45 * the image is a png. | 55 * If the image is not a PNG, the SkPngChunkReader will be ignored. |
| 56 * If the image is a PNG, the SkPngChunkReader will be reffed and | |
| 57 * passed to libpng. | |
| 58 * If the PNG has unknown chunks, the SkPngChunkReader will be used | |
| 59 * to handle these chunks. libpng may call the SkPngChunkReader to | |
| 60 * read an unknown chunk at any point during the creation of the | |
| 61 * codec or the decode. Note that if SkPngChunkReader fails to | |
| 62 * read a chunk, this could result in a failure to create the codec | |
| 63 * or a failure to decode the image. | |
| 64 * If the PNG does not contain unknown chunks, the SkPngChunkReader | |
| 65 * will not be used or modified. | |
| 46 * | 66 * |
| 47 * Will take a ref if it returns a codec, else will not affect the data. | 67 * Will take a ref if it returns a codec, else will not affect the data. |
| 48 */ | 68 */ |
| 49 static SkCodec* NewFromData(SkData*, SkPngChunkReader* = NULL); | 69 static SkCodec* NewFromData(SkData*, SkPngChunkReader* = NULL); |
| 50 | 70 |
| 51 virtual ~SkCodec(); | 71 virtual ~SkCodec(); |
| 52 | 72 |
| 53 /** | 73 /** |
| 54 * Return the ImageInfo associated with this codec. | 74 * Return the ImageInfo associated with this codec. |
| 55 */ | 75 */ |
| (...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 | 607 * May create a sampler, if one is not currently being used. Otherwise, doe s |
| 588 * not affect ownership. | 608 * not affect ownership. |
| 589 * | 609 * |
| 590 * Only valid during scanline decoding. | 610 * Only valid during scanline decoding. |
| 591 */ | 611 */ |
| 592 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; } | 612 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; } |
| 593 | 613 |
| 594 friend class SkSampledCodec; | 614 friend class SkSampledCodec; |
| 595 }; | 615 }; |
| 596 #endif // SkCodec_DEFINED | 616 #endif // SkCodec_DEFINED |
| OLD | NEW |