aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
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 /include
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 'include')
-rw-r--r--include/config/SkUserConfig.h2
-rw-r--r--include/core/SkFontHost.h14
-rw-r--r--include/core/SkMask.h4
-rw-r--r--include/core/SkScalerContext.h14
4 files changed, 30 insertions, 4 deletions
diff --git a/include/config/SkUserConfig.h b/include/config/SkUserConfig.h
index 2d51204573..ccdf40fe92 100644
--- a/include/config/SkUserConfig.h
+++ b/include/config/SkUserConfig.h
@@ -115,7 +115,7 @@
/* To enable additional blitters (and fontscaler code) to support separate
alpha channels for R G B channels, define SK_SUPPORT_LCDTEXT
*/
-#define SK_SUPPORT_LCDTEXT
+//#define SK_SUPPORT_LCDTEXT
/* If SK_DEBUG is defined, then you can optionally define SK_SUPPORT_UNITTEST
which will run additional self-tests at startup. These can take a long time,
diff --git a/include/core/SkFontHost.h b/include/core/SkFontHost.h
index 12f20a0e7a..752c352069 100644
--- a/include/core/SkFontHost.h
+++ b/include/core/SkFontHost.h
@@ -131,6 +131,20 @@ public:
///////////////////////////////////////////////////////////////////////////
+ /** Given a filled-out rec, the fonthost may decide to modify it to reflect
+ what the host is actually capable of fulfilling. For example, if the
+ rec is requesting a level of hinting that, for this host, maps some
+ other level (e.g. kFull -> kNormal), it should update the rec to reflect
+ what will actually be done. This is an optimization so that the font
+ cache does not contain different recs (i.e. keys) that in reality map to
+ the same output.
+
+ A lazy (but valid) fonthost can do nothing in its FilterRec routine.
+ */
+ static void FilterRec(SkScalerContext::Rec* rec);
+
+ ///////////////////////////////////////////////////////////////////////////
+
/** Return the number of tables in the font
*/
static int CountTables(SkFontID);
diff --git a/include/core/SkMask.h b/include/core/SkMask.h
index 8c041e45d1..4139d0bfc5 100644
--- a/include/core/SkMask.h
+++ b/include/core/SkMask.h
@@ -126,6 +126,10 @@ struct SkMask {
kJustRenderImage_CreateMode, //!< render into preallocate mask
kComputeBoundsAndRenderImage_CreateMode //!< compute bounds, alloc image and render into it
};
+
+ static bool FormatIsLCD(Format fm) {
+ return kHorizontalLCD_Format == fm || kVerticalLCD_Format == fm;
+ }
};
#endif
diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h
index dbe8ecb0b8..dd01bc68b7 100644
--- a/include/core/SkScalerContext.h
+++ b/include/core/SkScalerContext.h
@@ -152,8 +152,8 @@ public:
kGammaForWhite_Flag = 0x08, // illegal to set both Gamma flags
// together, these two flags resulting in a two bit value which matches
// up with the SkPaint::Hinting enum.
- kHintingBit1 = 0x10,
- kHintingBit2 = 0x20,
+ kHintingBit1_Flag = 0x10,
+ kHintingBit2_Flag = 0x20,
};
struct Rec {
uint32_t fFontID;
@@ -174,9 +174,17 @@ public:
}
void setHinting(SkPaint::Hinting hinting) {
- fFlags = (fFlags & ~(kHintingBit1 | kHintingBit2)) |
+ fFlags = (fFlags & ~(kHintingBit1_Flag | kHintingBit2_Flag)) |
(static_cast<int>(hinting) << 4);
}
+
+ SkMask::Format getFormat() const {
+ return static_cast<SkMask::Format>(fMaskFormat);
+ }
+
+ bool isLCD() const {
+ return SkMask::FormatIsLCD(this->getFormat());
+ }
};
SkScalerContext(const SkDescriptor* desc);