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

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

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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
« no previous file with comments | « src/images/SkImageDecoder.cpp ('k') | src/images/SkImageDecoder_astc.cpp » ('j') | 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 2013 The Android Open Source Project 2 * Copyright 2013 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 #include "SkErrorInternals.h" 8 #include "SkErrorInternals.h"
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 13 matching lines...) Expand all
24 while (curr) { 24 while (curr) {
25 codec = curr->factory()(stream); 25 codec = curr->factory()(stream);
26 // we rewind here, because we promise later when we call "decode", that 26 // we rewind here, because we promise later when we call "decode", that
27 // the stream will be at its beginning. 27 // the stream will be at its beginning.
28 bool rewindSuceeded = stream->rewind(); 28 bool rewindSuceeded = stream->rewind();
29 29
30 // our image decoder's require that rewind is supported so we fail early 30 // our image decoder's require that rewind is supported so we fail early
31 // if we are given a stream that does not support rewinding. 31 // if we are given a stream that does not support rewinding.
32 if (!rewindSuceeded) { 32 if (!rewindSuceeded) {
33 SkDEBUGF(("Unable to rewind the image stream.")); 33 SkDEBUGF(("Unable to rewind the image stream."));
34 SkDELETE(codec); 34 delete codec;
35 return NULL; 35 return NULL;
36 } 36 }
37 37
38 if (codec) { 38 if (codec) {
39 return codec; 39 return codec;
40 } 40 }
41 curr = curr->next(); 41 curr = curr->next();
42 } 42 }
43 return NULL; 43 return NULL;
44 } 44 }
45 45
46 template SkImageDecoder_FormatReg* SkImageDecoder_FormatReg::gHead; 46 template SkImageDecoder_FormatReg* SkImageDecoder_FormatReg::gHead;
47 47
48 SkImageDecoder::Format SkImageDecoder::GetStreamFormat(SkStreamRewindable* strea m) { 48 SkImageDecoder::Format SkImageDecoder::GetStreamFormat(SkStreamRewindable* strea m) {
49 const SkImageDecoder_FormatReg* curr = SkImageDecoder_FormatReg::Head(); 49 const SkImageDecoder_FormatReg* curr = SkImageDecoder_FormatReg::Head();
50 while (curr != NULL) { 50 while (curr != NULL) {
51 Format format = curr->factory()(stream); 51 Format format = curr->factory()(stream);
52 if (!stream->rewind()) { 52 if (!stream->rewind()) {
53 SkErrorInternals::SetError(kInvalidOperation_SkError, 53 SkErrorInternals::SetError(kInvalidOperation_SkError,
54 "Unable to rewind the image stream\n"); 54 "Unable to rewind the image stream\n");
55 return kUnknown_Format; 55 return kUnknown_Format;
56 } 56 }
57 if (format != kUnknown_Format) { 57 if (format != kUnknown_Format) {
58 return format; 58 return format;
59 } 59 }
60 curr = curr->next(); 60 curr = curr->next();
61 } 61 }
62 return kUnknown_Format; 62 return kUnknown_Format;
63 } 63 }
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder.cpp ('k') | src/images/SkImageDecoder_astc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698