mozilla-bmo1504834-part2.patch
branchfirefox74
changeset 1123 7fa561e5d7c7
parent 1122 a9cd24eaa361
equal deleted inserted replaced
1122:a9cd24eaa361 1123:7fa561e5d7c7
     1 # HG changeset patch
     1 # HG changeset patch
     2 # Parent  0e579dcbf7328dda4512cbdafc9b42acec4935ea
     2 # Parent  9319844dca3133fa8bd7107079f1d1ddc5c0bf70
     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 -r 0e579dcbf732 gfx/2d/ConvolutionFilter.cpp
     8 diff --git a/gfx/2d/ConvolutionFilter.cpp b/gfx/2d/ConvolutionFilter.cpp
     9 --- a/gfx/2d/ConvolutionFilter.cpp	Wed Jan 08 12:17:44 2020 +0100
     9 --- a/gfx/2d/ConvolutionFilter.cpp
    10 +++ b/gfx/2d/ConvolutionFilter.cpp	Wed Jan 08 12:17:49 2020 +0100
    10 +++ b/gfx/2d/ConvolutionFilter.cpp
    11 @@ -35,9 +35,38 @@
    11 @@ -29,32 +29,79 @@ bool ConvolutionFilter::GetFilterOffsetA
       
    12                                                   int32_t* aResultLength) {
       
    13    if (aRowIndex >= mFilter->numValues()) {
       
    14      return false;
       
    15    }
       
    16    mFilter->FilterForValue(aRowIndex, aResultOffset, aResultLength);
    12    return true;
    17    return true;
    13  }
    18  }
    14  
    19  
    15 +static void ByteSwapArray(uint8_t *u8Array, int32_t size) {
    20 +static void ByteSwapArray(uint8_t *u8Array, int32_t size) {
    16 +    uint32_t *array = reinterpret_cast<uint32_t*>(u8Array);
    21 +    uint32_t *array = reinterpret_cast<uint32_t*>(u8Array);
    45 +    ByteSwapArray(aDst, outputSize);
    50 +    ByteSwapArray(aDst, outputSize);
    46 +#endif
    51 +#endif
    47  }
    52  }
    48  
    53  
    49  void ConvolutionFilter::ConvolveVertically(uint8_t* const* aSrc, uint8_t* aDst,
    54  void ConvolutionFilter::ConvolveVertically(uint8_t* const* aSrc, uint8_t* aDst,
    50 @@ -49,8 +78,26 @@
    55                                             int32_t aRowIndex, int32_t aRowSize,
       
    56                                             bool aHasAlpha) {
       
    57    MOZ_ASSERT(aRowIndex < mFilter->numValues());
       
    58  
       
    59    int32_t filterOffset;
    51    int32_t filterLength;
    60    int32_t filterLength;
    52    auto filterValues =
    61    auto filterValues =
    53        mFilter->FilterForValue(aRowIndex, &filterOffset, &filterLength);
    62        mFilter->FilterForValue(aRowIndex, &filterOffset, &filterLength);
    54 +
    63 +
    55 +#if MOZ_BIG_ENDIAN()
    64 +#if MOZ_BIG_ENDIAN()
    72 +  ByteSwapArray(aDst, aRowSize);
    81 +  ByteSwapArray(aDst, aRowSize);
    73 +#endif
    82 +#endif
    74  }
    83  }
    75  
    84  
    76  /* ConvolutionFilter::ComputeResizeFactor is derived from Skia's
    85  /* ConvolutionFilter::ComputeResizeFactor is derived from Skia's
    77 diff -r 0e579dcbf732 gfx/skia/skia/include/core/SkPreConfig.h
    86   * SkBitmapScaler/SkResizeFilter::computeFactors. It is governed by Skia's
    78 --- a/gfx/skia/skia/include/core/SkPreConfig.h	Wed Jan 08 12:17:44 2020 +0100
    87   * BSD-style license (see gfx/skia/LICENSE) and the following copyright:
    79 +++ b/gfx/skia/skia/include/core/SkPreConfig.h	Wed Jan 08 12:17:49 2020 +0100
    88   * Copyright (c) 2015 Google Inc.
    80 @@ -73,7 +73,7 @@
    89   */
       
    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__) || \
    81        defined(__ppc__) || defined(__hppa) || \
   100        defined(__ppc__) || defined(__hppa) || \
    82        defined(__PPC__) || defined(__PPC64__) || \
   101        defined(__PPC__) || defined(__PPC64__) || \
    83        defined(_MIPSEB) || defined(__ARMEB__) || \
   102        defined(_MIPSEB) || defined(__ARMEB__) || \
    84 -      defined(__s390__) || \
   103 -      defined(__s390__) || \
    85 +      defined(__s390__) || defined(__s390x__) || \
   104 +      defined(__s390__) || defined(__s390x__) || \
    86        (defined(__sh__) && defined(__BIG_ENDIAN__)) || \
   105        (defined(__sh__) && defined(__BIG_ENDIAN__)) || \
    87        (defined(__ia64) && defined(__BIG_ENDIAN__))
   106        (defined(__ia64) && defined(__BIG_ENDIAN__))
    88           #define SK_CPU_BENDIAN
   107           #define SK_CPU_BENDIAN
       
   108      #else
       
   109          #define SK_CPU_LENDIAN
       
   110      #endif
       
   111  #endif
       
   112