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

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

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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/GrOvalRenderer.cpp ('k') | src/gpu/GrRectanizer_pow2.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 SkDescriptor& desc)
18 : fDesc(desc.copy()), 18 : fDesc(desc.copy()),
19 fScalerContext(typeface.createScalerContext(fDesc)) { 19 fScalerContext(typeface.createScalerContext(fDesc)) {
20 fFlipMatrix.setScale(1, -1); 20 fFlipMatrix.setScale(1, -1);
21 } 21 }
22 22
23 virtual ~GlyphGenerator() { 23 virtual ~GlyphGenerator() {
24 SkDescriptor::Free(fDesc); 24 SkDescriptor::Free(fDesc);
25 } 25 }
26 26
27 virtual int getNumPaths() SK_OVERRIDE { 27 int getNumPaths() SK_OVERRIDE {
28 return fScalerContext->getGlyphCount(); 28 return fScalerContext->getGlyphCount();
29 } 29 }
30 30
31 virtual void generatePath(int glyphID, SkPath* out) SK_OVERRIDE { 31 void generatePath(int glyphID, SkPath* out) SK_OVERRIDE {
32 SkGlyph skGlyph; 32 SkGlyph skGlyph;
33 skGlyph.init(SkGlyph::MakeID(glyphID)); 33 skGlyph.init(SkGlyph::MakeID(glyphID));
34 fScalerContext->getMetrics(&skGlyph); 34 fScalerContext->getMetrics(&skGlyph);
35 35
36 fScalerContext->getPath(skGlyph, out); 36 fScalerContext->getPath(skGlyph, out);
37 out->transform(fFlipMatrix); // Load glyphs with the inverted y-directio n. 37 out->transform(fFlipMatrix); // Load glyphs with the inverted y-directio n.
38 } 38 }
39 39
40 virtual bool isEqualTo(const SkDescriptor& desc) const SK_OVERRIDE { 40 bool isEqualTo(const SkDescriptor& desc) const SK_OVERRIDE {
41 return fDesc->equals(desc); 41 return fDesc->equals(desc);
42 } 42 }
43 43
44 private: 44 private:
45 SkDescriptor* const fDesc; 45 SkDescriptor* const fDesc;
46 const SkAutoTDelete<SkScalerContext> fScalerContext; 46 const SkAutoTDelete<SkScalerContext> fScalerContext;
47 SkMatrix fFlipMatrix; 47 SkMatrix fFlipMatrix;
48 }; 48 };
49 49
50 GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface, 50 GrPathRange* GrPathRendering::createGlyphs(const SkTypeface* typeface,
(...skipping 19 matching lines...) Expand all
70 SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1)); 70 SkAutoDescriptor ad(sizeof(rec) + SkDescriptor::ComputeOverhead(1));
71 SkDescriptor* genericDesc = ad.getDesc(); 71 SkDescriptor* genericDesc = ad.getDesc();
72 72
73 genericDesc->init(); 73 genericDesc->init();
74 genericDesc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec); 74 genericDesc->addEntry(kRec_SkDescriptorTag, sizeof(rec), &rec);
75 genericDesc->computeChecksum(); 75 genericDesc->computeChecksum();
76 76
77 SkAutoTUnref<GlyphGenerator> generator(SkNEW_ARGS(GlyphGenerator, (*typeface , *genericDesc))); 77 SkAutoTUnref<GlyphGenerator> generator(SkNEW_ARGS(GlyphGenerator, (*typeface , *genericDesc)));
78 return this->createPathRange(generator, stroke); 78 return this->createPathRange(generator, stroke);
79 } 79 }
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/GrRectanizer_pow2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698