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

Side by Side Diff: src/images/SkImageDecoder_pkm.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_libico.cpp ('k') | src/images/SkStreamHelpers.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 2014 Google Inc. 2 * Copyright 2014 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 "SkColorPriv.h" 8 #include "SkColorPriv.h"
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkScaledBitmapSampler.h" 10 #include "SkScaledBitmapSampler.h"
11 #include "SkStream.h" 11 #include "SkStream.h"
12 #include "SkStreamHelpers.h" 12 #include "SkStreamPriv.h"
13 #include "SkTypes.h" 13 #include "SkTypes.h"
14 14
15 #include "etc1.h" 15 #include "etc1.h"
16 16
17 class SkPKMImageDecoder : public SkImageDecoder { 17 class SkPKMImageDecoder : public SkImageDecoder {
18 public: 18 public:
19 SkPKMImageDecoder() { } 19 SkPKMImageDecoder() { }
20 20
21 virtual Format getFormat() const SK_OVERRIDE { 21 virtual Format getFormat() const SK_OVERRIDE {
22 return kPKM_Format; 22 return kPKM_Format;
23 } 23 }
24 24
25 protected: 25 protected:
26 virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; 26 virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE;
27 27
28 private: 28 private:
29 typedef SkImageDecoder INHERITED; 29 typedef SkImageDecoder INHERITED;
30 }; 30 };
31 31
32 //////////////////////////////////////////////////////////////////////////////// ///////// 32 //////////////////////////////////////////////////////////////////////////////// /////////
33 33
34 bool SkPKMImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { 34 bool SkPKMImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) {
35 SkAutoMalloc autoMal; 35 SkAutoMalloc autoMal;
36 const size_t length = CopyStreamToStorage(&autoMal, stream); 36 const size_t length = SkCopyStreamToStorage(&autoMal, stream);
37 if (0 == length) { 37 if (0 == length) {
38 return false; 38 return false;
39 } 39 }
40 40
41 unsigned char* buf = (unsigned char*)autoMal.get(); 41 unsigned char* buf = (unsigned char*)autoMal.get();
42 42
43 // Make sure original PKM header is there... 43 // Make sure original PKM header is there...
44 SkASSERT(etc1_pkm_is_valid(buf)); 44 SkASSERT(etc1_pkm_is_valid(buf));
45 45
46 const unsigned short width = etc1_pkm_get_width(buf); 46 const unsigned short width = etc1_pkm_get_width(buf);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory); 124 static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory);
125 125
126 static SkImageDecoder::Format get_format_pkm(SkStreamRewindable* stream) { 126 static SkImageDecoder::Format get_format_pkm(SkStreamRewindable* stream) {
127 if (is_pkm(stream)) { 127 if (is_pkm(stream)) {
128 return SkImageDecoder::kPKM_Format; 128 return SkImageDecoder::kPKM_Format;
129 } 129 }
130 return SkImageDecoder::kUnknown_Format; 130 return SkImageDecoder::kUnknown_Format;
131 } 131 }
132 132
133 static SkImageDecoder_FormatReg gFormatReg(get_format_pkm); 133 static SkImageDecoder_FormatReg gFormatReg(get_format_pkm);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libico.cpp ('k') | src/images/SkStreamHelpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698