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

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

Issue 1957363002: Replace GrStrokeInfo with GrStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@resscale
Patch Set: Fix issue where hairlines were going to MSAAPathRenderer Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "GrPathRendering.h" 8 #include "GrPathRendering.h"
9 #include "SkDescriptor.h" 9 #include "SkDescriptor.h"
10 #include "SkGlyph.h" 10 #include "SkGlyph.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 private: 47 private:
48 const SkAutoTDelete<SkScalerContext> fScalerContext; 48 const SkAutoTDelete<SkScalerContext> fScalerContext;
49 #ifdef SK_DEBUG 49 #ifdef SK_DEBUG
50 SkDescriptor* const fDesc; 50 SkDescriptor* const fDesc;
51 #endif 51 #endif
52 }; 52 };
53 53
54 GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface, 54 GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface,
55 const SkScalerContextEffects& effects , 55 const SkScalerContextEffects& effects ,
56 const SkDescriptor* desc, 56 const SkDescriptor* desc,
57 const GrStrokeInfo& stroke) { 57 const GrStyle& style) {
58 if (nullptr == typeface) { 58 if (nullptr == typeface) {
59 typeface = SkTypeface::GetDefaultTypeface(); 59 typeface = SkTypeface::GetDefaultTypeface();
60 SkASSERT(nullptr != typeface); 60 SkASSERT(nullptr != typeface);
61 } 61 }
62 62
63 if (desc) { 63 if (desc) {
64 SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, eff ects, *desc)); 64 SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, eff ects, *desc));
65 return this->createPathRange(generator, stroke); 65 return this->createPathRange(generator, style);
66 } 66 }
67 67
68 SkScalerContextRec rec; 68 SkScalerContextRec rec;
69 memset(&rec, 0, sizeof(rec)); 69 memset(&rec, 0, sizeof(rec));
70 rec.fFontID = typeface->uniqueID(); 70 rec.fFontID = typeface->uniqueID();
71 rec.fTextSize = SkPaint::kCanonicalTextSizeForPaths; 71 rec.fTextSize = SkPaint::kCanonicalTextSizeForPaths;
72 rec.fPreScaleX = rec.fPost2x2[0][0] = rec.fPost2x2[1][1] = SK_Scalar1; 72 rec.fPreScaleX = rec.fPost2x2[0][0] = rec.fPost2x2[1][1] = SK_Scalar1;
73 // Don't bake stroke information into the glyphs, we'll let the GPU do the s troking. 73 // Don't bake stroke information into the glyphs, we'll let the GPU do the s troking.
74 74
75 SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1)); 75 SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1));
76 SkDescriptor* genericDesc = ad.getDesc(); 76 SkDescriptor* genericDesc = ad.getDesc();
77 77
78 genericDesc->init(); 78 genericDesc->init();
79 genericDesc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); 79 genericDesc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec);
80 genericDesc->computeChecksum(); 80 genericDesc->computeChecksum();
81 81
82 // No effects, so we make a dummy struct 82 // No effects, so we make a dummy struct
83 SkScalerContextEffects noEffects; 83 SkScalerContextEffects noEffects;
84 84
85 SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, noEffec ts, *genericDesc)); 85 SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, noEffec ts, *genericDesc));
86 return this->createPathRange(generator, stroke); 86 return this->createPathRange(generator, style);
87 } 87 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698