Changeset 194132 in webkit


Ignore:
Timestamp:
Dec 15, 2015 10:28:13 PM (8 years ago)
Author:
Alan Bujtas
Message:

FontCascade cleanup: Remove ::drawSimpleText and ::drawComplexText.
https://bugs.webkit.org/show_bug.cgi?id=152323

Reviewed by Myles C. Maxfield.

Platform code for ::drawComplexText() is redundant and has
no platform dependent logic. Move it all to ::drawText()

No change in functionality.

  • platform/graphics/FontCascade.cpp:

(WebCore::FontCascade::glyphBufferForTextRun):
(WebCore::FontCascade::drawText):
(WebCore::FontCascade::drawSimpleText): Deleted.

  • platform/graphics/FontCascade.h:
  • platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:

(WebCore::FontCascade::drawComplexText): Deleted.

  • platform/graphics/cocoa/FontCascadeCocoa.mm:

(WebCore::FontCascade::drawComplexText): Deleted.

  • platform/graphics/win/FontWin.cpp:

(WebCore::FontCascade::drawComplexText): Deleted.

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r194125 r194132  
     12015-12-15  Zalan Bujtas  <zalan@apple.com>
     2
     3        FontCascade cleanup: Remove ::drawSimpleText and ::drawComplexText.
     4        https://bugs.webkit.org/show_bug.cgi?id=152323
     5
     6        Reviewed by Myles C. Maxfield.
     7
     8        Platform code for ::drawComplexText() is redundant and has
     9        no platform dependent logic. Move it all to ::drawText()
     10
     11        No change in functionality.
     12
     13        * platform/graphics/FontCascade.cpp:
     14        (WebCore::FontCascade::glyphBufferForTextRun):
     15        (WebCore::FontCascade::drawText):
     16        (WebCore::FontCascade::drawSimpleText): Deleted.
     17        * platform/graphics/FontCascade.h:
     18        * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
     19        (WebCore::FontCascade::drawComplexText): Deleted.
     20        * platform/graphics/cocoa/FontCascadeCocoa.mm:
     21        (WebCore::FontCascade::drawComplexText): Deleted.
     22        * platform/graphics/win/FontWin.cpp:
     23        (WebCore::FontCascade::drawComplexText): Deleted.
     24
    1252015-12-15  Tim Horton  <timothy_horton@apple.com>
    226
  • trunk/Source/WebCore/platform/graphics/FontCascade.cpp

    r192992 r194132  
    307307}
    308308
     309float FontCascade::glyphBufferForTextRun(CodePath codePathToUse, const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer) const
     310{
     311    if (codePathToUse != Complex)
     312        return getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer);
     313    return getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
     314}
     315
    309316float FontCascade::drawText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to, CustomFontNotReadyAction customFontNotReadyAction) const
    310317{
     
    322329        codePathToUse = Complex;
    323330
    324     if (codePathToUse != Complex)
    325         return drawSimpleText(context, run, point, from, to);
    326 
    327     return drawComplexText(context, run, point, from, to);
     331    GlyphBuffer glyphBuffer;
     332    float startX = point.x() + glyphBufferForTextRun(codePathToUse, run, from, to, glyphBuffer);
     333    // We couldn't generate any glyphs for the run. Give up.
     334    if (glyphBuffer.isEmpty())
     335        return 0;
     336    // Draw the glyph buffer now at the starting point returned in startX.
     337    FloatPoint startPoint(startX, point.y());
     338    drawGlyphBuffer(context, run, glyphBuffer, startPoint);
     339    return startPoint.x() - startX;
    328340}
    329341
     
    12931305}
    12941306
    1295 float FontCascade::drawSimpleText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const
    1296 {
    1297     // This glyph buffer holds our glyphs+advances+font data for each glyph.
    1298     GlyphBuffer glyphBuffer;
    1299 
    1300     float startX = point.x() + getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer);
    1301 
    1302     if (glyphBuffer.isEmpty())
    1303         return 0;
    1304 
    1305     FloatPoint startPoint(startX, point.y());
    1306     drawGlyphBuffer(context, run, glyphBuffer, startPoint);
    1307 
    1308     return startPoint.x() - startX;
    1309 }
    1310 
    13111307void FontCascade::drawEmphasisMarksForSimpleText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
    13121308{
  • trunk/Source/WebCore/platform/graphics/FontCascade.h

    r193894 r194132  
    223223    enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis };
    224224
     225    float glyphBufferForTextRun(CodePath, const TextRun&, int from, int to, GlyphBuffer&) const;
    225226    // Returns the initial in-stream advance.
    226227    float getGlyphsAndAdvancesForSimpleText(const TextRun&, int from, int to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
    227     float drawSimpleText(GraphicsContext&, const TextRun&, const FloatPoint&, int from, int to) const;
    228228    void drawEmphasisMarksForSimpleText(GraphicsContext&, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const;
    229229    void drawGlyphBuffer(GraphicsContext&, const TextRun&, const GlyphBuffer&, FloatPoint&) const;
     
    240240    // Returns the initial in-stream advance.
    241241    float getGlyphsAndAdvancesForComplexText(const TextRun&, int from, int to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const;
    242     float drawComplexText(GraphicsContext&, const TextRun&, const FloatPoint&, int from, int to) const;
    243242    void drawEmphasisMarksForComplexText(GraphicsContext&, const TextRun&, const AtomicString& mark, const FloatPoint&, int from, int to) const;
    244243    float floatWidthForComplexText(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
  • trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp

    r189144 r194132  
    5353}
    5454
    55 float FontCascade::drawComplexText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const
    56 {
    57     // This glyph buffer holds our glyphs + advances + font data for each glyph.
    58     GlyphBuffer glyphBuffer;
    59 
    60     float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
    61 
    62     // We couldn't generate any glyphs for the run. Give up.
    63     if (glyphBuffer.isEmpty())
    64         return 0;
    65 
    66     // Draw the glyph buffer now at the starting point returned in startX.
    67     FloatPoint startPoint(startX, point.y());
    68     drawGlyphBuffer(context, run, glyphBuffer, startPoint);
    69 
    70     return startPoint.x() - startX;
    71 }
    72 
    7355void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const
    7456{
  • trunk/Source/WebCore/platform/graphics/cocoa/FontCascadeCocoa.mm

    r193894 r194132  
    643643}
    644644
    645 float FontCascade::drawComplexText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const
    646 {
    647     // This glyph buffer holds our glyphs + advances + font data for each glyph.
    648     GlyphBuffer glyphBuffer;
    649 
    650     float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
    651 
    652     // We couldn't generate any glyphs for the run. Give up.
    653     if (glyphBuffer.isEmpty())
    654         return 0;
    655 
    656     // Draw the glyph buffer now at the starting point returned in startX.
    657     FloatPoint startPoint(startX, point.y());
    658     drawGlyphBuffer(context, run, glyphBuffer, startPoint);
    659 
    660     return startPoint.x() - startX;
    661 }
    662 
    663645void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
    664646{
  • trunk/Source/WebCore/platform/graphics/win/FontWin.cpp

    r189144 r194132  
    9292}
    9393
    94 float FontCascade::drawComplexText(GraphicsContext& context, const TextRun& run, const FloatPoint& point, int from, int to) const
    95 {
    96     // This glyph buffer holds our glyphs + advances + font data for each glyph.
    97     GlyphBuffer glyphBuffer;
    98 
    99     float startX = point.x() + getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer);
    100 
    101     // We couldn't generate any glyphs for the run.  Give up.
    102     if (glyphBuffer.isEmpty())
    103         return 0;
    104 
    105     // Draw the glyph buffer now at the starting point returned in startX.
    106     FloatPoint startPoint(startX, point.y());
    107     drawGlyphBuffer(context, run, glyphBuffer, startPoint);
    108     return startPoint.x() - startX;
    109 }
    110 
    11194void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
    11295{
Note: See TracChangeset for help on using the changeset viewer.