Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(617)

Side by Side Diff: src/images/SkImageDecoder_libjpeg.cpp

Issue 22859042: Only destroy huffman if build succeeded. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698