mozilla-bmo1504834-part2.patch
branchfirefox72
changeset 1119 4c5d44d40a03
parent 1109 972f68ac6b1a
child 1122 a9cd24eaa361
equal deleted inserted replaced
1118:27c3f029180a 1119:4c5d44d40a03
     1 # HG changeset patch
     1 # HG changeset patch
     2 # Parent  6fa4b62427433e8f445d05c557e5db096667d880
     2 # Parent  0e579dcbf7328dda4512cbdafc9b42acec4935ea
     3 Skia does not support big endian. The places to fix are too numerous and upstream (skia, not Mozilla)
     3 Skia does not support big endian. The places to fix are too numerous and upstream (skia, not Mozilla)
     4 has no interest in maintaining big endian.
     4 has no interest in maintaining big endian.
     5 So here we try to swizzle the input for skia, so that skia always works on LE, and when it comes
     5 So here we try to swizzle the input for skia, so that skia always works on LE, and when it comes
     6 out again, we transform back to BE.
     6 out again, we transform back to BE.
     7 
     7 
     8 diff --git a/gfx/2d/ConvolutionFilter.cpp b/gfx/2d/ConvolutionFilter.cpp
     8 diff -r 0e579dcbf732 gfx/2d/ConvolutionFilter.cpp
     9 --- a/gfx/2d/ConvolutionFilter.cpp
     9 --- a/gfx/2d/ConvolutionFilter.cpp	Wed Jan 08 12:17:44 2020 +0100
    10 +++ b/gfx/2d/ConvolutionFilter.cpp
    10 +++ b/gfx/2d/ConvolutionFilter.cpp	Wed Jan 08 12:17:49 2020 +0100
    11 @@ -30,32 +30,79 @@ bool ConvolutionFilter::GetFilterOffsetA
    11 @@ -35,9 +35,38 @@
    12                                                   int32_t* aResultLength) {
       
    13    if (aRowIndex >= mFilter->numValues()) {
       
    14      return false;
       
    15    }
       
    16    mFilter->FilterForValue(aRowIndex, aResultOffset, aResultLength);
       
    17    return true;
    12    return true;
    18  }
    13  }
    19  
    14  
    20 +static void ByteSwapArray(uint8_t *u8Array, int32_t size) {
    15 +static void ByteSwapArray(uint8_t *u8Array, int32_t size) {
    21 +    uint32_t *array = reinterpret_cast<uint32_t*>(u8Array);
    16 +    uint32_t *array = reinterpret_cast<uint32_t*>(u8Array);
    50 +    ByteSwapArray(aDst, outputSize);
    45 +    ByteSwapArray(aDst, outputSize);
    51 +#endif
    46 +#endif
    52  }
    47  }
    53  
    48  
    54  void ConvolutionFilter::ConvolveVertically(uint8_t* const* aSrc, uint8_t* aDst,
    49  void ConvolutionFilter::ConvolveVertically(uint8_t* const* aSrc, uint8_t* aDst,
    55                                             int32_t aRowIndex, int32_t aRowSize,
    50 @@ -49,8 +78,26 @@
    56                                             bool aHasAlpha) {
       
    57    MOZ_ASSERT(aRowIndex < mFilter->numValues());
       
    58  
       
    59    int32_t filterOffset;
       
    60    int32_t filterLength;
    51    int32_t filterLength;
    61    auto filterValues =
    52    auto filterValues =
    62        mFilter->FilterForValue(aRowIndex, &filterOffset, &filterLength);
    53        mFilter->FilterForValue(aRowIndex, &filterOffset, &filterLength);
    63 +
    54 +
    64 +#if MOZ_BIG_ENDIAN
    55 +#if MOZ_BIG_ENDIAN
    81 +  ByteSwapArray(aDst, aRowSize);
    72 +  ByteSwapArray(aDst, aRowSize);
    82 +#endif
    73 +#endif
    83  }
    74  }
    84  
    75  
    85  /* ConvolutionFilter::ComputeResizeFactor is derived from Skia's
    76  /* ConvolutionFilter::ComputeResizeFactor is derived from Skia's
    86   * SkBitmapScaler/SkResizeFilter::computeFactors. It is governed by Skia's
    77 diff -r 0e579dcbf732 gfx/skia/skia/include/core/SkPreConfig.h
    87   * BSD-style license (see gfx/skia/LICENSE) and the following copyright:
    78 --- a/gfx/skia/skia/include/core/SkPreConfig.h	Wed Jan 08 12:17:44 2020 +0100
    88   * Copyright (c) 2015 Google Inc.
    79 +++ b/gfx/skia/skia/include/core/SkPreConfig.h	Wed Jan 08 12:17:49 2020 +0100
    89   */
    80 @@ -73,7 +73,7 @@
    90  bool ConvolutionFilter::ComputeResizeFilter(ResizeMethod aResizeMethod,
       
    91 diff --git a/gfx/skia/skia/include/core/SkPreConfig.h b/gfx/skia/skia/include/core/SkPreConfig.h
       
    92 --- a/gfx/skia/skia/include/core/SkPreConfig.h
       
    93 +++ b/gfx/skia/skia/include/core/SkPreConfig.h
       
    94 @@ -68,17 +68,17 @@
       
    95          #define SK_CPU_BENDIAN
       
    96      #elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
       
    97          #define SK_CPU_LENDIAN
       
    98      #elif defined(__sparc) || defined(__sparc__) || \
       
    99        defined(_POWER) || defined(__powerpc__) || \
       
   100        defined(__ppc__) || defined(__hppa) || \
    81        defined(__ppc__) || defined(__hppa) || \
   101        defined(__PPC__) || defined(__PPC64__) || \
    82        defined(__PPC__) || defined(__PPC64__) || \
   102        defined(_MIPSEB) || defined(__ARMEB__) || \
    83        defined(_MIPSEB) || defined(__ARMEB__) || \
   103 -      defined(__s390__) || \
    84 -      defined(__s390__) || \
   104 +      defined(__s390__) || defined(__s390x__) || \
    85 +      defined(__s390__) || defined(__s390x__) || \
   105        (defined(__sh__) && defined(__BIG_ENDIAN__)) || \
    86        (defined(__sh__) && defined(__BIG_ENDIAN__)) || \
   106        (defined(__ia64) && defined(__BIG_ENDIAN__))
    87        (defined(__ia64) && defined(__BIG_ENDIAN__))
   107           #define SK_CPU_BENDIAN
    88           #define SK_CPU_BENDIAN
   108      #else
       
   109          #define SK_CPU_LENDIAN
       
   110      #endif
       
   111  #endif
       
   112