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

Side by Side Diff: src/core/SkScalerContext.h

Issue 12593013: remove SkFontHost::CreateScalerContext (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkTypeface.h ('k') | src/core/SkScalerContext.cpp » ('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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #ifndef SkScalerContext_DEFINED 8 #ifndef SkScalerContext_DEFINED
9 #define SkScalerContext_DEFINED 9 #define SkScalerContext_DEFINED
10 10
11 #include "SkMask.h" 11 #include "SkMask.h"
12 #include "SkMaskGamma.h" 12 #include "SkMaskGamma.h"
13 #include "SkMatrix.h" 13 #include "SkMatrix.h"
14 #include "SkPaint.h" 14 #include "SkPaint.h"
15 15 #include "SkTypeface.h"
16 #ifdef SK_BUILD_FOR_ANDROID
17 //For SkFontID
18 #include "SkTypeface.h"
19 #endif
20 16
21 struct SkGlyph; 17 struct SkGlyph;
22 class SkDescriptor; 18 class SkDescriptor;
23 class SkMaskFilter; 19 class SkMaskFilter;
24 class SkPathEffect; 20 class SkPathEffect;
25 class SkRasterizer; 21 class SkRasterizer;
26 22
27 /* 23 /*
28 * To allow this to be forward-declared, it must be its own typename, rather 24 * To allow this to be forward-declared, it must be its own typename, rather
29 * than a nested struct inside SkScalerContext (where it started). 25 * than a nested struct inside SkScalerContext (where it started).
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // Perhaps we can store this (instead) in fMaskFormat, in hight bit? 138 // Perhaps we can store this (instead) in fMaskFormat, in hight bit?
143 kGenA8FromLCD_Flag = 0x0800, 139 kGenA8FromLCD_Flag = 0x0800,
144 }; 140 };
145 141
146 // computed values 142 // computed values
147 enum { 143 enum {
148 kHinting_Mask = kHintingBit1_Flag | kHintingBit2_Flag, 144 kHinting_Mask = kHintingBit1_Flag | kHintingBit2_Flag,
149 }; 145 };
150 146
151 147
152 SkScalerContext(const SkDescriptor* desc); 148 SkScalerContext(SkTypeface*, const SkDescriptor*);
153 virtual ~SkScalerContext(); 149 virtual ~SkScalerContext();
154 150
151 SkTypeface* getTypeface() const { return fTypeface.get(); }
152
155 SkMask::Format getMaskFormat() const { 153 SkMask::Format getMaskFormat() const {
156 return (SkMask::Format)fRec.fMaskFormat; 154 return (SkMask::Format)fRec.fMaskFormat;
157 } 155 }
158 156
159 bool isSubpixel() const { 157 bool isSubpixel() const {
160 return SkToBool(fRec.fFlags & kSubpixelPositioning_Flag); 158 return SkToBool(fRec.fFlags & kSubpixelPositioning_Flag);
161 } 159 }
162 160
163 // remember our glyph offset/base 161 // remember our glyph offset/base
164 void setBaseGlyphCount(unsigned baseGlyphCount) { 162 void setBaseGlyphCount(unsigned baseGlyphCount) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 virtual void generateImage(const SkGlyph&) = 0; 208 virtual void generateImage(const SkGlyph&) = 0;
211 virtual void generatePath(const SkGlyph&, SkPath*) = 0; 209 virtual void generatePath(const SkGlyph&, SkPath*) = 0;
212 virtual void generateFontMetrics(SkPaint::FontMetrics* mX, 210 virtual void generateFontMetrics(SkPaint::FontMetrics* mX,
213 SkPaint::FontMetrics* mY) = 0; 211 SkPaint::FontMetrics* mY) = 0;
214 // default impl returns 0, indicating failure. 212 // default impl returns 0, indicating failure.
215 virtual SkUnichar generateGlyphToChar(uint16_t); 213 virtual SkUnichar generateGlyphToChar(uint16_t);
216 214
217 void forceGenerateImageFromPath() { fGenerateImageFromPath = true; } 215 void forceGenerateImageFromPath() { fGenerateImageFromPath = true; }
218 216
219 private: 217 private:
218 // never null
219 SkAutoTUnref<SkTypeface> fTypeface;
220
221 // optional object, which may be null
220 SkPathEffect* fPathEffect; 222 SkPathEffect* fPathEffect;
221 SkMaskFilter* fMaskFilter; 223 SkMaskFilter* fMaskFilter;
222 SkRasterizer* fRasterizer; 224 SkRasterizer* fRasterizer;
223 225
224 // if this is set, we draw the image from a path, rather than 226 // if this is set, we draw the image from a path, rather than
225 // calling generateImage. 227 // calling generateImage.
226 bool fGenerateImageFromPath; 228 bool fGenerateImageFromPath;
227 229
228 void internalGetPath(const SkGlyph& glyph, SkPath* fillPath, 230 void internalGetPath(const SkGlyph& glyph, SkPath* fillPath,
229 SkPath* devPath, SkMatrix* fillToDevMatrix); 231 SkPath* devPath, SkMatrix* fillToDevMatrix);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 return static_cast<SkPaint::Hinting>(hint); 284 return static_cast<SkPaint::Hinting>(hint);
283 } 285 }
284 286
285 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) { 287 void SkScalerContextRec::setHinting(SkPaint::Hinting hinting) {
286 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) | 288 fFlags = (fFlags & ~SkScalerContext::kHinting_Mask) |
287 (hinting << SkScalerContext::kHinting_Shift); 289 (hinting << SkScalerContext::kHinting_Shift);
288 } 290 }
289 291
290 292
291 #endif 293 #endif
OLDNEW
« no previous file with comments | « include/core/SkTypeface.h ('k') | src/core/SkScalerContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698