Significant cleanup in api, and more importantly in sementics, of SkFontHost
- FindTypeface is now CreateTypeface, and what it returns is always considered
a new instance, even if it is from a cache (in which case it will have been
ref()'d. The caller must always balance its ownership by calling unref() on
the result when they are done.
- CloseStream is gone, since the caller can/must call stream->unref() when they
are done using it.
- ResolveTypeface is now ValidFontID, and just returns a bool.
git-svn-id: http://skia.googlecode.com/svn/trunk@109 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 742a861..a241e38 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -102,9 +102,10 @@
uint32_t fRefCnt;
uint32_t fFontID;
+ // assumes ownership of the stream, will call unref() when its done
SkFaceRec(SkStream* strm, uint32_t fontID);
~SkFaceRec() {
- SkFontHost::CloseStream(fFontID, fSkStream);
+ fSkStream->unref();
}
};
@@ -387,7 +388,7 @@
killing all of the contexts when we know that a given fontID is going
away...
*/
- if (SkFontHost::ResolveTypeface(fRec.fFontID) == NULL) {
+ if (!SkFontHost::ValidFontID(fRec.fFontID)) {
return (FT_Error)-1;
}