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 "SkColorSpaceXform.h" | 9 #include "SkColorSpaceXform.h" |
10 #include "SkWebpCodec.h" | 10 #include "SkWebpCodec.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
size_t rowBytes, | 193 SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
size_t rowBytes, |
194 const Options& options, SkPMColor*, int
*, | 194 const Options& options, SkPMColor*, int
*, |
195 int* rowsDecodedPtr) { | 195 int* rowsDecodedPtr) { |
196 if (!conversion_possible(dstInfo, this->getInfo())) { | 196 if (!conversion_possible(dstInfo, this->getInfo())) { |
197 return kInvalidConversion; | 197 return kInvalidConversion; |
198 } | 198 } |
199 | 199 |
200 std::unique_ptr<SkColorSpaceXform> colorXform = nullptr; | 200 std::unique_ptr<SkColorSpaceXform> colorXform = nullptr; |
201 if (needs_color_xform(dstInfo, this->getInfo())) { | 201 if (needs_color_xform(dstInfo, this->getInfo())) { |
202 colorXform = SkColorSpaceXform::New(sk_ref_sp(this->getInfo().colorSpace
()), | 202 colorXform = SkColorSpaceXform::New(this->getInfo().colorSpace(), dstInf
o.colorSpace()); |
203 sk_ref_sp(dstInfo.colorSpace())); | |
204 SkASSERT(colorXform); | 203 SkASSERT(colorXform); |
205 } | 204 } |
206 | 205 |
207 WebPDecoderConfig config; | 206 WebPDecoderConfig config; |
208 if (0 == WebPInitDecoderConfig(&config)) { | 207 if (0 == WebPInitDecoderConfig(&config)) { |
209 // ABI mismatch. | 208 // ABI mismatch. |
210 // FIXME: New enum for this? | 209 // FIXME: New enum for this? |
211 return kInvalidInput; | 210 return kInvalidInput; |
212 } | 211 } |
213 | 212 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 return result; | 322 return result; |
324 } | 323 } |
325 | 324 |
326 SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info, | 325 SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info, |
327 sk_sp<SkColorSpace> colorSpace, SkStream* stream, WebPD
emuxer* demux, | 326 sk_sp<SkColorSpace> colorSpace, SkStream* stream, WebPD
emuxer* demux, |
328 sk_sp<SkData> data) | 327 sk_sp<SkData> data) |
329 : INHERITED(width, height, info, stream, std::move(colorSpace)) | 328 : INHERITED(width, height, info, stream, std::move(colorSpace)) |
330 , fDemux(demux) | 329 , fDemux(demux) |
331 , fData(std::move(data)) | 330 , fData(std::move(data)) |
332 {} | 331 {} |
OLD | NEW |