mozilla-bmo1005535.patch
branchfirefox59
changeset 1039 b8f1c62354df
child 1040 246b98b59979
equal deleted inserted replaced
1038:ff41abc3ea34 1039:b8f1c62354df
       
     1 # HG changeset patch
       
     2 # Parent 376f185a0a757fe128be665adbb705f4a56461bc
       
     3 # User Steve Singer <steve@ssinger.info>
       
     4 # Parent  23e95bbe4d5553a2ba9dda2a4a96a2029253597c
       
     5 Bug 1005535 - Get skia GPU building on big endian.
       
     6 
       
     7 diff --git a/gfx/skia/skia/include/core/SkColorPriv.h b/gfx/skia/skia/include/core/SkColorPriv.h
       
     8 --- a/gfx/skia/skia/include/core/SkColorPriv.h
       
     9 +++ b/gfx/skia/skia/include/core/SkColorPriv.h
       
    10 @@ -27,37 +27,27 @@
       
    11   *  For easier compatibility with Skia's GPU backend, we further restrict these
       
    12   *  to either (in memory-byte-order) RGBA or BGRA. Note that this "order" does
       
    13   *  not directly correspond to the same shift-order, since we have to take endianess
       
    14   *  into account.
       
    15   *
       
    16   *  Here we enforce this constraint.
       
    17   */
       
    18  
       
    19 -#ifdef SK_CPU_BENDIAN
       
    20 -    #define SK_RGBA_R32_SHIFT   24
       
    21 -    #define SK_RGBA_G32_SHIFT   16
       
    22 -    #define SK_RGBA_B32_SHIFT   8
       
    23 -    #define SK_RGBA_A32_SHIFT   0
       
    24  
       
    25 -    #define SK_BGRA_B32_SHIFT   24
       
    26 -    #define SK_BGRA_G32_SHIFT   16
       
    27 -    #define SK_BGRA_R32_SHIFT   8
       
    28 -    #define SK_BGRA_A32_SHIFT   0
       
    29 -#else
       
    30      #define SK_RGBA_R32_SHIFT   0
       
    31      #define SK_RGBA_G32_SHIFT   8
       
    32      #define SK_RGBA_B32_SHIFT   16
       
    33      #define SK_RGBA_A32_SHIFT   24
       
    34  
       
    35      #define SK_BGRA_B32_SHIFT   0
       
    36      #define SK_BGRA_G32_SHIFT   8
       
    37      #define SK_BGRA_R32_SHIFT   16
       
    38      #define SK_BGRA_A32_SHIFT   24
       
    39 -#endif
       
    40 +
       
    41  
       
    42  #if defined(SK_PMCOLOR_IS_RGBA) && defined(SK_PMCOLOR_IS_BGRA)
       
    43      #error "can't define PMCOLOR to be RGBA and BGRA"
       
    44  #endif
       
    45  
       
    46  #define LOCAL_PMCOLOR_SHIFTS_EQUIVALENT_TO_RGBA  \
       
    47      (SK_A32_SHIFT == SK_RGBA_A32_SHIFT &&    \
       
    48       SK_R32_SHIFT == SK_RGBA_R32_SHIFT &&    \
       
    49 diff --git a/gfx/skia/skia/include/core/SkImageInfo.h b/gfx/skia/skia/include/core/SkImageInfo.h
       
    50 --- a/gfx/skia/skia/include/core/SkImageInfo.h
       
    51 +++ b/gfx/skia/skia/include/core/SkImageInfo.h
       
    52 @@ -78,17 +78,17 @@ enum SkColorType {
       
    53  
       
    54      kLastEnum_SkColorType = kRGBA_F16_SkColorType,
       
    55  
       
    56  #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
       
    57      kN32_SkColorType = kBGRA_8888_SkColorType,
       
    58  #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
       
    59      kN32_SkColorType = kRGBA_8888_SkColorType,
       
    60  #else
       
    61 -    #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order"
       
    62 +    kN32_SkColorType = kBGRA_8888_SkColorType
       
    63  #endif
       
    64  };
       
    65  
       
    66  static int SkColorTypeBytesPerPixel(SkColorType ct) {
       
    67      static const uint8_t gSize[] = {
       
    68          0,  // Unknown
       
    69          1,  // Alpha_8
       
    70          2,  // RGB_565
       
    71 diff --git a/gfx/skia/skia/include/gpu/GrColor.h b/gfx/skia/skia/include/gpu/GrColor.h
       
    72 --- a/gfx/skia/skia/include/gpu/GrColor.h
       
    73 +++ b/gfx/skia/skia/include/gpu/GrColor.h
       
    74 @@ -69,17 +69,17 @@ static inline GrColor GrColorPackA4(unsi
       
    75  #define GrColorUnpackG(color)   (((color) >> GrColor_SHIFT_G) & 0xFF)
       
    76  #define GrColorUnpackB(color)   (((color) >> GrColor_SHIFT_B) & 0xFF)
       
    77  #define GrColorUnpackA(color)   (((color) >> GrColor_SHIFT_A) & 0xFF)
       
    78  
       
    79  /**
       
    80   *  Since premultiplied means that alpha >= color, we construct a color with
       
    81   *  each component==255 and alpha == 0 to be "illegal"
       
    82   */
       
    83 -#define GrColor_ILLEGAL     (~(0xFF << GrColor_SHIFT_A))
       
    84 +#define GrColor_ILLEGAL     ((uint32_t)(~(0xFF << GrColor_SHIFT_A)))
       
    85  
       
    86  #define GrColor_WHITE 0xFFFFFFFF
       
    87  #define GrColor_TRANSPARENT_BLACK 0x0
       
    88  
       
    89  /**
       
    90   * Assert in debug builds that a GrColor is premultiplied.
       
    91   */
       
    92  static inline void GrColorIsPMAssert(GrColor SkDEBUGCODE(c)) {
       
    93 diff --git a/gfx/skia/skia/include/gpu/GrTypes.h b/gfx/skia/skia/include/gpu/GrTypes.h
       
    94 --- a/gfx/skia/skia/include/gpu/GrTypes.h
       
    95 +++ b/gfx/skia/skia/include/gpu/GrTypes.h
       
    96 @@ -321,25 +321,23 @@ enum GrPixelConfig {
       
    97      */
       
    98      kRGBA_half_GrPixelConfig,
       
    99  
       
   100      kLast_GrPixelConfig = kRGBA_half_GrPixelConfig
       
   101  };
       
   102  static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
       
   103  
       
   104  // Aliases for pixel configs that match skia's byte order.
       
   105 -#ifndef SK_CPU_LENDIAN
       
   106 -    #error "Skia gpu currently assumes little endian"
       
   107 -#endif
       
   108 +
       
   109  #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
       
   110      static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
       
   111  #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
       
   112      static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfig;
       
   113  #else
       
   114 -    #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format."
       
   115 +    static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
       
   116  #endif
       
   117  
       
   118  // Returns true if the pixel config is a GPU-specific compressed format
       
   119  // representation.
       
   120  static inline bool GrPixelConfigIsCompressed(GrPixelConfig config) {
       
   121      switch (config) {
       
   122          case kETC1_GrPixelConfig:
       
   123              return true;