Changeset 86667 in webkit


Ignore:
Timestamp:
May 17, 2011 4:36:55 AM (13 years ago)
Author:
andreas.kling@nokia.com
Message:

2011-05-17 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Support shadowed text in fast font path.
https://bugs.webkit.org/show_bug.cgi?id=60462

  • platform/graphics/Font.cpp: (WebCore::Font::drawText): Remove complex path shortcut for shadowed text.
  • platform/graphics/qt/FontQt.cpp: (WebCore::Font::drawGlyphs): Paint shadows for simple text.
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86666 r86667  
     12011-05-17  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Support shadowed text in fast font path.
     6        https://bugs.webkit.org/show_bug.cgi?id=60462
     7
     8        * platform/graphics/Font.cpp:
     9        (WebCore::Font::drawText): Remove complex path shortcut for shadowed text.
     10
     11        * platform/graphics/qt/FontQt.cpp:
     12        (WebCore::Font::drawGlyphs): Paint shadows for simple text.
     13
    1142011-05-17  Andreas Kling  <kling@webkit.org>
    215
  • trunk/Source/WebCore/platform/graphics/Font.cpp

    r85853 r86667  
    2929#include "FontTranscoder.h"
    3030#if PLATFORM(QT) && HAVE(QRAWFONT)
    31 #include "ContextShadow.h"
    3231#include "GraphicsContext.h"
    3332#endif
     
    147146
    148147#if PLATFORM(QT) && HAVE(QRAWFONT)
    149     if (context->textDrawingMode() & TextModeStroke || context->contextShadow()->m_type != ContextShadow::NoShadow)
     148    if (context->textDrawingMode() & TextModeStroke)
    150149        codePathToUse = Complex;
    151150#endif
  • trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp

    r85853 r86667  
    340340    positions.reserve(numGlyphs);
    341341
    342     float x = 0;
     342    float width = 0;
    343343
    344344    for (int i = 0; i < numGlyphs; ++i) {
     
    348348            continue;
    349349        glyphIndexes.append(glyph);
    350         positions.append(QPointF(x, 0));
    351         x += advance;
    352     }
     350        positions.append(QPointF(width, 0));
     351        width += advance;
     352    }
     353
     354    QRawFont rawFont(fontData->platformData().rawFont());
    353355
    354356    QGlyphs qtGlyphs;
    355357    qtGlyphs.setGlyphIndexes(glyphIndexes);
    356358    qtGlyphs.setPositions(positions);
    357     qtGlyphs.setFont(fontData->platformData().rawFont());
     359    qtGlyphs.setFont(rawFont);
    358360
    359361    QPainter* painter = context->platformContext();
     362
     363    ContextShadow* shadow = context->contextShadow();
     364    switch (shadow->m_type) {
     365    case ContextShadow::SolidShadow: {
     366        QPen previousPen = painter->pen();
     367        painter->setPen(shadow->m_color);
     368        painter->translate(shadow->offset());
     369        painter->drawGlyphs(point, qtGlyphs);
     370        painter->translate(-shadow->offset());
     371        painter->setPen(previousPen);
     372        break;
     373    }
     374    case ContextShadow::BlurShadow: {
     375        qreal height = rawFont.ascent() + rawFont.descent() + 1;
     376        QRectF boundingRect(point.x(), point.y() - rawFont.ascent(), width, height);
     377        QPainter* shadowPainter = shadow->beginShadowLayer(context, boundingRect);
     378        if (shadowPainter) {
     379            shadowPainter->setPen(shadow->m_color);
     380            shadowPainter->drawGlyphs(point, qtGlyphs);
     381            shadow->endShadowLayer(context);
     382        }
     383        break;
     384    }
     385    case ContextShadow::NoShadow:
     386        break;
     387    default:
     388        ASSERT_NOT_REACHED();
     389        break;
     390    }
    360391
    361392    QPen previousPen = painter->pen();
Note: See TracChangeset for help on using the changeset viewer.