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

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

Issue 1880873002: Revert "Revert of Pass effects directly to fontcache (patchset #8 id:140001 of https://codereview.c… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « src/gpu/GrPathRendering.h ('k') | src/gpu/GrResourceProvider.h » ('j') | 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 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"
11 #include "SkMatrix.h" 11 #include "SkMatrix.h"
12 #include "SkTypeface.h" 12 #include "SkTypeface.h"
13 #include "GrPathRange.h" 13 #include "GrPathRange.h"
14 14
15 class GlyphGenerator : public GrPathRange::PathGenerator { 15 class GlyphGenerator : public GrPathRange::PathGenerator {
16 public: 16 public:
17 GlyphGenerator(const SkTypeface& typeface, const SkDescriptor& desc) 17 GlyphGenerator(const SkTypeface& typeface, const SkScalerContextEffects& eff ects,
18 : fScalerContext(typeface.createScalerContext(&desc)) 18 const SkDescriptor& desc)
19 : fScalerContext(typeface.createScalerContext(effects, &desc))
19 #ifdef SK_DEBUG 20 #ifdef SK_DEBUG
20 , fDesc(desc.copy()) 21 , fDesc(desc.copy())
21 #endif 22 #endif
22 {} 23 {}
23 24
24 virtual ~GlyphGenerator() { 25 virtual ~GlyphGenerator() {
25 #ifdef SK_DEBUG 26 #ifdef SK_DEBUG
26 SkDescriptor::Free(fDesc); 27 SkDescriptor::Free(fDesc);
27 #endif 28 #endif
28 } 29 }
(...skipping 15 matching lines...) Expand all
44 } 45 }
45 #endif 46 #endif
46 private: 47 private:
47 const SkAutoTDelete<SkScalerContext> fScalerContext; 48 const SkAutoTDelete<SkScalerContext> fScalerContext;
48 #ifdef SK_DEBUG 49 #ifdef SK_DEBUG
49 SkDescriptor* const fDesc; 50 SkDescriptor* const fDesc;
50 #endif 51 #endif
51 }; 52 };
52 53
53 GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface, 54 GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface,
55 const SkScalerContextEffects& effects ,
54 const SkDescriptor* desc, 56 const SkDescriptor* desc,
55 const GrStrokeInfo& stroke) { 57 const GrStrokeInfo& stroke) {
56 if (nullptr == typeface) { 58 if (nullptr == typeface) {
57 typeface = SkTypeface::GetDefaultTypeface(); 59 typeface = SkTypeface::GetDefaultTypeface();
58 SkASSERT(nullptr != typeface); 60 SkASSERT(nullptr != typeface);
59 } 61 }
60 62
61 if (desc) { 63 if (desc) {
62 SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, *de sc)); 64 SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, eff ects, *desc));
63 return this->createPathRange(generator, stroke); 65 return this->createPathRange(generator, stroke);
64 } 66 }
65 67
66 SkScalerContextRec rec; 68 SkScalerContextRec rec;
67 memset(&rec, 0, sizeof(rec)); 69 memset(&rec, 0, sizeof(rec));
68 rec.fFontID = typeface->uniqueID(); 70 rec.fFontID = typeface->uniqueID();
69 rec.fTextSize = SkPaint::kCanonicalTextSizeForPaths; 71 rec.fTextSize = SkPaint::kCanonicalTextSizeForPaths;
70 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;
71 // 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.
72 74
73 SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1)); 75 SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1));
74 SkDescriptor* genericDesc = ad.getDesc(); 76 SkDescriptor* genericDesc = ad.getDesc();
75 77
76 genericDesc->init(); 78 genericDesc->init();
77 genericDesc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); 79 genericDesc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec);
78 genericDesc->computeChecksum(); 80 genericDesc->computeChecksum();
81
82 // No effects, so we make a dummy struct
83 SkScalerContextEffects noEffects;
79 84
80 SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, *generi cDesc)); 85 SkAutoTUnref<GlyphGenerator> generator(new GlyphGenerator(*typeface, noEffec ts, *genericDesc));
81 return this->createPathRange(generator, stroke); 86 return this->createPathRange(generator, stroke);
82 } 87 }
OLDNEW
« no previous file with comments | « src/gpu/GrPathRendering.h ('k') | src/gpu/GrResourceProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698