Bug 705656 - Broken SKIA compilation on mingw r=matt.woodrow
authorJacek Caban <jacek@codeweavers.com>
Wed, 30 Nov 2011 10:26:15 +0100
changeset 82647 0b4c709c2dfc625fc6da5a440c36391b388f1a99
parent 82646 68c475a7dcaaf064352cf548793c50af908758f3
child 82648 aca4994f37c181dafa0361abd27892fdbbc70203
push idunknown
push userunknown
push dateunknown
reviewersmatt.woodrow
bugs705656
milestone11.0a1
Bug 705656 - Broken SKIA compilation on mingw r=matt.woodrow
gfx/skia/Makefile.in
gfx/skia/include/core/SkPostConfig.h
gfx/skia/mingw-fix.patch
gfx/skia/src/ports/SkFontHost_win.cpp
gfx/skia/update.sh
--- a/gfx/skia/Makefile.in
+++ b/gfx/skia/Makefile.in
@@ -337,8 +337,16 @@ CPPSRCS += \
 	SkBitmapProcState_opts_SSE2.cpp \
 	SkBlitRow_opts_SSE2.cpp \
 	SkUtils_opts_SSE2.cpp \
 	opts_check_SSE2.cpp \
 	$(NULL)
 endif
 
 include $(topsrcdir)/config/rules.mk
+
+ifneq (,$(INTEL_ARCHITECTURE))
+ifdef GNU_CC
+SkBitmapProcState_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
+SkBlitRow_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
+SkUtils_opts_SSE2.$(OBJ_SUFFIX): CXXFLAGS+=-msse2
+endif
+endif
--- a/gfx/skia/include/core/SkPostConfig.h
+++ b/gfx/skia/include/core/SkPostConfig.h
@@ -248,17 +248,17 @@
 
 #endif
 
 #endif
 
 //////////////////////////////////////////////////////////////////////
 
 #ifndef SK_OVERRIDE
-#if defined(SK_BUILD_FOR_WIN)
+#if defined(_MSC_VER)
 #define SK_OVERRIDE override
 #elif defined(__clang__)
 // Some documentation suggests we should be using __attribute__((override)),
 // but it doesn't work.
 #define SK_OVERRIDE override
 #else
 // Linux GCC ignores "__attribute__((override))" and rejects "override".
 #define SK_OVERRIDE
