| 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/CheckedInt.h" | 7 #include "platform/CheckedInt.h" |
| 8 #include "platform/graphics/ImageObserver.h" | 8 #include "platform/graphics/ImageObserver.h" |
| 9 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" | 9 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" |
| 10 #include "platform/graphics/cpu/x86/WebGLImageConversionSSE.h" | 10 #include "platform/graphics/cpu/x86/WebGLImageConversionSSE.h" |
| (...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 // Attempt to get raw unpremultiplied image data. | 2142 // Attempt to get raw unpremultiplied image data. |
| 2143 OwnPtr<ImageDecoder> decoder(ImageDecoder::create( | 2143 OwnPtr<ImageDecoder> decoder(ImageDecoder::create( |
| 2144 *(m_image->data()), ImageDecoder::AlphaNotPremultiplied, | 2144 *(m_image->data()), ImageDecoder::AlphaNotPremultiplied, |
| 2145 ignoreGammaAndColorProfile ? ImageDecoder::GammaAndColorProfileIgnor
ed : ImageDecoder::GammaAndColorProfileApplied)); | 2145 ignoreGammaAndColorProfile ? ImageDecoder::GammaAndColorProfileIgnor
ed : ImageDecoder::GammaAndColorProfileApplied)); |
| 2146 if (!decoder) | 2146 if (!decoder) |
| 2147 return; | 2147 return; |
| 2148 decoder->setData(m_image->data(), true); | 2148 decoder->setData(m_image->data(), true); |
| 2149 if (!decoder->frameCount()) | 2149 if (!decoder->frameCount()) |
| 2150 return; | 2150 return; |
| 2151 ImageFrame* frame = decoder->frameBufferAtIndex(0); | 2151 ImageFrame* frame = decoder->frameBufferAtIndex(0); |
| 2152 if (!frame || frame->status() != ImageFrame::FrameComplete) | 2152 if (!frame || frame->getStatus() != ImageFrame::FrameComplete) |
| 2153 return; | 2153 return; |
| 2154 hasAlpha = frame->hasAlpha(); | 2154 hasAlpha = frame->hasAlpha(); |
| 2155 SkBitmap bitmap = frame->bitmap(); | 2155 SkBitmap bitmap = frame->bitmap(); |
| 2156 if (!frameIsValid(bitmap)) | 2156 if (!frameIsValid(bitmap)) |
| 2157 return; | 2157 return; |
| 2158 | 2158 |
| 2159 // TODO(fmalita): Partial frames are not supported currently: frameIsVal
id ensures that | 2159 // TODO(fmalita): Partial frames are not supported currently: frameIsVal
id ensures that |
| 2160 // only immutable/fully decoded frames make it through. We could potent
ially relax this | 2160 // only immutable/fully decoded frames make it through. We could potent
ially relax this |
| 2161 // and allow SkImage::NewFromBitmap to make a copy. | 2161 // and allow SkImage::NewFromBitmap to make a copy. |
| 2162 ASSERT(bitmap.isImmutable()); | 2162 ASSERT(bitmap.isImmutable()); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2403 } | 2403 } |
| 2404 | 2404 |
| 2405 FormatConverter converter(width, height, sourceData, destinationData, srcStr
ide, dstStride); | 2405 FormatConverter converter(width, height, sourceData, destinationData, srcStr
ide, dstStride); |
| 2406 converter.convert(sourceDataFormat, dstDataFormat, alphaOp); | 2406 converter.convert(sourceDataFormat, dstDataFormat, alphaOp); |
| 2407 if (!converter.Success()) | 2407 if (!converter.Success()) |
| 2408 return false; | 2408 return false; |
| 2409 return true; | 2409 return true; |
| 2410 } | 2410 } |
| 2411 | 2411 |
| 2412 } // namespace blink | 2412 } // namespace blink |
| OLD | NEW |