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

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

Issue 1183053005: Switch to glyphs as paths at a higher point size on Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase to ToT 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); 48 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16);
49 49
50 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + sizeof (SkIPoint16); 50 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + sizeof (SkIPoint16);
51 51
52 static const int kMinDFFontSize = 18; 52 static const int kMinDFFontSize = 18;
53 static const int kSmallDFFontSize = 32; 53 static const int kSmallDFFontSize = 32;
54 static const int kSmallDFFontLimit = 32; 54 static const int kSmallDFFontLimit = 32;
55 static const int kMediumDFFontSize = 72; 55 static const int kMediumDFFontSize = 72;
56 static const int kMediumDFFontLimit = 72; 56 static const int kMediumDFFontLimit = 72;
57 static const int kLargeDFFontSize = 162; 57 static const int kLargeDFFontSize = 162;
58 #ifdef SK_BUILD_FOR_ANDROID
59 static const int kLargeDFFontLimit = 384;
60 #else
58 static const int kLargeDFFontLimit = 2 * kLargeDFFontSize; 61 static const int kLargeDFFontLimit = 2 * kLargeDFFontSize;
62 #endif
59 63
60 SkDEBUGCODE(static const int kExpectedDistanceAdjustTableSize = 8;) 64 SkDEBUGCODE(static const int kExpectedDistanceAdjustTableSize = 8;)
61 static const int kDistanceAdjustLumShift = 5; 65 static const int kDistanceAdjustLumShift = 5;
62 66
63 static const int kVerticesPerGlyph = 4; 67 static const int kVerticesPerGlyph = 4;
64 static const int kIndicesPerGlyph = 6; 68 static const int kIndicesPerGlyph = 6;
65 69
66 static size_t get_vertex_stride(GrMaskFormat maskFormat) { 70 static size_t get_vertex_stride(GrMaskFormat maskFormat) {
67 switch (maskFormat) { 71 switch (maskFormat) {
68 case kA8_GrMaskFormat: 72 case kA8_GrMaskFormat:
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 const SkMatrix& viewMatr ix) { 435 const SkMatrix& viewMatr ix) {
432 // TODO: support perspective (need getMaxScale replacement) 436 // TODO: support perspective (need getMaxScale replacement)
433 if (viewMatrix.hasPerspective()) { 437 if (viewMatrix.hasPerspective()) {
434 return false; 438 return false;
435 } 439 }
436 440
437 SkScalar maxScale = viewMatrix.getMaxScale(); 441 SkScalar maxScale = viewMatrix.getMaxScale();
438 SkScalar scaledTextSize = maxScale*skPaint.getTextSize(); 442 SkScalar scaledTextSize = maxScale*skPaint.getTextSize();
439 // Hinted text looks far better at small resolutions 443 // Hinted text looks far better at small resolutions
440 // Scaling up beyond 2x yields undesireable artifacts 444 // Scaling up beyond 2x yields undesireable artifacts
441 if (scaledTextSize < kMinDFFontSize || scaledTextSize > kLargeDFFontLimit) { 445 if (scaledTextSize < kMinDFFontSize || scaledTextSize >= kLargeDFFontLimit) {
442 return false; 446 return false;
443 } 447 }
444 448
445 bool useDFT = fDeviceProperties.useDFT(); 449 bool useDFT = fDeviceProperties.useDFT();
446 #if SK_FORCE_DISTANCE_FIELD_TEXT 450 #if SK_FORCE_DISTANCE_FIELD_TEXT
447 useDFT = true; 451 useDFT = true;
448 #endif 452 #endif
449 453
450 if (!useDFT && !skPaint.isDistanceFieldTextTEMP() && scaledTextSize < kLarge DFFontSize) { 454 if (!useDFT && !skPaint.isDistanceFieldTextTEMP() && scaledTextSize < kLarge DFFontSize) {
451 return false; 455 return false;
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after
2264 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text, 2268 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat rix, text,
2265 static_cast<size_t>(textLen), 0, 0, noClip)); 2269 static_cast<size_t>(textLen), 0, 0, noClip));
2266 2270
2267 SkScalar transX = static_cast<SkScalar>(random->nextU()); 2271 SkScalar transX = static_cast<SkScalar>(random->nextU());
2268 SkScalar transY = static_cast<SkScalar>(random->nextU()); 2272 SkScalar transY = static_cast<SkScalar>(random->nextU());
2269 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun s[0].fSubRunInfo[0]; 2273 const GrAtlasTextContext::BitmapTextBlob::Run::SubRunInfo& info = blob->fRun s[0].fSubRunInfo[0];
2270 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint); 2274 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t ransY, skPaint);
2271 } 2275 }
2272 2276
2273 #endif 2277 #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