OLD | NEW |
---|---|
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 #include "SkAdvancedTypefaceMetrics.h" | 8 #include "SkAdvancedTypefaceMetrics.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 void updateGlyphIfLCD(SkGlyph* glyph); | 226 void updateGlyphIfLCD(SkGlyph* glyph); |
227 // Caller must lock gFTMutex before calling this function. | 227 // Caller must lock gFTMutex before calling this function. |
228 // update FreeType2 glyph slot with glyph emboldened | 228 // update FreeType2 glyph slot with glyph emboldened |
229 void emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph); | 229 void emboldenIfNeeded(FT_Face face, FT_GlyphSlot glyph); |
230 }; | 230 }; |
231 | 231 |
232 /////////////////////////////////////////////////////////////////////////// | 232 /////////////////////////////////////////////////////////////////////////// |
233 /////////////////////////////////////////////////////////////////////////// | 233 /////////////////////////////////////////////////////////////////////////// |
234 | 234 |
235 struct SkFaceRec { | 235 struct SkFaceRec { |
236 SkFaceRec* fNext; | 236 SkFaceRec* fNext; |
237 FT_Face fFace; | 237 FT_Face fFace; |
238 FT_StreamRec fFTStream; | 238 FT_StreamRec fFTStream; |
239 SkStream* fSkStream; | 239 SkAutoTDelete<SkStream> fSkStream; |
240 uint32_t fRefCnt; | 240 uint32_t fRefCnt; |
241 uint32_t fFontID; | 241 uint32_t fFontID; |
242 | 242 |
243 // assumes ownership of the stream, will call unref() when its done | 243 // assumes ownership of the stream, will call unref() when its done |
bungeman-skia
2015/01/15 22:44:55
Comment, 'will delete when its done'.
scroggo
2015/01/16 19:13:37
Done.
| |
244 SkFaceRec(SkStream* strm, uint32_t fontID); | 244 SkFaceRec(SkStream* strm, uint32_t fontID); |
245 ~SkFaceRec() { | |
246 fSkStream->unref(); | |
247 } | |
248 }; | 245 }; |
249 | 246 |
250 extern "C" { | 247 extern "C" { |
251 static unsigned long sk_ft_stream_io(FT_Stream stream, | 248 static unsigned long sk_ft_stream_io(FT_Stream stream, |
252 unsigned long offset, | 249 unsigned long offset, |
253 unsigned char* buffer, | 250 unsigned char* buffer, |
254 unsigned long count) | 251 unsigned long count) |
255 { | 252 { |
256 SkStream* str = (SkStream*)stream->descriptor.pointer; | 253 SkStream* str = (SkStream*)stream->descriptor.pointer; |
257 | 254 |
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1717 if (style) { | 1714 if (style) { |
1718 *style = SkFontStyle(weight, width, slant); | 1715 *style = SkFontStyle(weight, width, slant); |
1719 } | 1716 } |
1720 if (isFixedPitch) { | 1717 if (isFixedPitch) { |
1721 *isFixedPitch = FT_IS_FIXED_WIDTH(face); | 1718 *isFixedPitch = FT_IS_FIXED_WIDTH(face); |
1722 } | 1719 } |
1723 | 1720 |
1724 FT_Done_Face(face); | 1721 FT_Done_Face(face); |
1725 return true; | 1722 return true; |
1726 } | 1723 } |
OLD | NEW |