OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. | 2 * Copyright (c) 2007, 2008, 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 | 58 |
59 static void paintGlyphs(GraphicsContext* gc, const SimpleFontData* font, | 59 static void paintGlyphs(GraphicsContext* gc, const SimpleFontData* font, |
60 const GlyphBufferGlyph* glyphs, unsigned numGlyphs, | 60 const GlyphBufferGlyph* glyphs, unsigned numGlyphs, |
61 SkPoint* pos, const FloatRect& textRect) | 61 SkPoint* pos, const FloatRect& textRect) |
62 { | 62 { |
63 TextDrawingModeFlags textMode = gc->textDrawingMode(); | 63 TextDrawingModeFlags textMode = gc->textDrawingMode(); |
64 | 64 |
65 // We draw text up to two times (once for fill, once for stroke). | 65 // We draw text up to two times (once for fill, once for stroke). |
66 if (textMode & TextModeFill) { | 66 if (textMode & TextModeFill) { |
67 SkPaint paint; | 67 SkPaint paint = gc->fillPaint(); |
68 gc->setupPaintForFilling(&paint); | |
69 font->platformData().setupPaint(&paint, gc); | 68 font->platformData().setupPaint(&paint, gc); |
70 gc->adjustTextRenderMode(&paint); | 69 gc->adjustTextRenderMode(&paint); |
71 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 70 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
72 | 71 |
73 gc->drawPosText(glyphs, numGlyphs << 1, pos, textRect, paint); | 72 gc->drawPosText(glyphs, numGlyphs << 1, pos, textRect, paint); |
74 } | 73 } |
75 | 74 |
76 if ((textMode & TextModeStroke) | 75 if ((textMode & TextModeStroke) |
77 && gc->strokeStyle() != NoStroke | 76 && gc->strokeStyle() != NoStroke |
78 && gc->strokeThickness() > 0) { | 77 && gc->strokeThickness() > 0) { |
79 | 78 |
80 SkPaint paint; | 79 SkPaint paint = gc->strokePaint(); |
81 gc->setupPaintForStroking(&paint); | |
82 font->platformData().setupPaint(&paint, gc); | 80 font->platformData().setupPaint(&paint, gc); |
83 gc->adjustTextRenderMode(&paint); | 81 gc->adjustTextRenderMode(&paint); |
84 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); | 82 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); |
85 | 83 |
86 if (textMode & TextModeFill) { | 84 if (textMode & TextModeFill) { |
87 // If there is a shadow and we filled above, there will already be | 85 // If there is a shadow and we filled above, there will already be |
88 // a shadow. We don't want to draw it again or it will be too dark | 86 // a shadow. We don't want to draw it again or it will be too dark |
89 // and it will go on top of the fill. | 87 // and it will go on top of the fill. |
90 // | 88 // |
91 // Note that this isn't strictly correct, since the stroke could be | 89 // Note that this isn't strictly correct, since the stroke could be |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 const FloatPoint& point, int height, | 238 const FloatPoint& point, int height, |
241 int from, int to) const | 239 int from, int to) const |
242 { | 240 { |
243 HarfBuzzShaper shaper(this, run); | 241 HarfBuzzShaper shaper(this, run); |
244 if (!shaper.shape()) | 242 if (!shaper.shape()) |
245 return FloatRect(); | 243 return FloatRect(); |
246 return shaper.selectionRect(point, height, from, to); | 244 return shaper.selectionRect(point, height, from, to); |
247 } | 245 } |
248 | 246 |
249 } // namespace WebCore | 247 } // namespace WebCore |
OLD | NEW |