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

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

Issue 195213003: Add compile flag to force usage of distance fields for all SkPaints. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Activate distance fields in an internal location Created 6 years, 9 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 | « gyp/common_variables.gypi ('k') | 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 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 "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 10 matching lines...) Expand all
21 #include "SkStrokeRec.h" 21 #include "SkStrokeRec.h"
22 #include "effects/GrDistanceFieldTextureEffect.h" 22 #include "effects/GrDistanceFieldTextureEffect.h"
23 23
24 static const int kGlyphCoordsAttributeIndex = 1; 24 static const int kGlyphCoordsAttributeIndex = 1;
25 25
26 static const int kBaseDFFontSize = 32; 26 static const int kBaseDFFontSize = 32;
27 27
28 SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false, 28 SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
29 "Dump the contents of the font cache before every purge."); 29 "Dump the contents of the font cache before every purge.");
30 30
31 #if SK_FORCE_DISTANCEFIELD_FONTS
32 static const bool kForceDistanceFieldFonts = true;
33 #else
34 static const bool kForceDistanceFieldFonts = false;
35 #endif
36
31 GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context, 37 GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context,
32 const SkDeviceProperties& properties) 38 const SkDeviceProperties& properties)
33 : GrTextContext(context, pro perties) { 39 : GrTextContext(context, pro perties) {
34 fStrike = NULL; 40 fStrike = NULL;
35 41
36 fCurrTexture = NULL; 42 fCurrTexture = NULL;
37 fCurrVertex = 0; 43 fCurrVertex = 0;
38 44
39 fVertices = NULL; 45 fVertices = NULL;
40 fMaxVertices = 0; 46 fMaxVertices = 0;
41 } 47 }
42 48
43 GrDistanceFieldTextContext::~GrDistanceFieldTextContext() { 49 GrDistanceFieldTextContext::~GrDistanceFieldTextContext() {
44 this->flushGlyphs(); 50 this->flushGlyphs();
45 } 51 }
46 52
47 bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint) { 53 bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint) {
48 return paint.isDistanceFieldTextTEMP() && 54 return (kForceDistanceFieldFonts || paint.isDistanceFieldTextTEMP()) &&
49 !paint.getRasterizer() && !paint.getMaskFilter() && 55 !paint.getRasterizer() && !paint.getMaskFilter() &&
50 paint.getStyle() == SkPaint::kFill_Style && 56 paint.getStyle() == SkPaint::kFill_Style &&
51 fContext->getTextTarget()->caps()->shaderDerivativeSupport() && 57 fContext->getTextTarget()->caps()->shaderDerivativeSupport() &&
52 !SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix()); 58 !SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix());
53 } 59 }
54 60
55 static inline GrColor skcolor_to_grcolor_nopremultiply(SkColor c) { 61 static inline GrColor skcolor_to_grcolor_nopremultiply(SkColor c) {
56 unsigned r = SkColorGetR(c); 62 unsigned r = SkColorGetR(c);
57 unsigned g = SkColorGetG(c); 63 unsigned g = SkColorGetG(c);
58 unsigned b = SkColorGetB(c); 64 unsigned b = SkColorGetB(c);
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 SkScalarToFixed(y) - (glyph.fAdvanceY >> a lignShift) 449 SkScalarToFixed(y) - (glyph.fAdvanceY >> a lignShift)
444 + SK_FixedHalf, //d1g.fHalfSampleY, 450 + SK_FixedHalf, //d1g.fHalfSampleY,
445 fontScaler); 451 fontScaler);
446 } 452 }
447 pos += scalarsPerPosition; 453 pos += scalarsPerPosition;
448 } 454 }
449 } 455 }
450 456
451 this->finish(); 457 this->finish();
452 } 458 }
OLDNEW
« no previous file with comments | « gyp/common_variables.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698