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

Side by Side Diff: include/core/SkFont.h

Issue 1933393002: Move SkTypeface to sk_sp. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Restore deleted Android code. 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
« no previous file with comments | « gyp/skia_for_android_framework_defines.gypi ('k') | include/core/SkPaint.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 #ifndef SkFont_DEFINED 8 #ifndef SkFont_DEFINED
9 #define SkFont_DEFINED 9 #define SkFont_DEFINED
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 kEmbolden_Flag = 1 << 6, 110 kEmbolden_Flag = 1 << 6,
111 kDevKern_Flag = 1 << 7, // ifdef ANDROID ? 111 kDevKern_Flag = 1 << 7, // ifdef ANDROID ?
112 }; 112 };
113 113
114 enum MaskType { 114 enum MaskType {
115 kBW_MaskType, 115 kBW_MaskType,
116 kA8_MaskType, 116 kA8_MaskType,
117 kLCD_MaskType, 117 kLCD_MaskType,
118 }; 118 };
119 119
120 static SkFont* Create(SkTypeface*, SkScalar size, MaskType, uint32_t flags); 120 static sk_sp<SkFont> Make(sk_sp<SkTypeface>, SkScalar size, MaskType, uint32 _t flags);
121 static SkFont* Create(SkTypeface*, SkScalar size, SkScalar scaleX, SkScalar skewX, 121 static sk_sp<SkFont> Make(sk_sp<SkTypeface>, SkScalar size, SkScalar scaleX, SkScalar skewX,
122 MaskType, uint32_t flags); 122 MaskType, uint32_t flags);
123 123
124 /** 124 /**
125 * Return a font with the same attributes of this font, but with the specif ied size. 125 * Return a font with the same attributes of this font, but with the specif ied size.
126 * If size is not supported (e.g. <= 0 or non-finite) NULL will be returned . 126 * If size is not supported (e.g. <= 0 or non-finite) NULL will be returned .
127 */ 127 */
128 SkFont* cloneWithSize(SkScalar size) const; 128 sk_sp<SkFont> makeWithSize(SkScalar size) const;
129 129
130 SkTypeface* getTypeface() const { return fTypeface; } 130 SkTypeface* getTypeface() const { return fTypeface.get(); }
131 SkScalar getSize() const { return fSize; } 131 SkScalar getSize() const { return fSize; }
132 SkScalar getScaleX() const { return fScaleX; } 132 SkScalar getScaleX() const { return fScaleX; }
133 SkScalar getSkewX() const { return fSkewX; } 133 SkScalar getSkewX() const { return fSkewX; }
134 uint32_t getFlags() const { return fFlags; } 134 uint32_t getFlags() const { return fFlags; }
135 MaskType getMaskType() const { return (MaskType)fMaskType; } 135 MaskType getMaskType() const { return (MaskType)fMaskType; }
136 136
137 bool isVertical() const { return SkToBool(fFlags & kVertical_Flag); } 137 bool isVertical() const { return SkToBool(fFlags & kVertical_Flag); }
138 bool isEmbolden() const { return SkToBool(fFlags & kEmbolden_Flag); } 138 bool isEmbolden() const { return SkToBool(fFlags & kEmbolden_Flag); }
139 bool isEnableAutoHints() const { return SkToBool(fFlags & kEnableAutoHints_F lag); } 139 bool isEnableAutoHints() const { return SkToBool(fFlags & kEnableAutoHints_F lag); }
140 bool isEnableByteCodeHints() const { return SkToBool(fFlags & kEnableByteCod eHints_Flag); } 140 bool isEnableByteCodeHints() const { return SkToBool(fFlags & kEnableByteCod eHints_Flag); }
141 bool isUseNonLinearMetrics() const { return SkToBool(fFlags & kUseNonlinearM etrics_Flag); } 141 bool isUseNonLinearMetrics() const { return SkToBool(fFlags & kUseNonlinearM etrics_Flag); }
142 142
143 int textToGlyphs(const void* text, size_t byteLength, SkTextEncoding, 143 int textToGlyphs(const void* text, size_t byteLength, SkTextEncoding,
144 uint16_t glyphs[], int maxGlyphCount) const; 144 uint16_t glyphs[], int maxGlyphCount) const;
145 145
146 SkScalar measureText(const void* text, size_t byteLength, SkTextEncoding) co nst; 146 SkScalar measureText(const void* text, size_t byteLength, SkTextEncoding) co nst;
147 147
148 static SkFont* Testing_CreateFromPaint(const SkPaint&); 148 static sk_sp<SkFont> Testing_CreateFromPaint(const SkPaint&);
149 149
150 private: 150 private:
151 enum { 151 enum {
152 kAllFlags = 0xFF, 152 kAllFlags = 0xFF,
153 }; 153 };
154 154
155 SkFont(SkTypeface*, SkScalar size, SkScalar scaleX, SkScalar skewX, MaskType , uint32_t flags); 155 SkFont(sk_sp<SkTypeface>, SkScalar size, SkScalar scaleX, SkScalar skewX, Ma skType,
156 virtual ~SkFont(); 156 uint32_t flags);
157 157
158 SkTypeface* fTypeface; 158 sk_sp<SkTypeface> fTypeface;
159 SkScalar fSize; 159 SkScalar fSize;
160 SkScalar fScaleX; 160 SkScalar fScaleX;
161 SkScalar fSkewX; 161 SkScalar fSkewX;
162 uint16_t fFlags; 162 uint16_t fFlags;
163 uint8_t fMaskType; 163 uint8_t fMaskType;
164 // uint8_t fPad; 164 // uint8_t fPad;
165 }; 165 };
166 166
167 #endif 167 #endif
OLDNEW
« no previous file with comments | « gyp/skia_for_android_framework_defines.gypi ('k') | include/core/SkPaint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698