OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrDistanceFieldTextContext.h" | 8 #include "GrDistanceFieldTextContext.h" |
9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
10 #include "GrBitmapTextContext.h" | 10 #include "GrBitmapTextContext.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 } | 239 } |
240 | 240 |
241 SkAutoKern autokern; | 241 SkAutoKern autokern; |
242 const char* stop = text + byteLength; | 242 const char* stop = text + byteLength; |
243 while (textPtr < stop) { | 243 while (textPtr < stop) { |
244 // don't need x, y here, since all subpixel variants will have the | 244 // don't need x, y here, since all subpixel variants will have the |
245 // same advance | 245 // same advance |
246 const SkGlyph& glyph = glyphCacheProc(cache, &textPtr, 0, 0); | 246 const SkGlyph& glyph = glyphCacheProc(cache, &textPtr, 0, 0); |
247 | 247 |
248 SkFixed width = glyph.fAdvanceX + autokern.adjust(glyph); | 248 SkFixed width = glyph.fAdvanceX + autokern.adjust(glyph); |
249 positions.push_back(SkFixedToScalar(stopX + SkFixedMul_portable(origin,
width))); | 249 positions.push_back(SkFixedToScalar(stopX + SkFixedMul(origin, width))); |
250 | 250 |
251 SkFixed height = glyph.fAdvanceY; | 251 SkFixed height = glyph.fAdvanceY; |
252 positions.push_back(SkFixedToScalar(stopY + SkFixedMul_portable(origin,
height))); | 252 positions.push_back(SkFixedToScalar(stopY + SkFixedMul(origin, height)))
; |
253 | 253 |
254 stopX += width; | 254 stopX += width; |
255 stopY += height; | 255 stopY += height; |
256 } | 256 } |
257 SkASSERT(textPtr == stop); | 257 SkASSERT(textPtr == stop); |
258 | 258 |
259 // now adjust starting point depending on alignment | 259 // now adjust starting point depending on alignment |
260 SkScalar alignX = SkFixedToScalar(stopX); | 260 SkScalar alignX = SkFixedToScalar(stopX); |
261 SkScalar alignY = SkFixedToScalar(stopY); | 261 SkScalar alignY = SkFixedToScalar(stopY); |
262 if (skPaint.getTextAlign() == SkPaint::kCenter_Align) { | 262 if (skPaint.getTextAlign() == SkPaint::kCenter_Align) { |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 } | 718 } |
719 } | 719 } |
720 | 720 |
721 inline void GrDistanceFieldTextContext::finish() { | 721 inline void GrDistanceFieldTextContext::finish() { |
722 this->flush(); | 722 this->flush(); |
723 fTotalVertexCount = 0; | 723 fTotalVertexCount = 0; |
724 | 724 |
725 GrTextContext::finish(); | 725 GrTextContext::finish(); |
726 } | 726 } |
727 | 727 |
OLD | NEW |