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_libico.cpp

Issue 340783013: Switch SkPDFStream's internal storage from SkStream to SkData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 5 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_libbmp.cpp ('k') | src/images/SkImageDecoder_pkm.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 2006 The Android Open Source Project 2 * Copyright 2006 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 "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
11 #include "SkStreamHelpers.h" 11 #include "SkStreamPriv.h"
12 #include "SkTypes.h" 12 #include "SkTypes.h"
13 13
14 class SkICOImageDecoder : public SkImageDecoder { 14 class SkICOImageDecoder : public SkImageDecoder {
15 public: 15 public:
16 SkICOImageDecoder(); 16 SkICOImageDecoder();
17 17
18 virtual Format getFormat() const SK_OVERRIDE { 18 virtual Format getFormat() const SK_OVERRIDE {
19 return kICO_Format; 19 return kICO_Format;
20 } 20 }
21 21
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 if (4 == bitCount && (w & 0x1)) { 68 if (4 == bitCount && (w & 0x1)) {
69 return (w + 1) << 2; 69 return (w + 1) << 2;
70 } 70 }
71 // Otherwise return 0, which will allow it to be calculated automatically. 71 // Otherwise return 0, which will allow it to be calculated automatically.
72 return 0; 72 return 0;
73 } 73 }
74 74
75 bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) 75 bool SkICOImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode)
76 { 76 {
77 SkAutoMalloc autoMal; 77 SkAutoMalloc autoMal;
78 const size_t length = CopyStreamToStorage(&autoMal, stream); 78 const size_t length = SkCopyStreamToStorage(&autoMal, stream);
79 if (0 == length) { 79 if (0 == length) {
80 return false; 80 return false;
81 } 81 }
82 82
83 unsigned char* buf = (unsigned char*)autoMal.get(); 83 unsigned char* buf = (unsigned char*)autoMal.get();
84 84
85 //these should always be the same - should i use for error checking? - what about files that have some 85 //these should always be the same - should i use for error checking? - what about files that have some
86 //incorrect values, but still decode properly? 86 //incorrect values, but still decode properly?
87 int reserved = read2Bytes(buf, 0); // 0 87 int reserved = read2Bytes(buf, 0); // 0
88 int type = read2Bytes(buf, 2); // 1 88 int type = read2Bytes(buf, 2); // 1
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory); 412 static SkImageDecoder_DecodeReg gReg(sk_libico_dfactory);
413 413
414 static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) { 414 static SkImageDecoder::Format get_format_ico(SkStreamRewindable* stream) {
415 if (is_ico(stream)) { 415 if (is_ico(stream)) {
416 return SkImageDecoder::kICO_Format; 416 return SkImageDecoder::kICO_Format;
417 } 417 }
418 return SkImageDecoder::kUnknown_Format; 418 return SkImageDecoder::kUnknown_Format;
419 } 419 }
420 420
421 static SkImageDecoder_FormatReg gFormatReg(get_format_ico); 421 static SkImageDecoder_FormatReg gFormatReg(get_format_ico);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libbmp.cpp ('k') | src/images/SkImageDecoder_pkm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698