Bug 910754 - Update SkFontHost_cairo for the new Skia APIs r=snorp
authorGeorge Wright <george@mozilla.com>
Thu, 13 Feb 2014 02:03:51 -0500
changeset 186608 a35f514ea705b2d03e66895ad792cd44e248477e
parent 186607 ae20e11c6a681611f767c121d42d8dcae375bf46
child 186609 9604907f07d4b3133678107c31ba2440c37964f1
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs910754
milestone30.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 910754 - Update SkFontHost_cairo for the new Skia APIs r=snorp
gfx/skia/trunk/src/ports/SkFontHost_cairo.cpp
--- a/gfx/skia/trunk/src/ports/SkFontHost_cairo.cpp
+++ b/gfx/skia/trunk/src/ports/SkFontHost_cairo.cpp
@@ -162,16 +162,17 @@ SkTypeface* SkCreateTypefaceFromCairoFon
     } else {
         typeface = SkCairoFTTypeface::CreateTypeface(fontFace, style, isFixedWidth);
         SkTypefaceCache::Add(typeface, style);
     }
 
     return typeface;
 }
 
+#ifdef SK_FONTHOST_DOES_NOT_USE_FONTMGR
 SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
                                      const char famillyName[],
                                      SkTypeface::Style style)
 {
     SkDEBUGFAIL("SkFontHost::FindTypeface unimplemented");
     return NULL;
 }
 
@@ -181,16 +182,17 @@ SkTypeface* SkFontHost::CreateTypefaceFr
     return NULL;
 }
 
 SkTypeface* SkFontHost::CreateTypefaceFromFile(char const*)
 {
     SkDEBUGFAIL("SkFontHost::CreateTypefaceFromFile unimplemented");
     return NULL;
 }
+#endif
 
 ///////////////////////////////////////////////////////////////////////////////
 
 static bool isLCD(const SkScalerContext::Rec& rec) {
     switch (rec.fMaskFormat) {
         case SkMask::kLCD16_Format:
         case SkMask::kLCD32_Format:
             return true;
@@ -232,23 +234,23 @@ SkScalerContext_CairoFT::SkScalerContext
             cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_NONE);
             break;
         case SkPaint::kSlight_Hinting:
             loadFlags = FT_LOAD_TARGET_LIGHT;  // This implies FORCE_AUTOHINT
             cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_SLIGHT);
             break;
         case SkPaint::kNormal_Hinting:
             cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_MEDIUM);
-            if (fRec.fFlags & SkScalerContext::kAutohinting_Flag) {
+            if (fRec.fFlags & SkScalerContext::kForceAutohinting_Flag) {
                 loadFlags = FT_LOAD_FORCE_AUTOHINT;
             }
             break;
         case SkPaint::kFull_Hinting:
             cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_FULL);
-            if (fRec.fFlags & SkScalerContext::kAutohinting_Flag) {
+            if (fRec.fFlags & SkScalerContext::kForceAutohinting_Flag) {
                 loadFlags = FT_LOAD_FORCE_AUTOHINT;
             }
             if (isLCD(fRec)) {
                 if (SkToBool(fRec.fFlags & SkScalerContext::kLCD_Vertical_Flag)) {
                     loadFlags = FT_LOAD_TARGET_LCD_V;
                 } else {
                     loadFlags = FT_LOAD_TARGET_LCD;
                 }
@@ -300,20 +302,20 @@ void SkScalerContext_CairoFT::generateMe
 {
     SkASSERT(fScaledFont != NULL);
     cairo_text_extents_t extents;
     cairo_glyph_t cairoGlyph = { glyph->getGlyphID(fBaseGlyphCount), 0.0, 0.0 };
     cairo_scaled_font_glyph_extents(fScaledFont, &cairoGlyph, 1, &extents);
 
     glyph->fAdvanceX = SkDoubleToFixed(extents.x_advance);
     glyph->fAdvanceY = SkDoubleToFixed(extents.y_advance);
-    glyph->fWidth = SkToU16(SkScalarCeil(extents.width));
-    glyph->fHeight = SkToU16(SkScalarCeil(extents.height));
-    glyph->fLeft = SkToS16(SkScalarCeil(extents.x_bearing));
-    glyph->fTop = SkToS16(SkScalarCeil(extents.y_bearing));
+    glyph->fWidth = SkToU16(SkScalarCeilToInt(extents.width));
+    glyph->fHeight = SkToU16(SkScalarCeilToInt(extents.height));
+    glyph->fLeft = SkToS16(SkScalarCeilToInt(extents.x_bearing));
+    glyph->fTop = SkToS16(SkScalarCeilToInt(extents.y_bearing));
     glyph->fLsbDelta = 0;
     glyph->fRsbDelta = 0;
 }
 
 void SkScalerContext_CairoFT::generateImage(const SkGlyph& glyph)
 {
     SkASSERT(fScaledFont != NULL);
     CairoLockedFTFace faceLock(fScaledFont);