OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
9 #include "SkWebpCodec.h" | 9 #include "SkWebpCodec.h" |
10 #include "SkTemplates.h" | 10 #include "SkTemplates.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 SkToBool(features.has_alpha) ? kUnpremul_SkAlp
haType | 70 SkToBool(features.has_alpha) ? kUnpremul_SkAlp
haType |
71 : kOpaque_SkAlphaT
ype); | 71 : kOpaque_SkAlphaT
ype); |
72 } | 72 } |
73 return true; | 73 return true; |
74 } | 74 } |
75 | 75 |
76 SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) { | 76 SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) { |
77 SkAutoTDelete<SkStream> streamDeleter(stream); | 77 SkAutoTDelete<SkStream> streamDeleter(stream); |
78 SkImageInfo info; | 78 SkImageInfo info; |
79 if (webp_parse_header(stream, &info)) { | 79 if (webp_parse_header(stream, &info)) { |
80 return SkNEW_ARGS(SkWebpCodec, (info, streamDeleter.detach())); | 80 return new SkWebpCodec(info, streamDeleter.detach()); |
81 } | 81 } |
82 return NULL; | 82 return NULL; |
83 } | 83 } |
84 | 84 |
85 // This version is slightly different from SkCodecPriv's version of conversion_p
ossible. It | 85 // This version is slightly different from SkCodecPriv's version of conversion_p
ossible. It |
86 // supports both byte orders for 8888. | 86 // supports both byte orders for 8888. |
87 static bool webp_conversion_possible(const SkImageInfo& dst, const SkImageInfo&
src) { | 87 static bool webp_conversion_possible(const SkImageInfo& dst, const SkImageInfo&
src) { |
88 if (dst.profileType() != src.profileType()) { | 88 if (dst.profileType() != src.profileType()) { |
89 return false; | 89 return false; |
90 } | 90 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // Break out of the switch statement. Continue the loop. | 244 // Break out of the switch statement. Continue the loop. |
245 break; | 245 break; |
246 default: | 246 default: |
247 return kInvalidInput; | 247 return kInvalidInput; |
248 } | 248 } |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 SkWebpCodec::SkWebpCodec(const SkImageInfo& info, SkStream* stream) | 252 SkWebpCodec::SkWebpCodec(const SkImageInfo& info, SkStream* stream) |
253 : INHERITED(info, stream) {} | 253 : INHERITED(info, stream) {} |
OLD | NEW |