new file mode 100644
--- /dev/null
+++ b/gfx/skia/mingw-fix.patch
@@ -0,0 +1,57 @@
+diff --git a/gfx/skia/include/core/SkPostConfig.h b/gfx/skia/include/core/SkPostConfig.h
+index 0135b85..bb108f8 100644
+--- a/gfx/skia/include/core/SkPostConfig.h
++++ b/gfx/skia/include/core/SkPostConfig.h
+@@ -253,7 +253,7 @@
+ //////////////////////////////////////////////////////////////////////
+ 
+ #ifndef SK_OVERRIDE
+-#if defined(SK_BUILD_FOR_WIN)
++#if defined(_MSC_VER)
+ #define SK_OVERRIDE override
+ #elif defined(__clang__)
+ // Some documentation suggests we should be using __attribute__((override)),
+diff --git a/gfx/skia/src/ports/SkFontHost_win.cpp b/gfx/skia/src/ports/SkFontHost_win.cpp
+index dd9c5dc..ca2c3dc 100644
+--- a/gfx/skia/src/ports/SkFontHost_win.cpp
++++ b/gfx/skia/src/ports/SkFontHost_win.cpp
+@@ -22,7 +22,7 @@
+ #ifdef WIN32
+ #include "windows.h"
+ #include "tchar.h"
+-#include "Usp10.h"
++#include "usp10.h"
+ 
+ // always packed xxRRGGBB
+ typedef uint32_t SkGdiRGB;
+@@ -1033,6 +1033,10 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
+     HFONT savefont = (HFONT)SelectObject(hdc, font);
+     HFONT designFont = NULL;
+ 
++    const char stem_chars[] = {'i', 'I', '!', '1'};
++    int16_t min_width;
++    unsigned glyphCount;
++
+     // To request design units, create a logical font whose height is specified
+     // as unitsPerEm.
+     OUTLINETEXTMETRIC otm;
+@@ -1046,7 +1050,7 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
+     if (!GetOutlineTextMetrics(hdc, sizeof(otm), &otm)) {
+         goto Error;
+     }
+-    const unsigned glyphCount = calculateGlyphCount(hdc);
++    glyphCount = calculateGlyphCount(hdc);
+ 
+     info = new SkAdvancedTypefaceMetrics;
+     info->fEmSize = otm.otmEMSquare;
+@@ -1115,9 +1119,8 @@ SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
+ 
+     // Figure out a good guess for StemV - Min width of i, I, !, 1.
+     // This probably isn't very good with an italic font.
+-    int16_t min_width = SHRT_MAX;
++    min_width = SHRT_MAX;
+     info->fStemV = 0;
+-    char stem_chars[] = {'i', 'I', '!', '1'};
+     for (size_t i = 0; i < SK_ARRAY_COUNT(stem_chars); i++) {
+         ABC abcWidths;
+         if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) {
--- a/gfx/skia/src/ports/SkFontHost_win.cpp
+++ b/gfx/skia/src/ports/SkFontHost_win.cpp
@@ -17,17 +17,17 @@
 #include "SkThread.h"
 #include "SkTypeface_win.h"
 #include "SkTypefaceCache.h"
 #include "SkUtils.h"
 
 #ifdef WIN32
 #include "windows.h"
 #include "tchar.h"
-#include "Usp10.h"
+#include "usp10.h"
 
 // always packed xxRRGGBB
 typedef uint32_t SkGdiRGB;
 
 template <typename T> T* SkTAddByteOffset(T* ptr, size_t byteOffset) {
     return (T*)((char*)ptr + byteOffset);
 }
 
@@ -1028,30 +1028,34 @@ SkAdvancedTypefaceMetrics* SkFontHost::G
     GetLogFontByID(fontID, &lf);
     SkAdvancedTypefaceMetrics* info = NULL;
 
     HDC hdc = CreateCompatibleDC(NULL);
     HFONT font = CreateFontIndirect(&lf);
     HFONT savefont = (HFONT)SelectObject(hdc, font);
     HFONT designFont = NULL;
 
+    const char stem_chars[] = {'i', 'I', '!', '1'};
+    int16_t min_width;
+    unsigned glyphCount;
+
     // To request design units, create a logical font whose height is specified
     // as unitsPerEm.
     OUTLINETEXTMETRIC otm;
     if (!GetOutlineTextMetrics(hdc, sizeof(otm), &otm) ||
         !GetTextFace(hdc, LF_FACESIZE, lf.lfFaceName)) {
         goto Error;
     }
     lf.lfHeight = -SkToS32(otm.otmEMSquare);
     designFont = CreateFontIndirect(&lf);
     SelectObject(hdc, designFont);
     if (!GetOutlineTextMetrics(hdc, sizeof(otm), &otm)) {
         goto Error;
     }
-    const unsigned glyphCount = calculateGlyphCount(hdc);
+    glyphCount = calculateGlyphCount(hdc);
 
     info = new SkAdvancedTypefaceMetrics;
     info->fEmSize = otm.otmEMSquare;
     info->fMultiMaster = false;
     info->fLastGlyphID = SkToU16(glyphCount - 1);
     info->fStyle = 0;
 #ifdef UNICODE
     // Get the buffer size needed first.
@@ -1110,19 +1114,18 @@ SkAdvancedTypefaceMetrics* SkFontHost::G
     // my Win7 box.
     info->fCapHeight = otm.otmsCapEmHeight;
     info->fBBox =
         SkIRect::MakeLTRB(otm.otmrcFontBox.left, otm.otmrcFontBox.top,
                           otm.otmrcFontBox.right, otm.otmrcFontBox.bottom);
 
     // Figure out a good guess for StemV - Min width of i, I, !, 1.
     // This probably isn't very good with an italic font.
-    int16_t min_width = SHRT_MAX;
+    min_width = SHRT_MAX;
     info->fStemV = 0;
-    char stem_chars[] = {'i', 'I', '!', '1'};
     for (size_t i = 0; i < SK_ARRAY_COUNT(stem_chars); i++) {
         ABC abcWidths;
         if (GetCharABCWidths(hdc, stem_chars[i], stem_chars[i], &abcWidths)) {
             int16_t width = abcWidths.abcB;
             if (width > 0 && width < min_width) {
                 min_width = width;
                 info->fStemV = min_width;
             }
--- a/gfx/skia/update.sh
+++ b/gfx/skia/update.sh
@@ -99,9 +99,12 @@ patch -p3 < arm-opts.patch
 patch -p3 < fix-gradient-clamp.patch
 # Bug 687189 - Implement SkPaint::getPosTextPath.
 patch -p3 < getpostextpath.patch
 # Bug 688365 - Enable Skia 'New AA' mode.
 patch -p3 < new-aa.patch
 # Bug 688366 - Fix Skia marking radial gradients with the same radius as invalid.
 patch -p3 < radial-gradients.patch
 # Fix restrict keyword problem for VS2005
-patch -p3 < skia-restrict-problem.patch
+patch -p3 < skia_restrict_problem.patch
+# Bug 705656 - Broken SKIA compilation on mingw
+patch -p3 < mingw-fix.patch
+