bug 693610 - accumulate advanceSum so that we don't overlap successive glyph runs when drawing text to azure canvas. r=bas
authorJonathan Kew <jfkthame@gmail.com>
Wed, 12 Oct 2011 08:27:28 +0100
changeset 78615 b5152a05d6160af47f1947eb232ab34fe3674071
parent 78614 de0be83bf880433e7afe29abf2a0beed73d8009c
child 78616 197cf8c60edc5baa06638fbfbb9e1646330dee0d
push id21321
push usermak77@bonardo.net
push dateThu, 13 Oct 2011 13:50:30 +0000
treeherdermozilla-central@d6d3a1f90e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs693610
milestone10.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 693610 - accumulate advanceSum so that we don't overlap successive glyph runs when drawing text to azure canvas. r=bas
content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
--- a/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2DAzure.cpp
@@ -3061,16 +3061,18 @@ struct NS_STACK_CLASS nsCanvasBidiProces
 
     PRUint32 numRuns;
     const gfxTextRun::GlyphRun *runs = mTextRun->GetGlyphRuns(&numRuns);
     const PRUint32 appUnitsPerDevUnit = mAppUnitsPerDevPixel;
     const double devUnitsPerAppUnit = 1.0/double(appUnitsPerDevUnit);
     Point baselineOrigin =
       Point(point.x * devUnitsPerAppUnit, point.y * devUnitsPerAppUnit);
 
+    float advanceSum = 0;
+
     for (PRUint32 c = 0; c < numRuns; c++) {
       gfxFont *font = runs[c].mFont;
       PRUint32 endRun = 0;
       if (c + 1 < numRuns) {
         endRun = runs[c + 1].mCharacterOffset;
       } else {
         endRun = mTextRun->GetLength();
       }
@@ -3079,18 +3081,16 @@ struct NS_STACK_CLASS nsCanvasBidiProces
 
       RefPtr<ScaledFont> scaledFont =
         gfxPlatform::GetPlatform()->GetScaledFontForFont(font);
 
       GlyphBuffer buffer;
 
       std::vector<Glyph> glyphBuf;
 
-      float advanceSum = 0;
-
       for (PRUint32 i = runs[c].mCharacterOffset; i < endRun; i++) {
         Glyph newGlyph;
         if (glyphs[i].IsSimpleGlyph()) {
           newGlyph.mIndex = glyphs[i].GetSimpleGlyph();
           if (mTextRun->IsRightToLeft()) {
             newGlyph.mPosition.x = baselineOrigin.x - advanceSum -
               glyphs[i].GetSimpleAdvance() * devUnitsPerAppUnit;
           } else {