OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010, The Android Open Source Project | 2 * Copyright 2010, The Android Open Source Project |
3 * | 3 * |
4 * Licensed under the Apache License, Version 2.0 (the "License"); | 4 * Licensed under the Apache License, Version 2.0 (the "License"); |
5 * you may not use this file except in compliance with the License. | 5 * you may not use this file except in compliance with the License. |
6 * You may obtain a copy of the License at | 6 * You may obtain a copy of the License at |
7 * | 7 * |
8 * http://www.apache.org/licenses/LICENSE-2.0 | 8 * http://www.apache.org/licenses/LICENSE-2.0 |
9 * | 9 * |
10 * Unless required by applicable law or agreed to in writing, software | 10 * Unless required by applicable law or agreed to in writing, software |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 return false; | 388 return false; |
389 } | 389 } |
390 | 390 |
391 // Decode the WebP image data stream using WebP incremental decoding for | 391 // Decode the WebP image data stream using WebP incremental decoding for |
392 // the specified cropped image-region. | 392 // the specified cropped image-region. |
393 if (!webp_idecode(this->fInputStream, &config)) { | 393 if (!webp_idecode(this->fInputStream, &config)) { |
394 return false; | 394 return false; |
395 } | 395 } |
396 | 396 |
397 if (!directDecode) { | 397 if (!directDecode) { |
398 cropBitmap(decodedBitmap, bitmap, sampleSize, region.x(), region.y(), | 398 return cropBitmap(decodedBitmap, bitmap, sampleSize, region.x(), region.
y(), |
399 region.width(), region.height(), rect.x(), rect.y()); | 399 region.width(), region.height(), rect.x(), rect.y()); |
400 } | 400 } |
401 return true; | 401 return true; |
402 } | 402 } |
403 | 403 |
404 SkImageDecoder::Result SkWEBPImageDecoder::onDecode(SkStream* stream, SkBitmap*
decodedBitmap, | 404 SkImageDecoder::Result SkWEBPImageDecoder::onDecode(SkStream* stream, SkBitmap*
decodedBitmap, |
405 Mode mode) { | 405 Mode mode) { |
406 #ifdef TIME_DECODE | 406 #ifdef TIME_DECODE |
407 AutoTimeMillis atm("WEBP Decode"); | 407 AutoTimeMillis atm("WEBP Decode"); |
408 #endif | 408 #endif |
409 | 409 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 return SkImageDecoder::kUnknown_Format; | 668 return SkImageDecoder::kUnknown_Format; |
669 } | 669 } |
670 | 670 |
671 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { | 671 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { |
672 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL
L; | 672 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL
L; |
673 } | 673 } |
674 | 674 |
675 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); | 675 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); |
676 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); | 676 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); |
677 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); | 677 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); |
OLD | NEW |