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 |
11 #include "../private/SkTemplates.h" | 11 #include "../private/SkTemplates.h" |
12 #include "SkColor.h" | 12 #include "SkColor.h" |
13 #include "SkEncodedFormat.h" | 13 #include "SkEncodedFormat.h" |
14 #include "SkImageInfo.h" | 14 #include "SkImageInfo.h" |
15 #include "SkSize.h" | 15 #include "SkSize.h" |
16 #include "SkStream.h" | 16 #include "SkStream.h" |
17 #include "SkTypes.h" | 17 #include "SkTypes.h" |
18 | 18 |
19 class SkData; | 19 class SkData; |
20 class SkPngChunkReader; | |
21 class SkSampler; | 20 class SkSampler; |
22 | 21 |
23 /** | 22 /** |
24 * Abstraction layer directly on top of an image codec. | 23 * Abstraction layer directly on top of an image codec. |
25 */ | 24 */ |
26 class SkCodec : SkNoncopyable { | 25 class SkCodec : SkNoncopyable { |
27 public: | 26 public: |
28 /** | 27 /** |
29 * If this stream represents an encoded image that we know how to decode, | 28 * If this stream represents an encoded image that we know how to decode, |
30 * return an SkCodec that can decode it. Otherwise return NULL. | 29 * return an SkCodec that can decode it. Otherwise return NULL. |
31 * | 30 * |
32 * If SkPngChunkReader is not NULL, take a ref and pass it to libpng if | |
33 * the image is a png. | |
34 * | |
35 * If NULL is returned, the stream is deleted immediately. Otherwise, the | 31 * 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. | 32 * SkCodec takes ownership of it, and will delete it when done with it. |
37 */ | 33 */ |
38 static SkCodec* NewFromStream(SkStream*, SkPngChunkReader* = NULL); | 34 static SkCodec* NewFromStream(SkStream*); |
39 | 35 |
40 /** | 36 /** |
41 * If this data represents an encoded image that we know how to decode, | 37 * If this data represents an encoded image that we know how to decode, |
42 * return an SkCodec that can decode it. Otherwise return NULL. | 38 * return an SkCodec that can decode it. Otherwise return NULL. |
43 * | 39 * |
44 * If SkPngChunkReader is not NULL, take a ref and pass it to libpng if | |
45 * the image is a png. | |
46 * | |
47 * Will take a ref if it returns a codec, else will not affect the data. | 40 * Will take a ref if it returns a codec, else will not affect the data. |
48 */ | 41 */ |
49 static SkCodec* NewFromData(SkData*, SkPngChunkReader* = NULL); | 42 static SkCodec* NewFromData(SkData*); |
50 | 43 |
51 virtual ~SkCodec(); | 44 virtual ~SkCodec(); |
52 | 45 |
53 /** | 46 /** |
54 * Return the ImageInfo associated with this codec. | 47 * Return the ImageInfo associated with this codec. |
55 */ | 48 */ |
56 const SkImageInfo& getInfo() const { return fSrcInfo; } | 49 const SkImageInfo& getInfo() const { return fSrcInfo; } |
57 | 50 |
58 /** | 51 /** |
59 * Return a size that approximately supports the desired scale factor. | 52 * Return a size that approximately supports the desired scale factor. |
(...skipping 527 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 | 580 * May create a sampler, if one is not currently being used. Otherwise, doe
s |
588 * not affect ownership. | 581 * not affect ownership. |
589 * | 582 * |
590 * Only valid during scanline decoding. | 583 * Only valid during scanline decoding. |
591 */ | 584 */ |
592 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} | 585 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} |
593 | 586 |
594 friend class SkSampledCodec; | 587 friend class SkSampledCodec; |
595 }; | 588 }; |
596 #endif // SkCodec_DEFINED | 589 #endif // SkCodec_DEFINED |
OLD | NEW |