OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2011 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 SkScalar y = SkFloatToScalar(point.y()); | 111 SkScalar y = SkFloatToScalar(point.y()); |
112 | 112 |
113 if (font->platformData().orientation() == Vertical) | 113 if (font->platformData().orientation() == Vertical) |
114 y += SkFloatToScalar(font->fontMetrics().floatAscent(IdeographicBaseline
) - font->fontMetrics().floatAscent()); | 114 y += SkFloatToScalar(font->fontMetrics().floatAscent(IdeographicBaseline
) - font->fontMetrics().floatAscent()); |
115 // FIXME: text rendering speed: | 115 // FIXME: text rendering speed: |
116 // Android has code in their WebCore fork to special case when the | 116 // Android has code in their WebCore fork to special case when the |
117 // GlyphBuffer has no advances other than the defaults. In that case the | 117 // GlyphBuffer has no advances other than the defaults. In that case the |
118 // text drawing can proceed faster. However, it's unclear when those | 118 // text drawing can proceed faster. However, it's unclear when those |
119 // patches may be upstreamed to WebKit so we always use the slower path | 119 // patches may be upstreamed to WebKit so we always use the slower path |
120 // here. | 120 // here. |
121 const GlyphBufferAdvance* adv = glyphBuffer.advances(from); | 121 const FloatSize* adv = glyphBuffer.advances(from); |
122 SkAutoSTMalloc<32, SkPoint> storage(numGlyphs); | 122 SkAutoSTMalloc<32, SkPoint> storage(numGlyphs); |
123 SkPoint* pos = storage.get(); | 123 SkPoint* pos = storage.get(); |
124 | 124 |
125 for (unsigned i = 0; i < numGlyphs; i++) { | 125 for (unsigned i = 0; i < numGlyphs; i++) { |
126 pos[i].set(x, y); | 126 pos[i].set(x, y); |
127 x += SkFloatToScalar(adv[i].width()); | 127 x += SkFloatToScalar(adv[i].width()); |
128 y += SkFloatToScalar(adv[i].height()); | 128 y += SkFloatToScalar(adv[i].height()); |
129 } | 129 } |
130 | 130 |
131 if (font->platformData().orientation() == Vertical) { | 131 if (font->platformData().orientation() == Vertical) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 paint.setLooper(0); | 163 paint.setLooper(0); |
164 } | 164 } |
165 | 165 |
166 gc->drawPosText(glyphs, numGlyphs * sizeof(Glyph), pos, textRect, paint)
; | 166 gc->drawPosText(glyphs, numGlyphs * sizeof(Glyph), pos, textRect, paint)
; |
167 } | 167 } |
168 if (font->platformData().orientation() == Vertical) | 168 if (font->platformData().orientation() == Vertical) |
169 gc->restore(); | 169 gc->restore(); |
170 } | 170 } |
171 | 171 |
172 } // namespace WebCore | 172 } // namespace WebCore |
OLD | NEW |