Bug 1322337 - load color bitmaps in SkFontHost_cairo when building with FreeType before 2.5.0. r=mchang
authorLee Salzman <lsalzman@mozilla.com>
Tue, 17 Jan 2017 12:27:16 -0500
changeset 374706 9157dfae3c3e8e451295bf2c6c196dcd5f14ef55
parent 374705 3b5321a426ad97d0ac43bdc4f3a05d10fb5b58e4
child 374707 89f920cb1ce2c4083cd999af18ea05506965f8d4
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmchang
bugs1322337
milestone53.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 1322337 - load color bitmaps in SkFontHost_cairo when building with FreeType before 2.5.0. r=mchang MozReview-Commit-ID: Ay7hJi7RK4T
gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
--- a/gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
+++ b/gfx/skia/skia/src/ports/SkFontHost_cairo.cpp
@@ -36,16 +36,22 @@ typedef enum FT_LcdFilter_
 {
     FT_LCD_FILTER_NONE    = 0,
     FT_LCD_FILTER_DEFAULT = 1,
     FT_LCD_FILTER_LIGHT   = 2,
     FT_LCD_FILTER_LEGACY  = 16,
 } FT_LcdFilter;
 #endif
 
+// If compiling with FreeType before 2.5.0
+#ifndef FT_LOAD_COLOR
+#    define FT_LOAD_COLOR ( 1L << 20 )
+#    define FT_PIXEL_MODE_BGRA 7
+#endif
+
 #ifndef SK_CAN_USE_DLOPEN
 #define SK_CAN_USE_DLOPEN 1
 #endif
 #if SK_CAN_USE_DLOPEN
 #include <dlfcn.h>
 #endif
 
 #ifndef SK_FONTHOST_CAIRO_STANDALONE
@@ -391,19 +397,17 @@ SkScalerContext_CairoFT::SkScalerContext
     // advances, as fontconfig and cairo do.
     // See http://code.google.com/p/skia/issues/detail?id=222.
     loadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
 
     if (fRec.fFlags & SkScalerContext::kVertical_Flag) {
         loadFlags |= FT_LOAD_VERTICAL_LAYOUT;
     }
 
-#ifdef FT_LOAD_COLOR
     loadFlags |= FT_LOAD_COLOR;
-#endif
 
     fLoadGlyphFlags = loadFlags;
 }
 
 SkScalerContext_CairoFT::~SkScalerContext_CairoFT()
 {
     cairo_scaled_font_destroy(fScaledFont);
 }
@@ -684,21 +688,19 @@ void SkScalerContext_CairoFT::generateMe
                 glyph->fHeight += 2;
             } else {
                 glyph->fLeft -= 1;
                 glyph->fWidth += 2;
             }
         }
         break;
     case FT_GLYPH_FORMAT_BITMAP:
-#ifdef FT_LOAD_COLOR
         if (face->glyph->bitmap.pixel_mode == FT_PIXEL_MODE_BGRA) {
             glyph->fMaskFormat = SkMask::kARGB32_Format;
         }
-#endif
 
         if (isLCD(fRec)) {
             fRec.fMaskFormat = SkMask::kA8_Format;
         }
 
         if (fHaveShape) {
             // Apply the shape matrix to the glyph's bounding box.
             SkMatrix matrix;