mozilla-bmo1511604.patch
branchfirefox68
changeset 1101 a4709640638e
child 1109 972f68ac6b1a
equal deleted inserted replaced
1100:e1c5065a014f 1101:a4709640638e
       
     1 # HG changeset patch
       
     2 # User A. Wilcox <AWilcox@Wilcox-Tech.com>
       
     3 # Date 1543674229 0
       
     4 #      Sat Dec 01 14:23:49 2018 +0000
       
     5 # Node ID 0309ff19e46b126c527e633518d7de8570442114
       
     6 # Parent  53107afbc21ec78e7ac46d37af212505f2032d5d
       
     7 Bug 1511604 - Swizzle YCbCr->RGB data on big-endian machines
       
     8 Taken from https://bugzilla.mozilla.org/show_bug.cgi?id=1511604
       
     9 
       
    10 This is very closely related to mozilla-bmo1504834
       
    11 
       
    12 Again, input for skia is swizzled to LE, as skia only understands LE.
       
    13 
       
    14 diff -r 53107afbc21e -r 0309ff19e46b gfx/ycbcr/YCbCrUtils.cpp
       
    15 --- a/gfx/ycbcr/YCbCrUtils.cpp  Wed Nov 07 04:50:21 2018 +0000
       
    16 +++ b/gfx/ycbcr/YCbCrUtils.cpp  Sat Dec 01 14:23:49 2018 +0000
       
    17 @@ -3,7 +3,9 @@
       
    18   * License, v. 2.0. If a copy of the MPL was not distributed with this
       
    19   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       
    20  
       
    21 +#include "mozilla/EndianUtils.h"
       
    22  #include "gfx2DGlue.h"
       
    23 +#include "mozilla/gfx/Swizzle.h"
       
    24  
       
    25  #include "YCbCrUtils.h"
       
    26  #include "yuv_convert.h"
       
    27 @@ -236,6 +238,13 @@
       
    28                            yuvtype,
       
    29                            srcData.mYUVColorSpace);
       
    30    }
       
    31 +#ifdef MOZ_BIG_ENDIAN
       
    32 +  // libyuv makes endian-correct result, which needs to be swapped to BGRX
       
    33 +  if (aDestFormat != SurfaceFormat::R5G6B5_UINT16)
       
    34 +    gfx::SwizzleData(aDestBuffer, aStride, gfx::SurfaceFormat::X8R8G8B8,
       
    35 +                     aDestBuffer, aStride, gfx::SurfaceFormat::B8G8R8X8,
       
    36 +                     srcData.mPicSize);
       
    37 +#endif
       
    38  }
       
    39  
       
    40  void
       
    41 @@ -257,6 +266,12 @@
       
    42                          aSrcStrideYA,
       
    43                          aSrcStrideUV,
       
    44                          aDstStrideARGB);
       
    45 +#ifdef MOZ_BIG_ENDIAN
       
    46 +  // libyuv makes endian-correct result, which needs to be swapped to BGRA
       
    47 +  gfx::SwizzleData(aDstARGB, aDstStrideARGB, gfx::SurfaceFormat::A8R8G8B8,
       
    48 +                   aDstARGB, aDstStrideARGB, gfx::SurfaceFormat::B8G8R8A8,
       
    49 +                   IntSize(aWidth, aHeight));
       
    50 +#endif
       
    51  }
       
    52  
       
    53  } // namespace gfx
       
    54