| 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 template <> | 703 template <> |
| 704 void pack<WebGLImageConversion::DataFormatR8, | 704 void pack<WebGLImageConversion::DataFormatR8, |
| 705 WebGLImageConversion::AlphaDoUnmultiply, | 705 WebGLImageConversion::AlphaDoUnmultiply, |
| 706 uint8_t, | 706 uint8_t, |
| 707 uint8_t>(const uint8_t* source, | 707 uint8_t>(const uint8_t* source, |
| 708 uint8_t* destination, | 708 uint8_t* destination, |
| 709 unsigned pixelsPerRow) { | 709 unsigned pixelsPerRow) { |
| 710 #if CPU(X86) || CPU(X86_64) | 710 #if CPU(X86) || CPU(X86_64) |
| 711 SIMD::packOneRowOfRGBA8LittleToR8(source, destination, pixelsPerRow); | 711 SIMD::packOneRowOfRGBA8LittleToR8(source, destination, pixelsPerRow); |
| 712 #endif | 712 #endif |
| 713 #if HAVE(MIPS_MSA_INTRINSICS) |
| 714 SIMD::packOneRowOfRGBA8LittleToR8MSA(source, destination, pixelsPerRow); |
| 715 #endif |
| 713 for (unsigned i = 0; i < pixelsPerRow; ++i) { | 716 for (unsigned i = 0; i < pixelsPerRow; ++i) { |
| 714 float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f; | 717 float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f; |
| 715 uint8_t sourceR = | 718 uint8_t sourceR = |
| 716 static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); | 719 static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); |
| 717 destination[0] = sourceR; | 720 destination[0] = sourceR; |
| 718 source += 4; | 721 source += 4; |
| 719 destination += 1; | 722 destination += 1; |
| 720 } | 723 } |
| 721 } | 724 } |
| 722 | 725 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 template <> | 760 template <> |
| 758 void pack<WebGLImageConversion::DataFormatRA8, | 761 void pack<WebGLImageConversion::DataFormatRA8, |
| 759 WebGLImageConversion::AlphaDoUnmultiply, | 762 WebGLImageConversion::AlphaDoUnmultiply, |
| 760 uint8_t, | 763 uint8_t, |
| 761 uint8_t>(const uint8_t* source, | 764 uint8_t>(const uint8_t* source, |
| 762 uint8_t* destination, | 765 uint8_t* destination, |
| 763 unsigned pixelsPerRow) { | 766 unsigned pixelsPerRow) { |
| 764 #if CPU(X86) || CPU(X86_64) | 767 #if CPU(X86) || CPU(X86_64) |
| 765 SIMD::packOneRowOfRGBA8LittleToRA8(source, destination, pixelsPerRow); | 768 SIMD::packOneRowOfRGBA8LittleToRA8(source, destination, pixelsPerRow); |
| 766 #endif | 769 #endif |
| 770 #if HAVE(MIPS_MSA_INTRINSICS) |
| 771 SIMD::packOneRowOfRGBA8LittleToRA8MSA(source, destination, pixelsPerRow); |
| 772 #endif |
| 767 for (unsigned i = 0; i < pixelsPerRow; ++i) { | 773 for (unsigned i = 0; i < pixelsPerRow; ++i) { |
| 768 float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f; | 774 float scaleFactor = source[3] ? 255.0f / source[3] : 1.0f; |
| 769 uint8_t sourceR = | 775 uint8_t sourceR = |
| 770 static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); | 776 static_cast<uint8_t>(static_cast<float>(source[0]) * scaleFactor); |
| 771 destination[0] = sourceR; | 777 destination[0] = sourceR; |
| 772 destination[1] = source[3]; | 778 destination[1] = source[3]; |
| 773 source += 4; | 779 source += 4; |
| 774 destination += 2; | 780 destination += 2; |
| 775 } | 781 } |
| 776 } | 782 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 template <> | 902 template <> |
| 897 void pack<WebGLImageConversion::DataFormatRGBA4444, | 903 void pack<WebGLImageConversion::DataFormatRGBA4444, |
| 898 WebGLImageConversion::AlphaDoNothing, | 904 WebGLImageConversion::AlphaDoNothing, |
| 899 uint8_t, | 905 uint8_t, |
| 900 uint16_t>(const uint8_t* source, | 906 uint16_t>(const uint8_t* source, |
| 901 uint16_t* destination, | 907 uint16_t* destination, |
| 902 unsigned pixelsPerRow) { | 908 unsigned pixelsPerRow) { |
| 903 #if HAVE(ARM_NEON_INTRINSICS) | 909 #if HAVE(ARM_NEON_INTRINSICS) |
| 904 SIMD::packOneRowOfRGBA8ToUnsignedShort4444(source, destination, pixelsPerRow); | 910 SIMD::packOneRowOfRGBA8ToUnsignedShort4444(source, destination, pixelsPerRow); |
| 905 #endif | 911 #endif |
| 912 #if HAVE(MIPS_MSA_INTRINSICS) |
| 913 SIMD::packOneRowOfRGBA8ToUnsignedShort4444MSA(source, destination, |
| 914 pixelsPerRow); |
| 915 #endif |
| 906 for (unsigned i = 0; i < pixelsPerRow; ++i) { | 916 for (unsigned i = 0; i < pixelsPerRow; ++i) { |
| 907 *destination = (((source[0] & 0xF0) << 8) | ((source[1] & 0xF0) << 4) | | 917 *destination = (((source[0] & 0xF0) << 8) | ((source[1] & 0xF0) << 4) | |
| 908 (source[2] & 0xF0) | (source[3] >> 4)); | 918 (source[2] & 0xF0) | (source[3] >> 4)); |
| 909 source += 4; | 919 source += 4; |
| 910 destination += 1; | 920 destination += 1; |
| 911 } | 921 } |
| 912 } | 922 } |
| 913 | 923 |
| 914 template <> | 924 template <> |
| 915 void pack<WebGLImageConversion::DataFormatRGBA4444, | 925 void pack<WebGLImageConversion::DataFormatRGBA4444, |
| (...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 pack<WebGLImageConversion::DataFormatRGB565, | 3082 pack<WebGLImageConversion::DataFormatRGB565, |
| 3073 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart, | 3083 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart, |
| 3074 pixelsPerRow); | 3084 pixelsPerRow); |
| 3075 } break; | 3085 } break; |
| 3076 default: | 3086 default: |
| 3077 break; | 3087 break; |
| 3078 } | 3088 } |
| 3079 } | 3089 } |
| 3080 | 3090 |
| 3081 } // namespace blink | 3091 } // namespace blink |
| OLD | NEW |