OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2007 The Android Open Source Project | 2 * Copyright 2007 The Android Open Source Project |
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 | 8 |
9 #include "SkImageDecoder.h" | 9 #include "SkImageDecoder.h" |
10 #include "SkImageEncoder.h" | 10 #include "SkImageEncoder.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 /** | 136 /** |
137 * Build the index to be used for tile based decoding. | 137 * Build the index to be used for tile based decoding. |
138 * Must only be called after a successful call to | 138 * Must only be called after a successful call to |
139 * initializeInfoAndReadHeader and must not be called more | 139 * initializeInfoAndReadHeader and must not be called more |
140 * than once. | 140 * than once. |
141 */ | 141 */ |
142 bool buildHuffmanIndex() { | 142 bool buildHuffmanIndex() { |
143 SkASSERT(fReadHeaderSucceeded); | 143 SkASSERT(fReadHeaderSucceeded); |
144 SkASSERT(!fHuffmanCreated); | 144 SkASSERT(!fHuffmanCreated); |
145 jpeg_create_huffman_index(&fCInfo, &fHuffmanIndex); | 145 jpeg_create_huffman_index(&fCInfo, &fHuffmanIndex); |
146 fHuffmanCreated = true; | |
147 SkASSERT(1 == fCInfo.scale_num && 1 == fCInfo.scale_denom); | 146 SkASSERT(1 == fCInfo.scale_num && 1 == fCInfo.scale_denom); |
148 return jpeg_build_huffman_index(&fCInfo, &fHuffmanIndex); | 147 fHuffmanCreated = jpeg_build_huffman_index(&fCInfo, &fHuffmanIndex); |
| 148 return fHuffmanCreated; |
149 } | 149 } |
150 | 150 |
151 /** | 151 /** |
152 * Start tile based decoding. Must only be called after a | 152 * Start tile based decoding. Must only be called after a |
153 * successful call to buildHuffmanIndex, and must only be | 153 * successful call to buildHuffmanIndex, and must only be |
154 * called once. | 154 * called once. |
155 */ | 155 */ |
156 bool startTileDecompress() { | 156 bool startTileDecompress() { |
157 SkASSERT(fHuffmanCreated); | 157 SkASSERT(fHuffmanCreated); |
158 SkASSERT(fReadHeaderSucceeded); | 158 SkASSERT(fReadHeaderSucceeded); |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 } | 1153 } |
1154 | 1154 |
1155 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { | 1155 static SkImageEncoder* sk_libjpeg_efactory(SkImageEncoder::Type t) { |
1156 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; | 1156 return (SkImageEncoder::kJPEG_Type == t) ? SkNEW(SkJPEGImageEncoder) : NULL; |
1157 } | 1157 } |
1158 | 1158 |
1159 | 1159 |
1160 static SkTRegistry<SkImageDecoder*, SkStream*> gDReg(sk_libjpeg_dfactory); | 1160 static SkTRegistry<SkImageDecoder*, SkStream*> gDReg(sk_libjpeg_dfactory); |
1161 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_jpeg
); | 1161 static SkTRegistry<SkImageDecoder::Format, SkStream*> gFormatReg(get_format_jpeg
); |
1162 static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(sk_libjpeg_efact
ory); | 1162 static SkTRegistry<SkImageEncoder*, SkImageEncoder::Type> gEReg(sk_libjpeg_efact
ory); |
OLD | NEW |