OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 } // namespace | 115 } // namespace |
116 | 116 |
117 namespace blink { | 117 namespace blink { |
118 | 118 |
119 WEBPImageDecoder::WEBPImageDecoder(AlphaOption alphaOption, | 119 WEBPImageDecoder::WEBPImageDecoder(AlphaOption alphaOption, |
120 ColorSpaceOption colorOptions, | 120 ColorSpaceOption colorOptions, |
| 121 sk_sp<SkColorSpace> targetColorSpace, |
121 size_t maxDecodedBytes) | 122 size_t maxDecodedBytes) |
122 : ImageDecoder(alphaOption, colorOptions, maxDecodedBytes), | 123 : ImageDecoder(alphaOption, |
| 124 colorOptions, |
| 125 std::move(targetColorSpace), |
| 126 maxDecodedBytes), |
123 m_decoder(0), | 127 m_decoder(0), |
124 m_formatFlags(0), | 128 m_formatFlags(0), |
125 m_frameBackgroundHasAlpha(false), | 129 m_frameBackgroundHasAlpha(false), |
126 m_demux(0), | 130 m_demux(0), |
127 m_demuxState(WEBP_DEMUX_PARSING_HEADER), | 131 m_demuxState(WEBP_DEMUX_PARSING_HEADER), |
128 m_haveAlreadyParsedThisData(false), | 132 m_haveAlreadyParsedThisData(false), |
129 m_repetitionCount(cAnimationLoopOnce), | 133 m_repetitionCount(cAnimationLoopOnce), |
130 m_decodedHeight(0) { | 134 m_decodedHeight(0) { |
131 m_blendFunction = (alphaOption == AlphaPremultiplied) | 135 m_blendFunction = (alphaOption == AlphaPremultiplied) |
132 ? alphaBlendPremultiplied | 136 ? alphaBlendPremultiplied |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 return false; | 481 return false; |
478 | 482 |
479 ASSERT(isDecodedSizeAvailable()); | 483 ASSERT(isDecodedSizeAvailable()); |
480 | 484 |
481 ASSERT(m_frameBufferCache.size() > frameIndex); | 485 ASSERT(m_frameBufferCache.size() > frameIndex); |
482 ImageFrame& buffer = m_frameBufferCache[frameIndex]; | 486 ImageFrame& buffer = m_frameBufferCache[frameIndex]; |
483 ASSERT(buffer.getStatus() != ImageFrame::FrameComplete); | 487 ASSERT(buffer.getStatus() != ImageFrame::FrameComplete); |
484 | 488 |
485 if (buffer.getStatus() == ImageFrame::FrameEmpty) { | 489 if (buffer.getStatus() == ImageFrame::FrameEmpty) { |
486 if (!buffer.setSizeAndColorSpace(size().width(), size().height(), | 490 if (!buffer.setSizeAndColorSpace(size().width(), size().height(), |
487 colorSpace())) | 491 colorSpaceForSkImages())) |
488 return setFailed(); | 492 return setFailed(); |
489 buffer.setStatus(ImageFrame::FramePartial); | 493 buffer.setStatus(ImageFrame::FramePartial); |
490 // The buffer is transparent outside the decoded area while the image is | 494 // The buffer is transparent outside the decoded area while the image is |
491 // loading. The correct alpha value for the frame will be set when it is | 495 // loading. The correct alpha value for the frame will be set when it is |
492 // fully decoded. | 496 // fully decoded. |
493 buffer.setHasAlpha(true); | 497 buffer.setHasAlpha(true); |
494 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); | 498 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); |
495 } | 499 } |
496 | 500 |
497 const IntRect& frameRect = buffer.originalFrameRect(); | 501 const IntRect& frameRect = buffer.originalFrameRect(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 return false; | 542 return false; |
539 } | 543 } |
540 // FALLTHROUGH | 544 // FALLTHROUGH |
541 default: | 545 default: |
542 clear(); | 546 clear(); |
543 return setFailed(); | 547 return setFailed(); |
544 } | 548 } |
545 } | 549 } |
546 | 550 |
547 } // namespace blink | 551 } // namespace blink |
OLD | NEW |