aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/core/SkScalerContext.h2
-rw-r--r--src/core/SkPaint.cpp18
2 files changed, 20 insertions, 0 deletions
diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h
index e4a28b9076..29679d67c7 100644
--- a/include/core/SkScalerContext.h
+++ b/include/core/SkScalerContext.h
@@ -303,6 +303,8 @@ public:
#endif
static inline void MakeRec(const SkPaint&, const SkMatrix*, Rec* rec);
+ static inline void PostMakeRec(Rec*);
+
static SkScalerContext* Create(const SkDescriptor*);
protected:
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 52d771e8e3..47743bd239 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1509,6 +1509,19 @@ void SkScalerContext::MakeRec(const SkPaint& paint,
*/
SkFontHost::FilterRec(rec);
+ // be sure to call PostMakeRec(rec) before you actually use it!
+}
+
+/**
+ * We ensure that the rec is self-consistent and efficient (where possible)
+ */
+void SkScalerContext::PostMakeRec(SkScalerContext::Rec* rec) {
+
+ /**
+ * If we're asking for A8, we force the colorlum to be gray, since that
+ * that limits the number of unique entries, and the scaler will only
+ * look at the lum of one of them.
+ */
switch (rec->fMaskFormat) {
case SkMask::kLCD16_Format:
case SkMask::kLCD32_Format: {
@@ -1600,6 +1613,11 @@ void SkPaint::descriptorProc(const SkMatrix* deviceMatrix,
entryCount += 1;
rec.fMaskFormat = SkMask::kA8_Format; // force antialiasing when we do the scan conversion
}
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Now that we're done tweaking the rec, call the PostMakeRec cleanup
+ SkScalerContext::PostMakeRec(&rec);
+
descSize += SkDescriptor::ComputeOverhead(entryCount);
SkAutoDescriptor ad(descSize);