Title: [86667] trunk/Source/WebCore
- Revision
- 86667
- Author
- [email protected]
- Date
- 2011-05-17 04:36:55 -0700 (Tue, 17 May 2011)
Log Message
2011-05-17 Andreas Kling <[email protected]>
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.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (86666 => 86667)
--- trunk/Source/WebCore/ChangeLog 2011-05-17 11:34:53 UTC (rev 86666)
+++ trunk/Source/WebCore/ChangeLog 2011-05-17 11:36:55 UTC (rev 86667)
@@ -1,3 +1,16 @@
+2011-05-17 Andreas Kling <[email protected]>
+
+ 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.
+
2011-05-17 Andreas Kling <[email protected]>
Reviewed by Kenneth Rohde Christiansen.
Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (86666 => 86667)
--- trunk/Source/WebCore/platform/graphics/Font.cpp 2011-05-17 11:34:53 UTC (rev 86666)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp 2011-05-17 11:36:55 UTC (rev 86667)
@@ -28,7 +28,6 @@
#include "FontCache.h"
#include "FontTranscoder.h"
#if PLATFORM(QT) && HAVE(QRAWFONT)
-#include "ContextShadow.h"
#include "GraphicsContext.h"
#endif
#include "IntPoint.h"
@@ -146,7 +145,7 @@
CodePath codePathToUse = codePath(run);
#if PLATFORM(QT) && HAVE(QRAWFONT)
- if (context->textDrawingMode() & TextModeStroke || context->contextShadow()->m_type != ContextShadow::NoShadow)
+ if (context->textDrawingMode() & TextModeStroke)
codePathToUse = Complex;
#endif
Modified: trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp (86666 => 86667)
--- trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp 2011-05-17 11:34:53 UTC (rev 86666)
+++ trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp 2011-05-17 11:36:55 UTC (rev 86667)
@@ -339,7 +339,7 @@
glyphIndexes.reserve(numGlyphs);
positions.reserve(numGlyphs);
- float x = 0;
+ float width = 0;
for (int i = 0; i < numGlyphs; ++i) {
Glyph glyph = glyphBuffer.glyphAt(from + i);
@@ -347,17 +347,48 @@
if (!glyph)
continue;
glyphIndexes.append(glyph);
- positions.append(QPointF(x, 0));
- x += advance;
+ positions.append(QPointF(width, 0));
+ width += advance;
}
+ QRawFont rawFont(fontData->platformData().rawFont());
+
QGlyphs qtGlyphs;
qtGlyphs.setGlyphIndexes(glyphIndexes);
qtGlyphs.setPositions(positions);
- qtGlyphs.setFont(fontData->platformData().rawFont());
+ qtGlyphs.setFont(rawFont);
QPainter* painter = context->platformContext();
+ ContextShadow* shadow = context->contextShadow();
+ switch (shadow->m_type) {
+ case ContextShadow::SolidShadow: {
+ QPen previousPen = painter->pen();
+ painter->setPen(shadow->m_color);
+ painter->translate(shadow->offset());
+ painter->drawGlyphs(point, qtGlyphs);
+ painter->translate(-shadow->offset());
+ painter->setPen(previousPen);
+ break;
+ }
+ case ContextShadow::BlurShadow: {
+ qreal height = rawFont.ascent() + rawFont.descent() + 1;
+ QRectF boundingRect(point.x(), point.y() - rawFont.ascent(), width, height);
+ QPainter* shadowPainter = shadow->beginShadowLayer(context, boundingRect);
+ if (shadowPainter) {
+ shadowPainter->setPen(shadow->m_color);
+ shadowPainter->drawGlyphs(point, qtGlyphs);
+ shadow->endShadowLayer(context);
+ }
+ break;
+ }
+ case ContextShadow::NoShadow:
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ break;
+ }
+
QPen previousPen = painter->pen();
painter->setPen(fillPenForContext(context));
painter->drawGlyphs(point, qtGlyphs);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes