Fix big endian build for SKIA
authorCarsten Schoenert <c.schoenert@t-online.de>
Sat, 14 Apr 2018 16:00:02 +0000 (18:00 +0200)
committerCarsten Schoenert <c.schoenert@t-online.de>
Thu, 14 Feb 2019 19:01:03 +0000 (19:01 +0000)
Some parts of the skia source are currently not prepared for building on
big endian platforms.
Thanks Adrian Glaubitz for the updated patch.

Gbp-Pq: Topic fixes
Gbp-Pq: Name Fix-big-endian-build-for-SKIA.patch

gfx/skia/skia/include/core/SkColorPriv.h
gfx/skia/skia/include/core/SkImageInfo.h
gfx/skia/skia/include/gpu/GrTypes.h
gfx/skia/skia/include/private/GrColor.h
gfx/skia/skia/src/core/SkColorData.h

index 0cd02e8034062b4362b271ad40ea2165d9dc38d5..8a7f1501ba43494ac96f916a10fdc4d7e179649d 100644 (file)
@@ -55,17 +55,10 @@ static inline U8CPU SkUnitScalarClampToByte(SkScalar x) {
  *  Here we enforce this constraint.
  */
 
-#ifdef SK_CPU_BENDIAN
-    #define SK_RGBA_R32_SHIFT   24
-    #define SK_RGBA_G32_SHIFT   16
-    #define SK_RGBA_B32_SHIFT   8
-    #define SK_RGBA_A32_SHIFT   0
-#else
-    #define SK_RGBA_R32_SHIFT   0
-    #define SK_RGBA_G32_SHIFT   8
-    #define SK_RGBA_B32_SHIFT   16
-    #define SK_RGBA_A32_SHIFT   24
-#endif
+#define SK_RGBA_R32_SHIFT   0
+#define SK_RGBA_G32_SHIFT   8
+#define SK_RGBA_B32_SHIFT   16
+#define SK_RGBA_A32_SHIFT   24
 
 #define SkGetPackedA32(packed)      ((uint32_t)((packed) << (24 - SK_A32_SHIFT)) >> 24)
 #define SkGetPackedR32(packed)      ((uint32_t)((packed) << (24 - SK_R32_SHIFT)) >> 24)
index ece47f5c418a87708d1d2f47bdf68c638cb0197f..e3dec428d7e221a50b18d9497ae1f6f5ccd911af 100644 (file)
@@ -84,7 +84,7 @@ enum SkColorType {
 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
     kN32_SkColorType = kRGBA_8888_SkColorType,
 #else
-    #error "SK_*32_SHIFT values must correspond to BGRA or RGBA byte order"
+    kN32_SkColorType = kBGRA_8888_SkColorType
 #endif
 };
 
index c88d9ee63b38f86d4b612c8cfc8bfb5faccba57e..bfa9452309d8e023bd481b3ceebec2e2d16289d7 100644 (file)
@@ -344,15 +344,13 @@ enum GrPixelConfig {
 static const int kGrPixelConfigCnt = kLast_GrPixelConfig + 1;
 
 // Aliases for pixel configs that match skia's byte order.
-#ifndef SK_CPU_LENDIAN
-    #error "Skia gpu currently assumes little endian"
-#endif
 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
     static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
     static const GrPixelConfig kSkia8888_GrPixelConfig = kRGBA_8888_GrPixelConfig;
 #else
-    #error "SK_*32_SHIFT values must correspond to GL_BGRA or GL_RGBA format."
+    static const GrPixelConfig kSkia8888_GrPixelConfig = kBGRA_8888_GrPixelConfig;
+    static const GrPixelConfig kSkiaGamma8888_GrPixelConfig = kSBGRA_8888_GrPixelConfig;
 #endif
 
 /**
index b4a461d73806e18fe10a368da5e37659ae569d8e..14c5eb910a708b6ece85ae1557d98f584ba080a5 100644 (file)
@@ -74,7 +74,11 @@ static inline GrColor GrColorPackA4(unsigned a) {
  *  Since premultiplied means that alpha >= color, we construct a color with
  *  each component==255 and alpha == 0 to be "illegal"
  */
+#ifdef SK_CPU_BENDIAN
+#define GrColor_ILLEGAL     0xFFFFFF00
+#else
 #define GrColor_ILLEGAL     (~(0xFF << GrColor_SHIFT_A))
+#endif
 
 #define GrColor_WHITE 0xFFFFFFFF
 #define GrColor_TRANSPARENT_BLACK 0x0
index 3fc0113105a5b2d54684439756925b9dbbda9534..43ae01eeaee3e5b57df7dd4951737acbd34b5f0e 100644 (file)
  *  Here we enforce this constraint.
  */
 
-#ifdef SK_CPU_BENDIAN
-    #define SK_BGRA_B32_SHIFT   24
-    #define SK_BGRA_G32_SHIFT   16
-    #define SK_BGRA_R32_SHIFT   8
-    #define SK_BGRA_A32_SHIFT   0
-#else
-    #define SK_BGRA_B32_SHIFT   0
-    #define SK_BGRA_G32_SHIFT   8
-    #define SK_BGRA_R32_SHIFT   16
-    #define SK_BGRA_A32_SHIFT   24
-#endif
+#define SK_BGRA_B32_SHIFT   0
+#define SK_BGRA_G32_SHIFT   8
+#define SK_BGRA_R32_SHIFT   16
+#define SK_BGRA_A32_SHIFT   24
 
 #if defined(SK_PMCOLOR_IS_RGBA) && defined(SK_PMCOLOR_IS_BGRA)
     #error "can't define PMCOLOR to be RGBA and BGRA"