| 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 2896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2907 unsigned packedSize; | 2907 unsigned packedSize; |
| 2908 // Output data is tightly packed (alignment == 1). | 2908 // Output data is tightly packed (alignment == 1). |
| 2909 PixelStoreParams params; | 2909 PixelStoreParams params; |
| 2910 params.alignment = 1; | 2910 params.alignment = 1; |
| 2911 if (computeImageSizeInBytes(format, type, sourceImageSubRectangle.width(), | 2911 if (computeImageSizeInBytes(format, type, sourceImageSubRectangle.width(), |
| 2912 sourceImageSubRectangle.height(), depth, params, | 2912 sourceImageSubRectangle.height(), depth, params, |
| 2913 &packedSize, 0, 0) != GL_NO_ERROR) | 2913 &packedSize, 0, 0) != GL_NO_ERROR) |
| 2914 return false; | 2914 return false; |
| 2915 data.resize(packedSize); | 2915 data.resize(packedSize); |
| 2916 | 2916 |
| 2917 if (!packPixels(reinterpret_cast<const uint8_t*>(pixels), sourceFormat, | 2917 return packPixels( |
| 2918 sourceImageWidth, sourceImageHeight, sourceImageSubRectangle, | 2918 reinterpret_cast<const uint8_t*>(pixels), sourceFormat, sourceImageWidth, |
| 2919 depth, sourceUnpackAlignment, unpackImageHeight, format, type, | 2919 sourceImageHeight, sourceImageSubRectangle, depth, sourceUnpackAlignment, |
| 2920 alphaOp, data.data(), flipY)) | 2920 unpackImageHeight, format, type, alphaOp, data.data(), flipY); |
| 2921 return false; | |
| 2922 if (ImageObserver* observer = image->getImageObserver()) | |
| 2923 observer->didDraw(image); | |
| 2924 return true; | |
| 2925 } | 2921 } |
| 2926 | 2922 |
| 2927 bool WebGLImageConversion::extractImageData( | 2923 bool WebGLImageConversion::extractImageData( |
| 2928 const uint8_t* imageData, | 2924 const uint8_t* imageData, |
| 2929 DataFormat sourceDataFormat, | 2925 DataFormat sourceDataFormat, |
| 2930 const IntSize& imageDataSize, | 2926 const IntSize& imageDataSize, |
| 2931 const IntRect& sourceImageSubRectangle, | 2927 const IntRect& sourceImageSubRectangle, |
| 2932 int depth, | 2928 int depth, |
| 2933 int unpackImageHeight, | 2929 int unpackImageHeight, |
| 2934 GLenum format, | 2930 GLenum format, |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3168 pack<WebGLImageConversion::DataFormatRGB565, | 3164 pack<WebGLImageConversion::DataFormatRGB565, |
| 3169 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart, | 3165 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart, |
| 3170 pixelsPerRow); | 3166 pixelsPerRow); |
| 3171 } break; | 3167 } break; |
| 3172 default: | 3168 default: |
| 3173 break; | 3169 break; |
| 3174 } | 3170 } |
| 3175 } | 3171 } |
| 3176 | 3172 |
| 3177 } // namespace blink | 3173 } // namespace blink |
| OLD | NEW |