OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #include "GrAtlasTextContext.h" | 7 #include "GrAtlasTextContext.h" |
8 | 8 |
9 #include "GrBatchFontCache.h" | 9 #include "GrBatchFontCache.h" |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 } | 451 } |
452 | 452 |
453 SkScalar maxScale = viewMatrix.getMaxScale(); | 453 SkScalar maxScale = viewMatrix.getMaxScale(); |
454 SkScalar scaledTextSize = maxScale*skPaint.getTextSize(); | 454 SkScalar scaledTextSize = maxScale*skPaint.getTextSize(); |
455 // Hinted text looks far better at small resolutions | 455 // Hinted text looks far better at small resolutions |
456 // Scaling up beyond 2x yields undesireable artifacts | 456 // Scaling up beyond 2x yields undesireable artifacts |
457 if (scaledTextSize < kMinDFFontSize || scaledTextSize > kLargeDFFontLimit) { | 457 if (scaledTextSize < kMinDFFontSize || scaledTextSize > kLargeDFFontLimit) { |
458 return false; | 458 return false; |
459 } | 459 } |
460 | 460 |
461 bool useDFT = fSurfaceProps.isUseDistanceFieldFonts(); | 461 bool useDFT = fSurfaceProps.isUseDeviceIndependentFonts(); |
462 #if SK_FORCE_DISTANCE_FIELD_TEXT | 462 #if SK_FORCE_DISTANCE_FIELD_TEXT |
463 useDFT = true; | 463 useDFT = true; |
464 #endif | 464 #endif |
465 | 465 |
466 if (!useDFT && scaledTextSize < kLargeDFFontSize) { | 466 if (!useDFT && scaledTextSize < kLargeDFFontSize) { |
467 return false; | 467 return false; |
468 } | 468 } |
469 | 469 |
470 // rasterizers and mask filters modify alpha, which doesn't | 470 // rasterizers and mask filters modify alpha, which doesn't |
471 // translate well to distance | 471 // translate well to distance |
(...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, | 2285 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, |
2286 static_cast<size_t>(textLen), 0, 0,
noClip)); | 2286 static_cast<size_t>(textLen), 0, 0,
noClip)); |
2287 | 2287 |
2288 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 2288 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
2289 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 2289 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
2290 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; | 2290 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; |
2291 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); | 2291 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); |
2292 } | 2292 } |
2293 | 2293 |
2294 #endif | 2294 #endif |
OLD | NEW |