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

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

Issue 1779263003: Make sp variants for SkData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « src/images/SkImageDecoder_libico.cpp ('k') | src/ports/SkImageDecoder_CG.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 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 "SkData.h" 9 #include "SkData.h"
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 16 matching lines...) Expand all
27 protected: 27 protected:
28 Result onDecode(SkStream* stream, SkBitmap* bm, Mode) override; 28 Result onDecode(SkStream* stream, SkBitmap* bm, Mode) override;
29 29
30 private: 30 private:
31 typedef SkImageDecoder INHERITED; 31 typedef SkImageDecoder INHERITED;
32 }; 32 };
33 33
34 //////////////////////////////////////////////////////////////////////////////// ///////// 34 //////////////////////////////////////////////////////////////////////////////// /////////
35 35
36 SkImageDecoder::Result SkPKMImageDecoder::onDecode(SkStream* stream, SkBitmap* b m, Mode mode) { 36 SkImageDecoder::Result SkPKMImageDecoder::onDecode(SkStream* stream, SkBitmap* b m, Mode mode) {
37 SkAutoTUnref<SkData> data(SkCopyStreamToData(stream)); 37 sk_sp<SkData> data(SkCopyStreamToData(stream));
38 if (!data || !data->size()) { 38 if (!data || !data->size()) {
39 return kFailure; 39 return kFailure;
40 } 40 }
41 41
42 unsigned char* buf = (unsigned char*) data->data(); 42 unsigned char* buf = (unsigned char*) data->data();
43 43
44 // Make sure original PKM header is there... 44 // Make sure original PKM header is there...
45 SkASSERT(etc1_pkm_is_valid(buf)); 45 SkASSERT(etc1_pkm_is_valid(buf));
46 46
47 const unsigned short width = etc1_pkm_get_width(buf); 47 const unsigned short width = etc1_pkm_get_width(buf);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory); 119 static SkImageDecoder_DecodeReg gReg(sk_libpkm_dfactory);
120 120
121 static SkImageDecoder::Format get_format_pkm(SkStreamRewindable* stream) { 121 static SkImageDecoder::Format get_format_pkm(SkStreamRewindable* stream) {
122 if (is_pkm(stream)) { 122 if (is_pkm(stream)) {
123 return SkImageDecoder::kPKM_Format; 123 return SkImageDecoder::kPKM_Format;
124 } 124 }
125 return SkImageDecoder::kUnknown_Format; 125 return SkImageDecoder::kUnknown_Format;
126 } 126 }
127 127
128 static SkImageDecoder_FormatReg gFormatReg(get_format_pkm); 128 static SkImageDecoder_FormatReg gFormatReg(get_format_pkm);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libico.cpp ('k') | src/ports/SkImageDecoder_CG.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698