Backed out changeset d87007680567
authorJohn Daggett <jdaggett@mozilla.com>
Thu, 10 Jun 2010 15:38:13 +0900
changeset 43459 dd6b2b8676217e856c3081db420024db4f86281b
parent 43440 d87007680567161a4e4356719aac49c4624eef97
child 43460 5b0b623d305b7ca62fa8825b33335b351b75ff81
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.3a5pre
backs outd87007680567161a4e4356719aac49c4624eef97
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
Backed out changeset d87007680567
gfx/thebes/src/gfxGDIFont.cpp
gfx/thebes/src/gfxGDIFont.h
--- a/gfx/thebes/src/gfxGDIFont.cpp
+++ b/gfx/thebes/src/gfxGDIFont.cpp
@@ -73,17 +73,21 @@ gfxGDIFont::gfxGDIFont(GDIFontEntry *aFo
       mAdjustedSize(0.0),
       mFont(NULL),
       mFontFace(nsnull),
       mScaledFont(nsnull),
       mMetrics(nsnull),
       mSpaceGlyph(0),
       mNeedsBold(aNeedsBold)
 {
-    mShaper = new gfxGDIShaper(this);
+    if (static_cast<GDIFontEntry*>(GetFontEntry())->mForceGDI) {
+        mShaper = new gfxGDIShaper(this);
+    } else {
+        mShaper = new gfxUniscribeShaper(this);
+    }
 }
 
 gfxGDIFont::~gfxGDIFont()
 {
     if (mScaledFont) {
         cairo_scaled_font_destroy(mScaledFont);
     }
     if (mFontFace) {
@@ -97,81 +101,44 @@ gfxGDIFont::~gfxGDIFont()
 
 gfxFont*
 gfxGDIFont::CopyWithAntialiasOption(AntialiasOption anAAOption)
 {
     return new gfxGDIFont(static_cast<GDIFontEntry*>(mFontEntry.get()),
                           &mStyle, mNeedsBold, anAAOption);
 }
 
-static PRBool
-UseUniscribe(gfxTextRun *aTextRun,
-             const PRUnichar *aString,
-             PRUint32 aRunStart,
-             PRUint32 aRunLength)
-{
-    PRUint32 flags = aTextRun->GetFlags();
-    PRBool useGDI;
-
-    PRBool isXP = (gfxWindowsPlatform::WindowsOSVersion() 
-                       < gfxWindowsPlatform::kWindowsVista);
-
-    // bug 561304 - Uniscribe bug produces bad positioning at certain
-    // font sizes on XP, so default to GDI on XP using logic of 3.6
-
-    useGDI = isXP &&
-             (flags &
-               (gfxTextRunFactory::TEXT_OPTIMIZE_SPEED | 
-                gfxTextRunFactory::TEXT_IS_RTL)
-             ) == gfxTextRunFactory::TEXT_OPTIMIZE_SPEED;
-
-    return !useGDI ||
-        ScriptIsComplex(aString + aRunStart, aRunLength, SIC_COMPLEX) == S_OK;
-}
-
 void
 gfxGDIFont::InitTextRun(gfxContext *aContext,
                         gfxTextRun *aTextRun,
                         const PRUnichar *aString,
                         PRUint32 aRunStart,
                         PRUint32 aRunLength)
 {
     if (!mMetrics) {
         Initialize();
     }
     if (!mIsValid) {
         NS_WARNING("invalid font! expect incorrect text rendering");
         return;
     }
-
-    PRBool ok;
-
-    GDIFontEntry *fe = static_cast<GDIFontEntry*>(GetFontEntry());
-    if (UseUniscribe(aTextRun, aString, aRunStart, aRunLength)
-        && !fe->mForceGDI)
-    {
-        if (!mUniscribeShaper) {
-            mUniscribeShaper = new gfxUniscribeShaper(this);
+    PRBool ok = mShaper->InitTextRun(aContext, aTextRun, aString,
+                                     aRunStart, aRunLength);
+    if (!ok) {
+        // shaping failed; if we were using uniscribe, fall back to GDI
+        GDIFontEntry *fe = static_cast<GDIFontEntry*>(GetFontEntry());
+        if (!fe->mForceGDI) {
+            NS_WARNING("uniscribe failed, switching to GDI shaper");
+            fe->mForceGDI = PR_TRUE;
+            mShaper = new gfxGDIShaper(this);
+            ok = mShaper->InitTextRun(aContext, aTextRun, aString,
+                                      aRunStart, aRunLength);
         }
-
-        // use Uniscribe shaping
-        ok = mUniscribeShaper->InitTextRun(aContext, aTextRun, aString,
-                                           aRunStart, aRunLength);
-        if (ok) {
-            return;
-        }
-
-        NS_WARNING("uniscribe text shaping failed, switching to GDI shaper");
-        fe->mForceGDI = PR_TRUE;
     }
-
-    // use GDI shaping
-    ok = mShaper->InitTextRun(aContext, aTextRun, aString,
-                                     aRunStart, aRunLength);
-    NS_WARN_IF_FALSE(ok, "text shaping failed, expect broken or missing text");
+    NS_WARN_IF_FALSE(ok, "shaper failed, expect broken or missing text");
 }
 
 const gfxFont::Metrics&
 gfxGDIFont::GetMetrics()
 {
     if (!mMetrics) {
         Initialize();
     }
--- a/gfx/thebes/src/gfxGDIFont.h
+++ b/gfx/thebes/src/gfxGDIFont.h
@@ -80,20 +80,16 @@ public:
                              PRUint32 aRunStart,
                              PRUint32 aRunLength);
 
 protected:
     void Initialize(); // creates metrics and Cairo fonts
 
     void FillLogFont(LOGFONTW& aLogFont, gfxFloat aSize);
 
-    // mShaper is used for the GDI shaper, mUniscribeShaper
-    // for the Uniscribe version if needed
-    nsAutoPtr<gfxFontShaper>   mUniscribeShaper;
-
     gfxFloat              mAdjustedSize;
 
     HFONT                 mFont;
     cairo_font_face_t    *mFontFace;
     cairo_scaled_font_t  *mScaledFont;
 
     Metrics              *mMetrics;
     PRUint32              mSpaceGlyph;