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

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

Issue 703463002: Improve quality of distance field rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Ignore GMs Created 6 years, 1 month 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
OLDNEW
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 "GrDistanceFieldTextContext.h" 8 #include "GrDistanceFieldTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrBitmapTextContext.h" 10 #include "GrBitmapTextContext.h"
(...skipping 16 matching lines...) Expand all
27 #include "SkPath.h" 27 #include "SkPath.h"
28 #include "SkRTConf.h" 28 #include "SkRTConf.h"
29 #include "SkStrokeRec.h" 29 #include "SkStrokeRec.h"
30 #include "effects/GrDistanceFieldTextureEffect.h" 30 #include "effects/GrDistanceFieldTextureEffect.h"
31 31
32 SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false, 32 SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
33 "Dump the contents of the font cache before every purge."); 33 "Dump the contents of the font cache before every purge.");
34 34
35 static const int kSmallDFFontSize = 32; 35 static const int kSmallDFFontSize = 32;
36 static const int kSmallDFFontLimit = 32; 36 static const int kSmallDFFontLimit = 32;
37 static const int kMediumDFFontSize = 64; 37 static const int kMediumDFFontSize = 78;
38 static const int kMediumDFFontLimit = 64; 38 static const int kMediumDFFontLimit = 78;
39 static const int kLargeDFFontSize = 128; 39 static const int kLargeDFFontSize = 192;
40 40
41 namespace { 41 namespace {
42 // position + texture coord 42 // position + texture coord
43 extern const GrVertexAttrib gTextVertexAttribs[] = { 43 extern const GrVertexAttrib gTextVertexAttribs[] = {
44 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBindin g}, 44 {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBindin g},
45 {kVec2f_GrVertexAttribType, sizeof(SkPoint) , kGeometryProcessor_GrVertexAtt ribBinding} 45 {kVec2f_GrVertexAttribType, sizeof(SkPoint) , kGeometryProcessor_GrVertexAtt ribBinding}
46 }; 46 };
47 47
48 static const size_t kTextVASize = 2 * sizeof(SkPoint); 48 static const size_t kTextVASize = 2 * sizeof(SkPoint);
49 49
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 fVertices = NULL; 148 fVertices = NULL;
149 fCurrVertex = 0; 149 fCurrVertex = 0;
150 fAllocVertexCount = 0; 150 fAllocVertexCount = 0;
151 fTotalVertexCount = 0; 151 fTotalVertexCount = 0;
152 152
153 if (scaledTextSize <= kSmallDFFontLimit) { 153 if (scaledTextSize <= kSmallDFFontLimit) {
154 fTextRatio = textSize / kSmallDFFontSize; 154 fTextRatio = textSize / kSmallDFFontSize;
155 fSkPaint.setTextSize(SkIntToScalar(kSmallDFFontSize)); 155 fSkPaint.setTextSize(SkIntToScalar(kSmallDFFontSize));
156 #if DEBUG_TEXT_SIZE
bsalomon 2014/11/03 21:45:23 cool!
157 fSkPaint.setColor(SkColorSetARGB(0xFF, 0x00, 0x00, 0xFF));
158 fPaint.setColor(GrColorPackRGBA(0x00, 0x00, 0xFF, 0xFF));
159 #endif
156 } else if (scaledTextSize <= kMediumDFFontLimit) { 160 } else if (scaledTextSize <= kMediumDFFontLimit) {
157 fTextRatio = textSize / kMediumDFFontSize; 161 fTextRatio = textSize / kMediumDFFontSize;
158 fSkPaint.setTextSize(SkIntToScalar(kMediumDFFontSize)); 162 fSkPaint.setTextSize(SkIntToScalar(kMediumDFFontSize));
163 #if DEBUG_TEXT_SIZE
164 fSkPaint.setColor(SkColorSetARGB(0xFF, 0x00, 0xFF, 0x00));
165 fPaint.setColor(GrColorPackRGBA(0x00, 0xFF, 0x00, 0xFF));
166 #endif
159 } else { 167 } else {
160 fTextRatio = textSize / kLargeDFFontSize; 168 fTextRatio = textSize / kLargeDFFontSize;
161 fSkPaint.setTextSize(SkIntToScalar(kLargeDFFontSize)); 169 fSkPaint.setTextSize(SkIntToScalar(kLargeDFFontSize));
170 #if DEBUG_TEXT_SIZE
171 fSkPaint.setColor(SkColorSetARGB(0xFF, 0xFF, 0x00, 0x00));
172 fPaint.setColor(GrColorPackRGBA(0xFF, 0x00, 0x00, 0xFF));
173 #endif
162 } 174 }
163 175
164 fUseLCDText = fSkPaint.isLCDRenderText(); 176 fUseLCDText = fSkPaint.isLCDRenderText();
165 177
166 fSkPaint.setLCDRenderText(false); 178 fSkPaint.setLCDRenderText(false);
167 fSkPaint.setAutohinted(false); 179 fSkPaint.setAutohinted(false);
168 fSkPaint.setHinting(SkPaint::kNormal_Hinting); 180 fSkPaint.setHinting(SkPaint::kNormal_Hinting);
169 fSkPaint.setSubpixelText(true); 181 fSkPaint.setSubpixelText(true);
170 } 182 }
171 183
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 } 689 }
678 } 690 }
679 691
680 inline void GrDistanceFieldTextContext::finish() { 692 inline void GrDistanceFieldTextContext::finish() {
681 this->flush(); 693 this->flush();
682 fTotalVertexCount = 0; 694 fTotalVertexCount = 0;
683 695
684 GrTextContext::finish(); 696 GrTextContext::finish();
685 } 697 }
686 698
OLDNEW
« no previous file with comments | « src/gpu/GrAADistanceFieldPathRenderer.cpp ('k') | src/gpu/effects/GrDistanceFieldTextureEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698