mozilla-bmo1626236.patch
changeset 1136 d068eb84b4d3
equal deleted inserted replaced
1135:082b9d2dfd7d 1136:d068eb84b4d3
       
     1 # HG changeset patch
       
     2 # User msirringhaus@suse.de
       
     3 # Date 1582805876 -3600
       
     4 #      Thu Feb 27 13:17:56 2020 +0100
       
     5 # Node ID cc3d09abea31068e57f1ab918782f9f86fc6a158
       
     6 # Parent  9cd90914846f667f18babc491a74c164ae5d6e9f
       
     7 imported patch decoder_workaround.patch
       
     8 
       
     9 diff -r 9cd90914846f image/decoders/nsGIFDecoder2.cpp
       
    10 --- a/image/decoders/nsGIFDecoder2.cpp	Thu Feb 27 12:57:14 2020 +0100
       
    11 +++ b/image/decoders/nsGIFDecoder2.cpp	Fri Mar 27 13:06:18 2020 +0100
       
    12 @@ -422,6 +422,9 @@
       
    13    MOZ_ASSERT(mSwizzleFn);
       
    14    uint8_t* data = reinterpret_cast<uint8_t*>(aColormap);
       
    15    mSwizzleFn(data, data, aColors);
       
    16 +#if MOZ_BIG_ENDIAN()
       
    17 +  SwizzleRow(SurfaceFormat::A8R8G8B8, SurfaceFormat::B8G8R8A8)(data, data, aColors);
       
    18 +#endif
       
    19  }
       
    20  
       
    21  LexerResult nsGIFDecoder2::DoDecode(SourceBufferIterator& aIterator,
       
    22 diff -r 9cd90914846f image/decoders/nsJPEGDecoder.cpp
       
    23 --- a/image/decoders/nsJPEGDecoder.cpp	Thu Feb 27 12:57:14 2020 +0100
       
    24 +++ b/image/decoders/nsJPEGDecoder.cpp	Fri Mar 27 13:06:18 2020 +0100
       
    25 @@ -263,6 +263,9 @@
       
    26          case JCS_YCbCr:
       
    27            // By default, we will output directly to BGRA. If we need to apply
       
    28            // special color transforms, this may change.
       
    29 +#if MOZ_BIG_ENDIAN()
       
    30 +          mInfo.out_color_space = MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB;
       
    31 +#else
       
    32            switch (SurfaceFormat::OS_RGBX) {
       
    33              case SurfaceFormat::B8G8R8X8:
       
    34                mInfo.out_color_space = JCS_EXT_BGRX;
       
    35 @@ -277,6 +280,7 @@
       
    36                mState = JPEG_ERROR;
       
    37                return Transition::TerminateFailure();
       
    38            }
       
    39 +#endif
       
    40            break;
       
    41          case JCS_CMYK:
       
    42          case JCS_YCCK:
       
    43 diff -r 9cd90914846f image/decoders/nsPNGDecoder.cpp
       
    44 --- a/image/decoders/nsPNGDecoder.cpp	Thu Feb 27 12:57:14 2020 +0100
       
    45 +++ b/image/decoders/nsPNGDecoder.cpp	Fri Mar 27 13:06:18 2020 +0100
       
    46 @@ -361,7 +361,7 @@
       
    47                                     IResumable* aOnResume) {
       
    48    MOZ_ASSERT(!HasError(), "Shouldn't call DoDecode after error!");
       
    49  
       
    50 -  return mLexer.Lex(aIterator, aOnResume,
       
    51 +  LexerResult res = mLexer.Lex(aIterator, aOnResume,
       
    52                      [=](State aState, const char* aData, size_t aLength) {
       
    53                        switch (aState) {
       
    54                          case State::PNG_DATA:
       
    55 @@ -371,6 +371,14 @@
       
    56                        }
       
    57                        MOZ_CRASH("Unknown State");
       
    58                      });
       
    59 +
       
    60 +#if MOZ_BIG_ENDIAN()
       
    61 +  if(res.is<TerminalState>() && res.as<TerminalState>() == TerminalState::SUCCESS) {
       
    62 +      NativeEndian::swapToLittleEndianInPlace<uint32_t>((uint32_t*)(mImageData), mImageDataLength / 4);
       
    63 +  }
       
    64 +#endif
       
    65 +
       
    66 +  return res;
       
    67  }
       
    68  
       
    69  LexerTransition<nsPNGDecoder::State> nsPNGDecoder::ReadPNGData(
       
    70 diff -r 9cd90914846f image/decoders/nsWebPDecoder.cpp
       
    71 --- a/image/decoders/nsWebPDecoder.cpp	Thu Feb 27 12:57:14 2020 +0100
       
    72 +++ b/image/decoders/nsWebPDecoder.cpp	Fri Mar 27 13:06:18 2020 +0100
       
    73 @@ -237,7 +237,12 @@
       
    74    // WebP doesn't guarantee that the alpha generated matches the hint in the
       
    75    // header, so we always need to claim the input is BGRA. If the output is
       
    76    // BGRX, swizzling will mask off the alpha channel.
       
    77 +#if MOZ_BIG_ENDIAN()
       
    78 +  mBuffer.colorspace = MODE_ARGB;
       
    79 +  SurfaceFormat inFormat = mFormat;
       
    80 +#else
       
    81    SurfaceFormat inFormat = SurfaceFormat::OS_RGBA;
       
    82 +#endif
       
    83  
       
    84    SurfacePipeFlags pipeFlags = SurfacePipeFlags();
       
    85    if (mFormat == SurfaceFormat::OS_RGBA &&