| 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 2879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2890 flipY)) | 2890 flipY)) |
| 2891 return false; | 2891 return false; |
| 2892 if (ImageObserver* observer = image->getImageObserver()) | 2892 if (ImageObserver* observer = image->getImageObserver()) |
| 2893 observer->didDraw(image); | 2893 observer->didDraw(image); |
| 2894 return true; | 2894 return true; |
| 2895 } | 2895 } |
| 2896 | 2896 |
| 2897 bool WebGLImageConversion::extractImageData(const uint8_t* imageData, | 2897 bool WebGLImageConversion::extractImageData(const uint8_t* imageData, |
| 2898 DataFormat sourceDataFormat, | 2898 DataFormat sourceDataFormat, |
| 2899 const IntSize& imageDataSize, | 2899 const IntSize& imageDataSize, |
| 2900 const IntRect& sourceImageSubRect, |
| 2900 GLenum format, | 2901 GLenum format, |
| 2901 GLenum type, | 2902 GLenum type, |
| 2902 bool flipY, | 2903 bool flipY, |
| 2903 bool premultiplyAlpha, | 2904 bool premultiplyAlpha, |
| 2904 Vector<uint8_t>& data) { | 2905 Vector<uint8_t>& data) { |
| 2905 if (!imageData) | 2906 if (!imageData) |
| 2906 return false; | 2907 return false; |
| 2907 int width = imageDataSize.width(); | 2908 int width = imageDataSize.width(); |
| 2908 int height = imageDataSize.height(); | 2909 int height = imageDataSize.height(); |
| 2909 | 2910 |
| 2910 unsigned packedSize; | 2911 unsigned packedSize; |
| 2911 // Output data is tightly packed (alignment == 1). | 2912 // Output data is tightly packed (alignment == 1). |
| 2912 PixelStoreParams params; | 2913 PixelStoreParams params; |
| 2913 params.alignment = 1; | 2914 params.alignment = 1; |
| 2914 if (computeImageSizeInBytes(format, type, width, height, 1, params, | 2915 if (computeImageSizeInBytes(format, type, sourceImageSubRect.width(), |
| 2916 sourceImageSubRect.height(), 1, params, |
| 2915 &packedSize, 0, 0) != GL_NO_ERROR) | 2917 &packedSize, 0, 0) != GL_NO_ERROR) |
| 2916 return false; | 2918 return false; |
| 2917 data.resize(packedSize); | 2919 data.resize(packedSize); |
| 2918 | 2920 |
| 2919 if (!packPixels(imageData, sourceDataFormat, width, height, | 2921 if (!packPixels(imageData, sourceDataFormat, width, height, |
| 2920 IntRect(0, 0, width, height), 0, format, type, | 2922 sourceImageSubRect, 0, format, type, |
| 2921 premultiplyAlpha ? AlphaDoPremultiply : AlphaDoNothing, | 2923 premultiplyAlpha ? AlphaDoPremultiply : AlphaDoNothing, |
| 2922 data.data(), flipY)) | 2924 data.data(), flipY)) |
| 2923 return false; | 2925 return false; |
| 2924 | 2926 |
| 2925 return true; | 2927 return true; |
| 2926 } | 2928 } |
| 2927 | 2929 |
| 2928 bool WebGLImageConversion::extractTextureData(unsigned width, | 2930 bool WebGLImageConversion::extractTextureData(unsigned width, |
| 2929 unsigned height, | 2931 unsigned height, |
| 2930 GLenum format, | 2932 GLenum format, |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3104 pack<WebGLImageConversion::DataFormatRGB565, | 3106 pack<WebGLImageConversion::DataFormatRGB565, |
| 3105 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart, | 3107 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart, |
| 3106 pixelsPerRow); | 3108 pixelsPerRow); |
| 3107 } break; | 3109 } break; |
| 3108 default: | 3110 default: |
| 3109 break; | 3111 break; |
| 3110 } | 3112 } |
| 3111 } | 3113 } |
| 3112 | 3114 |
| 3113 } // namespace blink | 3115 } // namespace blink |
| OLD | NEW |