Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1242)

Unified Diff: third_party/WebKit/WebCore/platform/graphics/chromium/FontLinux.cpp

Issue 18176: Linux: stroke font outlines.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/WebCore/platform/graphics/chromium/FontLinux.cpp
===================================================================
--- third_party/WebKit/WebCore/platform/graphics/chromium/FontLinux.cpp (revision 8077)
+++ third_party/WebKit/WebCore/platform/graphics/chromium/FontLinux.cpp (working copy)
@@ -49,14 +49,6 @@
void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
const GlyphBuffer& glyphBuffer, int from, int numGlyphs,
const FloatPoint& point) const {
- SkCanvas* canvas = gc->platformContext()->canvas();
- SkPaint paint;
-
- gc->platformContext()->setupPaintCommon(&paint);
- font->platformData().setupPaint(&paint);
- paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
- paint.setColor(gc->fillColor().rgb());
-
SkASSERT(sizeof(GlyphBufferGlyph) == sizeof(uint16_t)); // compile-time assert
const GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from);
@@ -78,7 +70,38 @@
x += SkFloatToScalar(adv[i].width());
y += SkFloatToScalar(adv[i].height());
}
- canvas->drawPosText(glyphs, numGlyphs << 1, pos, paint);
+
+ SkCanvas* canvas = gc->platformContext()->canvas();
+ SkPaint paint;
+ int textMode = gc->platformContext()->getTextDrawingMode();
+
+ // We draw text up to two times (once for fill, once for stroke).
+ if (textMode & cTextFill) {
+ gc->platformContext()->setupPaintForFilling(&paint);
+ font->platformData().setupPaint(&paint);
+ paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+ paint.setColor(gc->fillColor().rgb());
+ canvas->drawPosText(glyphs, numGlyphs << 1, pos, paint);
+ paint.reset();
+ }
+
+ if ((textMode & cTextStroke)
+ && gc->platformContext()->getStrokeStyle() != NoStroke
+ && gc->platformContext()->getStrokeThickness() > 0) {
+
+ gc->platformContext()->setupPaintForStroking(&paint, 0, 0);
+ font->platformData().setupPaint(&paint);
+ paint.setFlags(SkPaint::kAntiAlias_Flag);
+ paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+ paint.setColor(gc->strokeColor().rgb());
+
+ if (textMode & cTextFill) {
+ // See comment in FontChromiumWin.cpp::paintSkiaText()
+ paint.setLooper(0)->safeUnref();
+ }
+
+ canvas->drawPosText(glyphs, numGlyphs << 1, pos, paint);
+ }
}
void Font::drawComplexText(GraphicsContext* context, const TextRun& run,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698