| 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 case VP8_STATUS_SUSPENDED: | 300 case VP8_STATUS_SUSPENDED: |
| 301 WebPIDecGetRGB(idec, rowsDecodedPtr, nullptr, nullptr, nullptr); | 301 WebPIDecGetRGB(idec, rowsDecodedPtr, nullptr, nullptr, nullptr); |
| 302 rowsDecoded = *rowsDecodedPtr; | 302 rowsDecoded = *rowsDecodedPtr; |
| 303 result = kIncompleteInput; | 303 result = kIncompleteInput; |
| 304 break; | 304 break; |
| 305 default: | 305 default: |
| 306 return kInvalidInput; | 306 return kInvalidInput; |
| 307 } | 307 } |
| 308 | 308 |
| 309 if (colorXform) { | 309 if (colorXform) { |
| 310 SkAlphaType xformAlphaType = select_alpha_xform(dstInfo.alphaType(), | 310 SkColorSpaceXform::ColorFormat colorFormat = select_xform_format(dstInfo
.colorType()); |
| 311 SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(), |
| 311 this->getInfo().alphaTyp
e()); | 312 this->getInfo().alphaTyp
e()); |
| 312 | 313 |
| 313 uint32_t* src = (uint32_t*) config.output.u.RGBA.rgba; | 314 uint32_t* src = (uint32_t*) config.output.u.RGBA.rgba; |
| 314 size_t srcRowBytes = config.output.u.RGBA.stride; | 315 size_t srcRowBytes = config.output.u.RGBA.stride; |
| 315 for (int y = 0; y < rowsDecoded; y++) { | 316 for (int y = 0; y < rowsDecoded; y++) { |
| 316 colorXform->apply(dst, src, dstInfo.width(), dstInfo.colorType(), xf
ormAlphaType); | 317 colorXform->apply(dst, src, dstInfo.width(), colorFormat, xformAlpha
Type); |
| 317 dst = SkTAddOffset<void>(dst, rowBytes); | 318 dst = SkTAddOffset<void>(dst, rowBytes); |
| 318 src = SkTAddOffset<uint32_t>(src, srcRowBytes); | 319 src = SkTAddOffset<uint32_t>(src, srcRowBytes); |
| 319 } | 320 } |
| 320 } | 321 } |
| 321 | 322 |
| 322 return result; | 323 return result; |
| 323 } | 324 } |
| 324 | 325 |
| 325 SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info, | 326 SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info, |
| 326 sk_sp<SkColorSpace> colorSpace, SkStream* stream, WebPD
emuxer* demux, | 327 sk_sp<SkColorSpace> colorSpace, SkStream* stream, WebPD
emuxer* demux, |
| 327 sk_sp<SkData> data) | 328 sk_sp<SkData> data) |
| 328 : INHERITED(width, height, info, stream, std::move(colorSpace)) | 329 : INHERITED(width, height, info, stream, std::move(colorSpace)) |
| 329 , fDemux(demux) | 330 , fDemux(demux) |
| 330 , fData(std::move(data)) | 331 , fData(std::move(data)) |
| 331 {} | 332 {} |
| OLD | NEW |