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 "SkEndian.h" | 8 #include "SkEndian.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkImageDecoder.h" | 10 #include "SkImageDecoder.h" |
11 #include "SkScaledBitmapSampler.h" | 11 #include "SkScaledBitmapSampler.h" |
12 #include "SkStream.h" | 12 #include "SkStream.h" |
13 #include "SkStreamPriv.h" | 13 #include "SkStreamPriv.h" |
14 #include "SkTypes.h" | 14 #include "SkTypes.h" |
15 | 15 |
16 #include "SkTextureCompressor.h" | 16 #include "SkTextureCompressor.h" |
17 | 17 |
18 class SkASTCImageDecoder : public SkImageDecoder { | 18 class SkASTCImageDecoder : public SkImageDecoder { |
19 public: | 19 public: |
20 SkASTCImageDecoder() { } | 20 SkASTCImageDecoder() { } |
21 | 21 |
22 virtual Format getFormat() const SK_OVERRIDE { | 22 Format getFormat() const SK_OVERRIDE { |
23 return kASTC_Format; | 23 return kASTC_Format; |
24 } | 24 } |
25 | 25 |
26 protected: | 26 protected: |
27 virtual Result onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; | 27 Result onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; |
28 | 28 |
29 private: | 29 private: |
30 typedef SkImageDecoder INHERITED; | 30 typedef SkImageDecoder INHERITED; |
31 }; | 31 }; |
32 | 32 |
33 ////////////////////////////////////////////////////////////////////////////////
///////// | 33 ////////////////////////////////////////////////////////////////////////////////
///////// |
34 | 34 |
35 static const uint32_t kASTCMagicNumber = 0x5CA1AB13; | 35 static const uint32_t kASTCMagicNumber = 0x5CA1AB13; |
36 | 36 |
37 static inline int read_24bit(const uint8_t* buf) { | 37 static inline int read_24bit(const uint8_t* buf) { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 static SkImageDecoder_DecodeReg gReg(sk_libastc_dfactory); | 194 static SkImageDecoder_DecodeReg gReg(sk_libastc_dfactory); |
195 | 195 |
196 static SkImageDecoder::Format get_format_astc(SkStreamRewindable* stream) { | 196 static SkImageDecoder::Format get_format_astc(SkStreamRewindable* stream) { |
197 if (is_astc(stream)) { | 197 if (is_astc(stream)) { |
198 return SkImageDecoder::kASTC_Format; | 198 return SkImageDecoder::kASTC_Format; |
199 } | 199 } |
200 return SkImageDecoder::kUnknown_Format; | 200 return SkImageDecoder::kUnknown_Format; |
201 } | 201 } |
202 | 202 |
203 static SkImageDecoder_FormatReg gFormatReg(get_format_astc); | 203 static SkImageDecoder_FormatReg gFormatReg(get_format_astc); |
OLD | NEW |