From fb12c3e6ba84f95dc15fbaddc239dede0ba1d60e Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Thu, 5 Mar 2009 20:43:42 +0000 Subject: [PATCH] fix ref() in CreateTypeface fix comment in SkDraw.cpp git-svn-id: http://skia.googlecode.com/svn/trunk@111 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkDraw.cpp | 2 +- src/ports/SkFontHost_android.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 323438b..1d3263f 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -934,7 +934,7 @@ void SkDraw::drawBitmapAsMask(const SkBitmap& bitmap, c.concat(*fMatrix); // We can't call drawBitmap, or we'll infinitely recurse. Instead - // we mannually build a shader and draw that into our new mask + // we manually build a shader and draw that into our new mask SkPaint tmpPaint; tmpPaint.setFlags(paint.getFlags()); SkAutoBitmapShaderInstall install(bitmap, &tmpPaint); diff --git a/src/ports/SkFontHost_android.cpp b/src/ports/SkFontHost_android.cpp index 21ed0b7..67c78fb 100644 --- a/src/ports/SkFontHost_android.cpp +++ b/src/ports/SkFontHost_android.cpp @@ -564,6 +564,8 @@ SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace, tf = find_best_face(gDefaultFamily, style); } + // we ref(), since the symantic is to return a new instance + tf->ref(); return tf; } @@ -576,6 +578,8 @@ bool SkFontHost::ValidFontID(uint32_t fontID) SkStream* SkFontHost::OpenStream(uint32_t fontID) { + SkAutoMutexAcquire ac(gFamilyMutex); + FamilyTypeface* tf = (FamilyTypeface*)find_from_uniqueID(fontID); SkStream* stream = tf ? tf->openStream() : NULL; -- 2.7.4