Bug 1322337 - Load color bitmaps in SkFontHost_cairo when building with FreeType before 2.5.0. r=mchang, a=jcristau
authorLee Salzman <lsalzman@mozilla.com>
Tue, 17 Jan 2017 12:27:16 -0500
changeset 353682 38d2a128e0a96f24a7c02a636318f2c7387de960
parent 353681 584b0b8506252b3bf0863cf2c87ee71e5e998c00
child 353683 9bb207f947d83100c0f5bcd2b6baecc6ec24d431
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmchang, jcristau
bugs1322337
milestone52.0a2
Bug 1322337 - Load color bitmaps in SkFontHost_cairo when building with FreeType before 2.5.0. r=mchang, a=jcristau 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;