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 "GrBitmapTextContext.h" | 8 #include "GrBitmapTextContext.h" |
9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 SkFixed halfSampleX = 0, halfSampleY = 0; | 232 SkFixed halfSampleX = 0, halfSampleY = 0; |
233 | 233 |
234 if (cache->isSubpixel()) { | 234 if (cache->isSubpixel()) { |
235 // maybe we should skip the rounding if linearText is set | 235 // maybe we should skip the rounding if linearText is set |
236 SkAxisAlignment baseline = SkComputeAxisAlignmentForHText(ctm); | 236 SkAxisAlignment baseline = SkComputeAxisAlignmentForHText(ctm); |
237 | 237 |
238 SkFixed fxMask = ~0; | 238 SkFixed fxMask = ~0; |
239 SkFixed fyMask = ~0; | 239 SkFixed fyMask = ~0; |
240 if (kX_SkAxisAlignment == baseline) { | 240 if (kX_SkAxisAlignment == baseline) { |
241 fyMask = 0; | 241 fyMask = 0; |
242 #ifndef SK_IGNORE_SUBPIXEL_AXIS_ALIGN_FIX | |
243 halfSampleY = SK_FixedHalf; | 242 halfSampleY = SK_FixedHalf; |
244 #endif | |
245 } else if (kY_SkAxisAlignment == baseline) { | 243 } else if (kY_SkAxisAlignment == baseline) { |
246 fxMask = 0; | 244 fxMask = 0; |
247 #ifndef SK_IGNORE_SUBPIXEL_AXIS_ALIGN_FIX | |
248 halfSampleX = SK_FixedHalf; | 245 halfSampleX = SK_FixedHalf; |
249 #endif | |
250 } | 246 } |
251 | 247 |
252 if (SkPaint::kLeft_Align == fSkPaint.getTextAlign()) { | 248 if (SkPaint::kLeft_Align == fSkPaint.getTextAlign()) { |
253 while (text < stop) { | 249 while (text < stop) { |
254 SkPoint tmsLoc; | 250 SkPoint tmsLoc; |
255 tmsProc(pos, &tmsLoc); | 251 tmsProc(pos, &tmsLoc); |
256 SkFixed fx = SkScalarToFixed(tmsLoc.fX) + halfSampleX; | 252 SkFixed fx = SkScalarToFixed(tmsLoc.fX) + halfSampleX; |
257 SkFixed fy = SkScalarToFixed(tmsLoc.fY) + halfSampleY; | 253 SkFixed fy = SkScalarToFixed(tmsLoc.fY) + halfSampleY; |
258 | 254 |
259 const SkGlyph& glyph = glyphCacheProc(cache, &text, | 255 const SkGlyph& glyph = glyphCacheProc(cache, &text, |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } | 635 } |
640 } | 636 } |
641 | 637 |
642 inline void GrBitmapTextContext::finish() { | 638 inline void GrBitmapTextContext::finish() { |
643 this->flush(); | 639 this->flush(); |
644 fTotalVertexCount = 0; | 640 fTotalVertexCount = 0; |
645 | 641 |
646 GrTextContext::finish(); | 642 GrTextContext::finish(); |
647 } | 643 } |
648 | 644 |
OLD | NEW |