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 "SkScaledBitmapSampler.h" | 10 #include "SkScaledBitmapSampler.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 unsigned char buf[ETC_PKM_HEADER_SIZE]; | 104 unsigned char buf[ETC_PKM_HEADER_SIZE]; |
105 if (stream->read((void*)buf, ETC_PKM_HEADER_SIZE) != ETC_PKM_HEADER_SIZE) { | 105 if (stream->read((void*)buf, ETC_PKM_HEADER_SIZE) != ETC_PKM_HEADER_SIZE) { |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
109 return SkToBool(etc1_pkm_is_valid(buf)); | 109 return SkToBool(etc1_pkm_is_valid(buf)); |
110 } | 110 } |
111 | 111 |
112 static SkImageDecoder* sk_libpkm_dfactory(SkStreamRewindable* stream) { | 112 static SkImageDecoder* sk_libpkm_dfactory(SkStreamRewindable* stream) { |
113 if (is_pkm(stream)) { | 113 if (is_pkm(stream)) { |
114 return SkNEW(SkPKMImageDecoder); | 114 return new SkPKMImageDecoder; |
115 } | 115 } |
116 return NULL; | 116 return NULL; |
117 } | 117 } |
118 | 118 |
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); |
OLD | NEW |