Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(605)

Side by Side Diff: src/gpu/GrAtlasTextContext.cpp

Issue 1178713005: Revert of Bump up point where we switch to distance fields for large glyphs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + sizeof (SkIPoint16); 49 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + sizeof (SkIPoint16);
50 50
51 static const int kMinDFFontSize = 18; 51 static const int kMinDFFontSize = 18;
52 static const int kSmallDFFontSize = 32; 52 static const int kSmallDFFontSize = 32;
53 static const int kSmallDFFontLimit = 32; 53 static const int kSmallDFFontLimit = 32;
54 static const int kMediumDFFontSize = 72; 54 static const int kMediumDFFontSize = 72;
55 static const int kMediumDFFontLimit = 72; 55 static const int kMediumDFFontLimit = 72;
56 static const int kLargeDFFontSize = 162; 56 static const int kLargeDFFontSize = 162;
57 static const int kLargeDFFontLimit = 2 * kLargeDFFontSize; 57 static const int kLargeDFFontLimit = 2 * kLargeDFFontSize;
58 58
59 static const int kLargeGlyphLimit = 192;
60
61 SkDEBUGCODE(static const int kExpectedDistanceAdjustTableSize = 8;) 59 SkDEBUGCODE(static const int kExpectedDistanceAdjustTableSize = 8;)
62 static const int kDistanceAdjustLumShift = 5; 60 static const int kDistanceAdjustLumShift = 5;
63 61
64 static const int kVerticesPerGlyph = 4; 62 static const int kVerticesPerGlyph = 4;
65 static const int kIndicesPerGlyph = 6; 63 static const int kIndicesPerGlyph = 6;
66 64
67 static size_t get_vertex_stride(GrMaskFormat maskFormat) { 65 static size_t get_vertex_stride(GrMaskFormat maskFormat) {
68 switch (maskFormat) { 66 switch (maskFormat) {
69 case kA8_GrMaskFormat: 67 case kA8_GrMaskFormat:
70 return kGrayTextVASize; 68 return kGrayTextVASize;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 446
449 SkScalar maxScale = viewMatrix.getMaxScale(); 447 SkScalar maxScale = viewMatrix.getMaxScale();
450 SkScalar scaledTextSize = maxScale*skPaint.getTextSize(); 448 SkScalar scaledTextSize = maxScale*skPaint.getTextSize();
451 // Hinted text looks far better at small resolutions 449 // Hinted text looks far better at small resolutions
452 // Scaling up beyond 2x yields undesireable artifacts 450 // Scaling up beyond 2x yields undesireable artifacts
453 if (scaledTextSize < kMinDFFontSize || scaledTextSize > kLargeDFFontLimit) { 451 if (scaledTextSize < kMinDFFontSize || scaledTextSize > kLargeDFFontLimit) {
454 return false; 452 return false;
455 } 453 }
456 454
457 if (!fEnableDFRendering && !skPaint.isDistanceFieldTextTEMP() && 455 if (!fEnableDFRendering && !skPaint.isDistanceFieldTextTEMP() &&
458 scaledTextSize < kLargeGlyphLimit) { 456 scaledTextSize < kLargeDFFontSize) {
459 return false; 457 return false;
460 } 458 }
461 459
462 // rasterizers and mask filters modify alpha, which doesn't 460 // rasterizers and mask filters modify alpha, which doesn't
463 // translate well to distance 461 // translate well to distance
464 if (skPaint.getRasterizer() || skPaint.getMaskFilter() || 462 if (skPaint.getRasterizer() || skPaint.getMaskFilter() ||
465 !fContext->caps()->shaderCaps()->shaderDerivativeSupport()) { 463 !fContext->caps()->shaderCaps()->shaderDerivativeSupport()) {
466 return false; 464 return false;
467 } 465 }
468 466
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text, 2284 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text,
2287 static_cast<size_t>(textLen), 0, 0, noClip)); 2285 static_cast<size_t>(textLen), 0, 0, noClip));
2288 2286
2289 SkScalar transX = static_cast<SkScalar>(random->nextU()); 2287 SkScalar transX = static_cast<SkScalar>(random->nextU());
2290 SkScalar transY = static_cast<SkScalar>(random->nextU()); 2288 SkScalar transY = static_cast<SkScalar>(random->nextU());
2291 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun s[0].fSubRunInfo[0]; 2289 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun s[0].fSubRunInfo[0];
2292 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint); 2290 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint);
2293 } 2291 }
2294 2292
2295 #endif 2293 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698