| 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 "GrBatch.h" | 9 #include "GrBatch.h" |
| 10 #include "GrBatchFontCache.h" | 10 #include "GrBatchFontCache.h" |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 const SkMatrix& viewMatr
ix) { | 435 const SkMatrix& viewMatr
ix) { |
| 436 // TODO: support perspective (need getMaxScale replacement) | 436 // TODO: support perspective (need getMaxScale replacement) |
| 437 if (viewMatrix.hasPerspective()) { | 437 if (viewMatrix.hasPerspective()) { |
| 438 return false; | 438 return false; |
| 439 } | 439 } |
| 440 | 440 |
| 441 SkScalar maxScale = viewMatrix.getMaxScale(); | 441 SkScalar maxScale = viewMatrix.getMaxScale(); |
| 442 SkScalar scaledTextSize = maxScale*skPaint.getTextSize(); | 442 SkScalar scaledTextSize = maxScale*skPaint.getTextSize(); |
| 443 // Hinted text looks far better at small resolutions | 443 // Hinted text looks far better at small resolutions |
| 444 // Scaling up beyond 2x yields undesireable artifacts | 444 // Scaling up beyond 2x yields undesireable artifacts |
| 445 if (scaledTextSize < kMinDFFontSize || scaledTextSize >= kLargeDFFontLimit)
{ | 445 if (scaledTextSize < kMinDFFontSize || scaledTextSize > kLargeDFFontLimit) { |
| 446 return false; | 446 return false; |
| 447 } | 447 } |
| 448 | 448 |
| 449 bool useDFT = fSurfaceProps.isUseDistanceFieldFonts(); | 449 bool useDFT = fSurfaceProps.isUseDistanceFieldFonts(); |
| 450 #if SK_FORCE_DISTANCE_FIELD_TEXT | 450 #if SK_FORCE_DISTANCE_FIELD_TEXT |
| 451 useDFT = true; | 451 useDFT = true; |
| 452 #endif | 452 #endif |
| 453 | 453 |
| 454 if (!useDFT && scaledTextSize < kLargeDFFontSize) { | 454 if (!useDFT && scaledTextSize < kLargeDFFontSize) { |
| 455 return false; | 455 return false; |
| (...skipping 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2267 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, | 2267 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, |
| 2268 static_cast<size_t>(textLen), 0, 0,
noClip)); | 2268 static_cast<size_t>(textLen), 0, 0,
noClip)); |
| 2269 | 2269 |
| 2270 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 2270 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
| 2271 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 2271 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
| 2272 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun
s[0].fSubRunInfo[0]; | 2272 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun
s[0].fSubRunInfo[0]; |
| 2273 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); | 2273 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); |
| 2274 } | 2274 } |
| 2275 | 2275 |
| 2276 #endif | 2276 #endif |
| OLD | NEW |