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/fonts/SkRandomScalerContext.cpp

Issue 1872253004: Revert of Pass effects directly to fontcache (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/fonts/SkRandomScalerContext.h ('k') | src/fonts/SkTestScalerContext.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 2015 Google Inc. 2 * Copyright 2015 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 "SkRandomScalerContext.h" 8 #include "SkRandomScalerContext.h"
9 #include "SkGlyph.h" 9 #include "SkGlyph.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkRasterizer.h" 12 #include "SkRasterizer.h"
13 13
14 class SkRandomScalerContext : public SkScalerContext { 14 class SkRandomScalerContext : public SkScalerContext {
15 public: 15 public:
16 SkRandomScalerContext(SkRandomTypeface*, const SkScalerContextEffects&, 16 SkRandomScalerContext(SkRandomTypeface*, const SkDescriptor*, bool fFakeIt);
17 const SkDescriptor*, bool fFakeIt);
18 virtual ~SkRandomScalerContext(); 17 virtual ~SkRandomScalerContext();
19 18
20 protected: 19 protected:
21 unsigned generateGlyphCount() override; 20 unsigned generateGlyphCount() override;
22 uint16_t generateCharToGlyph(SkUnichar) override; 21 uint16_t generateCharToGlyph(SkUnichar) override;
23 void generateAdvance(SkGlyph*) override; 22 void generateAdvance(SkGlyph*) override;
24 void generateMetrics(SkGlyph*) override; 23 void generateMetrics(SkGlyph*) override;
25 void generateImage(const SkGlyph&) override; 24 void generateImage(const SkGlyph&) override;
26 void generatePath(const SkGlyph&, SkPath*) override; 25 void generatePath(const SkGlyph&, SkPath*) override;
27 void generateFontMetrics(SkPaint::FontMetrics*) override; 26 void generateFontMetrics(SkPaint::FontMetrics*) override;
28 27
29 private: 28 private:
30 SkRandomTypeface* fFace; 29 SkRandomTypeface* fFace;
31 SkScalerContext* fProxy; 30 SkScalerContext* fProxy;
32 bool fFakeIt; 31 bool fFakeIt;
33 }; 32 };
34 33
35 #define STD_SIZE 1 34 #define STD_SIZE 1
36 35
37 #include "SkDescriptor.h" 36 #include "SkDescriptor.h"
38 37
39 SkRandomScalerContext::SkRandomScalerContext(SkRandomTypeface* face, 38 SkRandomScalerContext::SkRandomScalerContext(SkRandomTypeface* face, const SkDes criptor* desc,
40 const SkScalerContextEffects& effec ts,
41 const SkDescriptor* desc,
42 bool fakeIt) 39 bool fakeIt)
43 : SkScalerContext(face, effects, desc) 40 : SkScalerContext(face, desc)
44 , fFace(face) 41 , fFace(face)
45 , fFakeIt(fakeIt) { 42 , fFakeIt(fakeIt) {
46 fProxy = face->proxy()->createScalerContext(effects, desc); 43 fProxy = face->proxy()->createScalerContext(desc);
47 } 44 }
48 45
49 SkRandomScalerContext::~SkRandomScalerContext() { delete fProxy; } 46 SkRandomScalerContext::~SkRandomScalerContext() { delete fProxy; }
50 47
51 unsigned SkRandomScalerContext::generateGlyphCount() { 48 unsigned SkRandomScalerContext::generateGlyphCount() {
52 return fProxy->getGlyphCount(); 49 return fProxy->getGlyphCount();
53 } 50 }
54 51
55 uint16_t SkRandomScalerContext::generateCharToGlyph(SkUnichar uni) { 52 uint16_t SkRandomScalerContext::generateCharToGlyph(SkUnichar uni) {
56 return fProxy->charToGlyphID(uni); 53 return fProxy->charToGlyphID(uni);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 SkRandomTypeface::SkRandomTypeface(SkTypeface* proxy, const SkPaint& paint, bool fakeIt) 190 SkRandomTypeface::SkRandomTypeface(SkTypeface* proxy, const SkPaint& paint, bool fakeIt)
194 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false) 191 : SkTypeface(proxy->fontStyle(), SkTypefaceCache::NewFontID(), false)
195 , fProxy(SkRef(proxy)) 192 , fProxy(SkRef(proxy))
196 , fPaint(paint) 193 , fPaint(paint)
197 , fFakeIt(fakeIt) {} 194 , fFakeIt(fakeIt) {}
198 195
199 SkRandomTypeface::~SkRandomTypeface() { 196 SkRandomTypeface::~SkRandomTypeface() {
200 fProxy->unref(); 197 fProxy->unref();
201 } 198 }
202 199
203 SkScalerContext* SkRandomTypeface::onCreateScalerContext(const SkScalerContextEf fects& effects, 200 SkScalerContext* SkRandomTypeface::onCreateScalerContext(
204 const SkDescriptor* des c) const { 201 const SkDescriptor* desc) const {
205 return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), effect s, desc, fFakeIt); 202 return new SkRandomScalerContext(const_cast<SkRandomTypeface*>(this), desc, fFakeIt);
206 } 203 }
207 204
208 void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const { 205 void SkRandomTypeface::onFilterRec(SkScalerContextRec* rec) const {
209 fProxy->filterRec(rec); 206 fProxy->filterRec(rec);
210 rec->setHinting(SkPaint::kNo_Hinting); 207 rec->setHinting(SkPaint::kNo_Hinting);
211 rec->fMaskFormat = SkMask::kARGB32_Format; 208 rec->fMaskFormat = SkMask::kARGB32_Format;
212 } 209 }
213 210
214 SkAdvancedTypefaceMetrics* SkRandomTypeface::onGetAdvancedTypefaceMetrics( 211 SkAdvancedTypefaceMetrics* SkRandomTypeface::onGetAdvancedTypefaceMetrics(
215 PerGlyphInfo info, 212 PerGlyphInfo info,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 247
251 int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const { 248 int SkRandomTypeface::onGetTableTags(SkFontTableTag tags[]) const {
252 return fProxy->getTableTags(tags); 249 return fProxy->getTableTags(tags);
253 } 250 }
254 251
255 size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag, size_t offset, 252 size_t SkRandomTypeface::onGetTableData(SkFontTableTag tag, size_t offset,
256 size_t length, void* data) const { 253 size_t length, void* data) const {
257 return fProxy->getTableData(tag, offset, length, data); 254 return fProxy->getTableData(tag, offset, length, data);
258 } 255 }
259 256
OLDNEW
« no previous file with comments | « src/fonts/SkRandomScalerContext.h ('k') | src/fonts/SkTestScalerContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698