Bug 1055265 - Correct the SkColorType used for 32-bit in SkANP r=snorp
authorGeorge Wright <george@mozilla.com>
Thu, 28 Aug 2014 15:31:01 -0400
changeset 202182 fba966c2cd07fddb36a21e542eb4af79fe83955d
parent 202181 a25309077ac7637eca9fc75a62acf31e063c3789
child 202183 f5d3c0ab2837a9e1a4837b565ae237218d2e2aa6
push id48356
push usergwright@mozilla.com
push dateThu, 28 Aug 2014 19:31:22 +0000
treeherdermozilla-inbound@fba966c2cd07 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1055265
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1055265 - Correct the SkColorType used for 32-bit in SkANP r=snorp
gfx/2d/moz.build
gfx/skia/generate_mozbuild.py
gfx/skia/moz.build
gfx/skia/trunk/include/config/SkUserConfig.h
other-licenses/skia-npapi/SkANP.cpp
--- a/gfx/2d/moz.build
+++ b/gfx/2d/moz.build
@@ -141,21 +141,16 @@ include('/ipc/chromium/chromium-config.m
 FINAL_LIBRARY = 'xul'
 
 for var in ('USE_CAIRO', 'MOZ2D_HAS_MOZ_CAIRO'):
     DEFINES[var] = True
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'gonk', 'qt'):
     DEFINES['MOZ_ENABLE_FREETYPE'] = True
 
-DEFINES['SK_A32_SHIFT'] = 24
-DEFINES['SK_R32_SHIFT'] = 16
-DEFINES['SK_G32_SHIFT'] = 8
-DEFINES['SK_B32_SHIFT'] = 0
-
 if CONFIG['MOZ_DEBUG']:
     DEFINES['GFX_LOG_DEBUG'] = True
     DEFINES['GFX_LOG_WARNING'] = True
 
 CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'gonk', 'qt'):
     CXXFLAGS += CONFIG['CAIRO_FT_CFLAGS']
--- a/gfx/skia/generate_mozbuild.py
+++ b/gfx/skia/generate_mozbuild.py
@@ -71,21 +71,16 @@ LOCAL_INCLUDES += [
     'trunk/src/lazy',
     'trunk/src/opts',
     'trunk/src/sfnt',
     'trunk/src/utils',
     'trunk/src/utils/mac',
     'trunk/src/utils/win',
 ]
 
-DEFINES['SK_A32_SHIFT'] = 24
-DEFINES['SK_R32_SHIFT'] = 16
-DEFINES['SK_G32_SHIFT'] = 8
-DEFINES['SK_B32_SHIFT'] = 0
-
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'qt', 'gonk', 'cocoa'):
     DEFINES['SK_USE_POSIX_THREADS'] = 1
 
 if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['HAVE_TOOLCHAIN_SUPPORT_MSSSE3']:
     DEFINES['SK_BUILD_SSSE3'] = 1
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
     DEFINES['SK_FONTHOST_CAIRO_STANDALONE'] = 0
--- a/gfx/skia/moz.build
+++ b/gfx/skia/moz.build
@@ -903,21 +903,16 @@ LOCAL_INCLUDES += [
     'trunk/src/lazy',
     'trunk/src/opts',
     'trunk/src/sfnt',
     'trunk/src/utils',
     'trunk/src/utils/mac',
     'trunk/src/utils/win',
 ]
 
-DEFINES['SK_A32_SHIFT'] = 24
-DEFINES['SK_R32_SHIFT'] = 16
-DEFINES['SK_G32_SHIFT'] = 8
-DEFINES['SK_B32_SHIFT'] = 0
-
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3', 'qt', 'gonk', 'cocoa'):
     DEFINES['SK_USE_POSIX_THREADS'] = 1
 
 if CONFIG['INTEL_ARCHITECTURE'] and CONFIG['HAVE_TOOLCHAIN_SUPPORT_MSSSE3']:
     DEFINES['SK_BUILD_SSSE3'] = 1
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gonk'):
     DEFINES['SK_FONTHOST_CAIRO_STANDALONE'] = 0
--- a/gfx/skia/trunk/include/config/SkUserConfig.h
+++ b/gfx/skia/trunk/include/config/SkUserConfig.h
@@ -146,26 +146,16 @@
        SK_TRACE_EVENT1(event, name1, value1)
        SK_TRACE_EVENT2(event, name1, value1, name2, value2)
    src/utils/SkDebugTrace.h has a trivial implementation that writes to
    the debug output stream. If SK_USER_TRACE_INCLUDE_FILE is not defined,
    SkTrace.h will define the above three macros to do nothing.
 */
 //#undef SK_USER_TRACE_INCLUDE_FILE
 
-/*  Change the ordering to work in X windows.
- */
-#ifdef SK_SAMPLES_FOR_X
-        #define SK_R32_SHIFT    16
-        #define SK_G32_SHIFT    8
-        #define SK_B32_SHIFT    0
-        #define SK_A32_SHIFT    24
-#endif
-
-
 /* Determines whether to build code that supports the GPU backend. Some classes
    that are not GPU-specific, such as SkShader subclasses, have optional code
    that is used allows them to interact with the GPU backend. If you'd like to
    omit this code set SK_SUPPORT_GPU to 0. This also allows you to omit the gpu
    directories from your include search path when you're not building the GPU
    backend. Defaults to 1 (build the GPU code).
  */
 //#define SK_SUPPORT_GPU 1
@@ -197,15 +187,21 @@
 #endif
 
 #if defined(SK_CPU_ARM32) || defined(SK_CPU_ARM64)
 #  define SK_BARRIERS_PLATFORM_H "skia/SkBarriers_arm.h"
 #else
 #  define SK_BARRIERS_PLATFORM_H "skia/SkBarriers_x86.h"
 #endif
 
+// On all platforms we have this byte order
+#define SK_A32_SHIFT 24
+#define SK_R32_SHIFT 16
+#define SK_G32_SHIFT 8
+#define SK_B32_SHIFT 0
+
 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0
 
 #define SK_SUPPORT_LEGACY_GETDEVICE
 #define SK_SUPPORT_LEGACY_GETTOPDEVICE
 #define SK_IGNORE_ETC1_SUPPORT
 
 #endif
--- a/other-licenses/skia-npapi/SkANP.cpp
+++ b/other-licenses/skia-npapi/SkANP.cpp
@@ -55,17 +55,19 @@ ANPRectF* SkANP::SetRect(ANPRectF* dst, 
     return dst;
 }
 
 SkBitmap* SkANP::SetBitmap(SkBitmap* dst, const ANPBitmap& src) {
     SkColorType colorType = kUnknown_SkColorType;
 
     switch (src.format) {
         case kRGBA_8888_ANPBitmapFormat:
-            colorType = kRGBA_8888_SkColorType;
+            // Let Skia choose the correct colour type for us based on its
+            // endianness. This should be correct.
+            colorType = kN32_SkColorType;
             break;
         case kRGB_565_ANPBitmapFormat:
             colorType = kRGB_565_SkColorType;
             break;
         default:
             break;
     }