Bug 898267 - support font smoothing in Azure CG backend. r=jrmuizel
authorJohn Daggett <jdaggett@mozilla.com>
Tue, 30 Jul 2013 05:00:53 +0900
changeset 152718 e2340b350694c234c4943ce59cf6b57d0b7d954d
parent 152717 9395e867ca3bedf118aced309f469ec080fba765
child 152719 7be4586c3d919f4731b385df8cce33cccc2db5f2
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs898267
milestone25.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 898267 - support font smoothing in Azure CG backend. r=jrmuizel
gfx/2d/DrawTargetCG.cpp
gfx/thebes/gfxMacFont.cpp
--- a/gfx/2d/DrawTargetCG.cpp
+++ b/gfx/2d/DrawTargetCG.cpp
@@ -1002,16 +1002,19 @@ DrawTargetCG::FillGlyphs(ScaledFont *aFo
   assert(aBuffer.mNumGlyphs);
   CGContextSaveGState(mCg);
 
   CGContextSetBlendMode(mCg, ToBlendMode(aDrawOptions.mCompositionOp));
   UnboundnessFixer fixer;
   CGContextRef cg = fixer.Check(mCg, aDrawOptions.mCompositionOp);
   CGContextSetAlpha(cg, aDrawOptions.mAlpha);
   CGContextSetShouldAntialias(cg, aDrawOptions.mAntialiasMode != AA_NONE);
+  if (aDrawOptions.mAntialiasMode != AA_DEFAULT) {
+    CGContextSetShouldSmoothFonts(cg, aDrawOptions.mAntialiasMode == AA_SUBPIXEL);
+  }
 
   CGContextConcatCTM(cg, GfxMatrixToCGAffineTransform(mTransform));
 
   ScaledFontMac* macFont = static_cast<ScaledFontMac*>(aFont);
 
   //XXX: we should use a stack vector here when we have a class like that
   std::vector<CGGlyph> glyphs;
   std::vector<CGPoint> positions;
--- a/gfx/thebes/gfxMacFont.cpp
+++ b/gfx/thebes/gfxMacFont.cpp
@@ -79,18 +79,20 @@ gfxMacFont::gfxMacFont(MacOSFontEntry *a
     }
 
     cairo_font_options_t *fontOptions = cairo_font_options_create();
 
     // turn off font anti-aliasing based on user pref setting
     if (mAdjustedSize <=
         (gfxFloat)gfxPlatformMac::GetPlatform()->GetAntiAliasingThreshold()) {
         cairo_font_options_set_antialias(fontOptions, CAIRO_ANTIALIAS_NONE);
+        mAntialiasOption = kAntialiasNone;
     } else if (mStyle.useGrayscaleAntialiasing) {
         cairo_font_options_set_antialias(fontOptions, CAIRO_ANTIALIAS_GRAY);
+        mAntialiasOption = kAntialiasGrayscale;
     }
 
     mScaledFont = cairo_scaled_font_create(mFontFace, &sizeMatrix, &ctm,
                                            fontOptions);
     cairo_font_options_destroy(fontOptions);
 
     cairoerr = cairo_scaled_font_status(mScaledFont);
     if (cairoerr != CAIRO_STATUS_SUCCESS) {