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

Side by Side Diff: src/ports/SkFontHost_FreeType.cpp

Issue 849103004: Make SkStream *not* ref counted. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase, just in case. 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/ports/SkFontConfigTypeface.h ('k') | src/ports/SkFontHost_fontconfig.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 #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
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 delete when its 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
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 }
OLDNEW
« no previous file with comments | « src/ports/SkFontConfigTypeface.h ('k') | src/ports/SkFontHost_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698