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

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

Issue 14363003: Updates to skimage tool to use it for testing. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: GetFormat -> GetStreamFormat Created 7 years, 7 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 | « src/images/SkImageDecoder.cpp ('k') | src/images/SkImageDecoder_libbmp.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 "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
9 #include "SkStream.h" 10 #include "SkStream.h"
10 #include "SkTRegistry.h" 11 #include "SkTRegistry.h"
11 12
12 // This file is used for registration of SkImageDecoders. It also holds a functi on 13 // This file is used for registration of SkImageDecoders. It also holds a functi on
13 // for checking all the the registered SkImageDecoders for one that matches an 14 // for checking all the the registered SkImageDecoders for one that matches an
14 // input SkStream. 15 // input SkStream.
15 16
16 typedef SkTRegistry<SkImageDecoder*, SkStream*> DecodeReg; 17 typedef SkTRegistry<SkImageDecoder*, SkStream*> DecodeReg;
17 18
(...skipping 20 matching lines...) Expand all
38 return NULL; 39 return NULL;
39 } 40 }
40 41
41 if (codec) { 42 if (codec) {
42 return codec; 43 return codec;
43 } 44 }
44 curr = curr->next(); 45 curr = curr->next();
45 } 46 }
46 return NULL; 47 return NULL;
47 } 48 }
49
50 typedef SkTRegistry<SkImageDecoder::Format, SkStream*> FormatReg;
51
52 template FormatReg* SkTRegistry<SkImageDecoder::Format, SkStream*>::gHead;
53
54 SkImageDecoder::Format SkImageDecoder::GetStreamFormat(SkStream* stream) {
55 const FormatReg* curr = FormatReg::Head();
56 while (curr != NULL) {
57 Format format = curr->factory()(stream);
58 if (!stream->rewind()) {
59 SkErrorInternals::SetError(kInvalidOperation_SkError,
60 "Unable to rewind the image stream\n");
61 return kUnknown_Format;
62 }
63 if (format != kUnknown_Format) {
64 return format;
65 }
66 curr = curr->next();
67 }
68 return kUnknown_Format;
69 }
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder.cpp ('k') | src/images/SkImageDecoder_libbmp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698