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

Side by Side Diff: src/codec/SkCodec.cpp

Issue 1011343003: Enabling ico decoding with use of png and bmp decoders (Closed) Base URL: https://skia.googlesource.com/skia.git@swizzle
Patch Set: Removed additional blacklist items Created 5 years, 9 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 | « include/codec/SkCodec.h ('k') | src/codec/SkCodec_libbmp.h » ('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 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 #include "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkCodec_libbmp.h" 10 #include "SkCodec_libbmp.h"
11 #include "SkCodec_libico.h"
11 #include "SkCodec_libpng.h" 12 #include "SkCodec_libpng.h"
12 #include "SkStream.h" 13 #include "SkStream.h"
13 14
14 struct DecoderProc { 15 struct DecoderProc {
15 bool (*IsFormat)(SkStream*); 16 bool (*IsFormat)(SkStream*);
16 SkCodec* (*NewFromStream)(SkStream*); 17 SkCodec* (*NewFromStream)(SkStream*);
17 }; 18 };
18 19
19 static const DecoderProc gDecoderProcs[] = { 20 static const DecoderProc gDecoderProcs[] = {
20 { SkPngCodec::IsPng, SkPngCodec::NewFromStream }, 21 { SkPngCodec::IsPng, SkPngCodec::NewFromStream },
22 { SkIcoCodec::IsIco, SkIcoCodec::NewFromStream },
21 { SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream } 23 { SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream }
22 }; 24 };
23 25
24 SkCodec* SkCodec::NewFromStream(SkStream* stream) { 26 SkCodec* SkCodec::NewFromStream(SkStream* stream) {
25 if (!stream) { 27 if (!stream) {
26 return NULL; 28 return NULL;
27 } 29 }
28 for (uint32_t i = 0; i < SK_ARRAY_COUNT(gDecoderProcs); i++) { 30 for (uint32_t i = 0; i < SK_ARRAY_COUNT(gDecoderProcs); i++) {
29 DecoderProc proc = gDecoderProcs[i]; 31 DecoderProc proc = gDecoderProcs[i];
30 const bool correctFormat = proc.IsFormat(stream); 32 const bool correctFormat = proc.IsFormat(stream);
(...skipping 21 matching lines...) Expand all
52 , fNeedsRewind(false) 54 , fNeedsRewind(false)
53 {} 55 {}
54 56
55 bool SkCodec::rewindIfNeeded() { 57 bool SkCodec::rewindIfNeeded() {
56 // Store the value of fNeedsRewind so we can update it. Next read will 58 // Store the value of fNeedsRewind so we can update it. Next read will
57 // require a rewind. 59 // require a rewind.
58 const bool neededRewind = fNeedsRewind; 60 const bool neededRewind = fNeedsRewind;
59 fNeedsRewind = true; 61 fNeedsRewind = true;
60 return !neededRewind || fStream->rewind(); 62 return !neededRewind || fStream->rewind();
61 } 63 }
OLDNEW
« no previous file with comments | « include/codec/SkCodec.h ('k') | src/codec/SkCodec_libbmp.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698