From 4d585841b85d0aa756293f7e115af6c9232a5452 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 30 Nov 2011 10:26:15 +0100 Subject: [PATCH] Bug 705656 - Broken SKIA compilation on mingw r=matt.woodrow --- gfx/skia/Makefile.in | 8 ++++ gfx/skia/include/core/SkPostConfig.h | 2 +- gfx/skia/mingw-fix.patch | 57 +++++++++++++++++++++++++++ gfx/skia/src/ports/SkFontHost_win.cpp | 11 ++++-- gfx/skia/update.sh | 5 ++- 5 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 gfx/skia/mingw-fix.patch diff --git a/gfx/skia/Makefile.in b/gfx/skia/Makefile.in index a73404b659d..9bcac806ead 100644 --- a/gfx/skia/Makefile.in +++ b/gfx/skia/Makefile.in @@ -342,3 +342,11 @@ CPPSRCS += \ 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 diff --git a/gfx/skia/include/core/SkPostConfig.h b/gfx/skia/include/core/SkPostConfig.h index 0135b85f9e3..bb108f8a6db 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/mingw-fix.patch b/gfx/skia/mingw-fix.patch new file mode 100644 index 00000000000..d91a16aa702 --- /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)) { diff --git a/gfx/skia/src/ports/SkFontHost_win.cpp b/gfx/skia/src/ports/SkFontHost_win.cpp index dd9c5dc7ded..ca2c3dc92f2 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)) { diff --git a/gfx/skia/update.sh b/gfx/skia/update.sh index 111dec8d2c4..90fe4ff2220 100755 --- a/gfx/skia/update.sh +++ b/gfx/skia/update.sh @@ -104,4 +104,7 @@ 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 +