aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-07-22 19:52:11 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-07-22 19:52:11 +0000
commit36a4c2aa2dc2363dc093089b732346459ddc3b65 (patch)
treec1b1a899f1e696fdcfad31f00521a4eee5a91961 /src/core
parentf549369fcd9f203dc8020b5b15ee49330058782a (diff)
Add SkFontHost::FilterRect() which allows the font host to filter our request
before we turn it into a font-cache entry, for the cases where the scaler will ignore and/or collapse certain feature requests (e.g. doesn't support all levels of hinting) git-svn-id: http://skia.googlecode.com/svn/trunk@283 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkPaint.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index b136733779..cb78734027 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1137,9 +1137,11 @@ static SkMask::Format computeMaskFormat(const SkPaint& paint)
return SkMask::kBW_Format;
}
-void SkScalerContext::MakeRec(const SkPaint& paint, const SkMatrix* deviceMatrix, Rec* rec)
+void SkScalerContext::MakeRec(const SkPaint& paint,
+ const SkMatrix* deviceMatrix, Rec* rec)
{
- SkASSERT(deviceMatrix == NULL || (deviceMatrix->getType() & SkMatrix::kPerspective_Mask) == 0);
+ SkASSERT(deviceMatrix == NULL ||
+ (deviceMatrix->getType() & SkMatrix::kPerspective_Mask) == 0);
rec->fFontID = SkTypeface::UniqueID(paint.getTypeface());
rec->fTextSize = paint.getTextSize();
@@ -1201,6 +1203,13 @@ void SkScalerContext::MakeRec(const SkPaint& paint, const SkMatrix* deviceMatrix
rec->fMaskFormat = SkToU8(computeMaskFormat(paint));
rec->fFlags = SkToU8(flags);
rec->setHinting(paint.getHinting());
+
+ /* Allow the fonthost to modify our rec before we use it as a key into the
+ cache. This way if we're asking for something that they will ignore,
+ they can modify our rec up front, so we don't create duplicate cache
+ entries.
+ */
+ SkFontHost::FilterRec(rec);
}
#define MIN_SIZE_FOR_EFFECT_BUFFER 1024