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 SkJpegCodec_DEFINED | 8 #ifndef SkJpegCodec_DEFINED |
9 #define SkJpegCodec_DEFINED | 9 #define SkJpegCodec_DEFINED |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 /* | 49 /* |
50 * Initiates the jpeg decode | 50 * Initiates the jpeg decode |
51 */ | 51 */ |
52 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes
, const Options&, | 52 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes
, const Options&, |
53 SkPMColor*, int*) override; | 53 SkPMColor*, int*) override; |
54 | 54 |
55 SkEncodedFormat onGetEncodedFormat() const override { | 55 SkEncodedFormat onGetEncodedFormat() const override { |
56 return kJPEG_SkEncodedFormat; | 56 return kJPEG_SkEncodedFormat; |
57 } | 57 } |
58 | 58 |
| 59 SkScanlineDecoder* onGetScanlineDecoder(const SkImageInfo& dstInfo, const Op
tions& options, |
| 60 SkPMColor ctable[], int* ctableCount) override; |
| 61 |
59 private: | 62 private: |
60 | 63 |
61 /* | 64 /* |
62 * Read enough of the stream to initialize the SkJpegCodec. | 65 * Read enough of the stream to initialize the SkJpegCodec. |
63 * Returns a bool representing success or failure. | 66 * Returns a bool representing success or failure. |
64 * | 67 * |
65 * @param codecOut | 68 * @param codecOut |
66 * If this returns true, and codecOut was not NULL, | 69 * If this returns true, and codecOut was not NULL, |
67 * codecOut will be set to a new SkJpegCodec. | 70 * codecOut will be set to a new SkJpegCodec. |
68 * | 71 * |
(...skipping 15 matching lines...) Expand all Loading... |
84 * Creates an instance of the decoder | 87 * Creates an instance of the decoder |
85 * Called only by NewFromStream | 88 * Called only by NewFromStream |
86 * | 89 * |
87 * @param srcInfo contains the source width and height | 90 * @param srcInfo contains the source width and height |
88 * @param stream the encoded image data | 91 * @param stream the encoded image data |
89 * @param decoderMgr holds decompress struct, src manager, and error manager | 92 * @param decoderMgr holds decompress struct, src manager, and error manager |
90 * takes ownership | 93 * takes ownership |
91 */ | 94 */ |
92 SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, JpegDecoderMgr* de
coderMgr); | 95 SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, JpegDecoderMgr* de
coderMgr); |
93 | 96 |
| 97 /* |
| 98 * Handles rewinding the input stream if it is necessary |
| 99 */ |
| 100 bool handleRewind(); |
| 101 |
| 102 /* |
| 103 * Checks if we can scale to the requested dimensions and scales the dimensi
ons |
| 104 * if possible |
| 105 */ |
| 106 bool scaleToDimensions(uint32_t width, uint32_t height); |
| 107 |
| 108 /* |
| 109 * Create the swizzler based on the encoded format |
| 110 */ |
| 111 void initializeSwizzler(const SkImageInfo& dstInfo, void* dst, size_t dstRow
Bytes, |
| 112 const Options& options); |
| 113 |
94 SkAutoTDelete<JpegDecoderMgr> fDecoderMgr; | 114 SkAutoTDelete<JpegDecoderMgr> fDecoderMgr; |
| 115 SkAutoTDelete<SkSwizzler> fSwizzler; |
| 116 size_t fSrcRowBytes; |
| 117 |
| 118 friend class SkJpegScanlineDecoder; |
95 | 119 |
96 typedef SkCodec INHERITED; | 120 typedef SkCodec INHERITED; |
97 }; | 121 }; |
98 | 122 |
99 #endif | 123 #endif |
OLD | NEW |