OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "platform/graphics/gpu/WebGLImageConversion.h" | 5 #include "platform/graphics/gpu/WebGLImageConversion.h" |
6 | 6 |
7 #include "platform/graphics/ImageObserver.h" | 7 #include "platform/graphics/ImageObserver.h" |
8 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" | 8 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" |
9 #include "platform/graphics/cpu/mips/WebGLImageConversionMSA.h" | 9 #include "platform/graphics/cpu/mips/WebGLImageConversionMSA.h" |
10 #include "platform/graphics/cpu/x86/WebGLImageConversionSSE.h" | 10 #include "platform/graphics/cpu/x86/WebGLImageConversionSSE.h" |
(...skipping 2730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2741 : SkImageInfo::MakeUnknown(); | 2741 : SkImageInfo::MakeUnknown(); |
2742 m_alphaOp = AlphaDoNothing; | 2742 m_alphaOp = AlphaDoNothing; |
2743 bool hasAlpha = skiaImage ? !skiaImage->isOpaque() : true; | 2743 bool hasAlpha = skiaImage ? !skiaImage->isOpaque() : true; |
2744 | 2744 |
2745 if ((!skiaImage || ignoreColorSpace || (hasAlpha && !premultiplyAlpha)) && | 2745 if ((!skiaImage || ignoreColorSpace || (hasAlpha && !premultiplyAlpha)) && |
2746 m_image->data()) { | 2746 m_image->data()) { |
2747 // Attempt to get raw unpremultiplied image data. | 2747 // Attempt to get raw unpremultiplied image data. |
2748 std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create( | 2748 std::unique_ptr<ImageDecoder> decoder(ImageDecoder::create( |
2749 m_image->data(), true, ImageDecoder::AlphaNotPremultiplied, | 2749 m_image->data(), true, ImageDecoder::AlphaNotPremultiplied, |
2750 ignoreColorSpace ? ImageDecoder::ColorSpaceIgnored | 2750 ignoreColorSpace ? ImageDecoder::ColorSpaceIgnored |
2751 : ImageDecoder::ColorSpaceApplied)); | 2751 : ImageDecoder::ColorSpaceTransformed, |
| 2752 ignoreColorSpace ? nullptr : ImageDecoder::globalTargetColorSpace())); |
2752 if (!decoder || !decoder->frameCount()) | 2753 if (!decoder || !decoder->frameCount()) |
2753 return; | 2754 return; |
2754 ImageFrame* frame = decoder->frameBufferAtIndex(0); | 2755 ImageFrame* frame = decoder->frameBufferAtIndex(0); |
2755 if (!frame || frame->getStatus() != ImageFrame::FrameComplete) | 2756 if (!frame || frame->getStatus() != ImageFrame::FrameComplete) |
2756 return; | 2757 return; |
2757 hasAlpha = frame->hasAlpha(); | 2758 hasAlpha = frame->hasAlpha(); |
2758 SkBitmap bitmap = frame->bitmap(); | 2759 SkBitmap bitmap = frame->bitmap(); |
2759 if (!frameIsValid(bitmap)) | 2760 if (!frameIsValid(bitmap)) |
2760 return; | 2761 return; |
2761 | 2762 |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3164 pack<WebGLImageConversion::DataFormatRGB565, | 3165 pack<WebGLImageConversion::DataFormatRGB565, |
3165 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart, | 3166 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart, |
3166 pixelsPerRow); | 3167 pixelsPerRow); |
3167 } break; | 3168 } break; |
3168 default: | 3169 default: |
3169 break; | 3170 break; |
3170 } | 3171 } |
3171 } | 3172 } |
3172 | 3173 |
3173 } // namespace blink | 3174 } // namespace blink |
OLD | NEW |