OLD | NEW |
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 "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
11 #include "SkScaledBitmapSampler.h" | 11 #include "SkScaledBitmapSampler.h" |
12 #include "SkStream.h" | 12 #include "SkStream.h" |
13 #include "SkStreamHelpers.h" | 13 #include "SkStreamPriv.h" |
14 #include "SkTypes.h" | 14 #include "SkTypes.h" |
15 | 15 |
16 #include "ktx.h" | 16 #include "ktx.h" |
17 #include "etc1.h" | 17 #include "etc1.h" |
18 | 18 |
19 ////////////////////////////////////////////////////////////////////////////////
///////// | 19 ////////////////////////////////////////////////////////////////////////////////
///////// |
20 | 20 |
21 | 21 |
22 ////////////////////////////////////////////////////////////////////////////////
///////// | 22 ////////////////////////////////////////////////////////////////////////////////
///////// |
23 | 23 |
(...skipping 18 matching lines...) Expand all Loading... |
42 | 42 |
43 protected: | 43 protected: |
44 virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; | 44 virtual bool onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; |
45 | 45 |
46 private: | 46 private: |
47 typedef SkImageDecoder INHERITED; | 47 typedef SkImageDecoder INHERITED; |
48 }; | 48 }; |
49 | 49 |
50 bool SkKTXImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { | 50 bool SkKTXImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { |
51 // TODO: Implement SkStream::copyToData() that's cheap for memory and file s
treams | 51 // TODO: Implement SkStream::copyToData() that's cheap for memory and file s
treams |
52 SkAutoDataUnref data(CopyStreamToData(stream)); | 52 SkAutoDataUnref data(SkCopyStreamToData(stream)); |
53 if (NULL == data) { | 53 if (NULL == data) { |
54 return false; | 54 return false; |
55 } | 55 } |
56 | 56 |
57 SkKTXFile ktxFile(data); | 57 SkKTXFile ktxFile(data); |
58 if (!ktxFile.valid()) { | 58 if (!ktxFile.valid()) { |
59 return false; | 59 return false; |
60 } | 60 } |
61 | 61 |
62 const unsigned short width = ktxFile.width(); | 62 const unsigned short width = ktxFile.width(); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 return SkImageDecoder::kUnknown_Format; | 268 return SkImageDecoder::kUnknown_Format; |
269 } | 269 } |
270 | 270 |
271 SkImageEncoder* sk_libktx_efactory(SkImageEncoder::Type t) { | 271 SkImageEncoder* sk_libktx_efactory(SkImageEncoder::Type t) { |
272 return (SkImageEncoder::kKTX_Type == t) ? SkNEW(SkKTXImageEncoder) : NULL; | 272 return (SkImageEncoder::kKTX_Type == t) ? SkNEW(SkKTXImageEncoder) : NULL; |
273 } | 273 } |
274 | 274 |
275 static SkImageDecoder_DecodeReg gReg(sk_libktx_dfactory); | 275 static SkImageDecoder_DecodeReg gReg(sk_libktx_dfactory); |
276 static SkImageDecoder_FormatReg gFormatReg(get_format_ktx); | 276 static SkImageDecoder_FormatReg gFormatReg(get_format_ktx); |
277 static SkImageEncoder_EncodeReg gEReg(sk_libktx_efactory); | 277 static SkImageEncoder_EncodeReg gEReg(sk_libktx_efactory); |
OLD | NEW |