aboutsummaryrefslogtreecommitdiffstats
path: root/include/core/SkScalerContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/core/SkScalerContext.h')
-rw-r--r--include/core/SkScalerContext.h40
1 files changed, 34 insertions, 6 deletions
diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h
index e7dd7d4..29679d6 100644
--- a/include/core/SkScalerContext.h
+++ b/include/core/SkScalerContext.h
@@ -16,6 +16,8 @@
#include "SkPath.h"
#include "SkPoint.h"
+//#define SK_USE_COLOR_LUMINANCE
+
class SkDescriptor;
class SkMaskFilter;
class SkPathEffect;
@@ -175,16 +177,27 @@ public:
kLCD_Vertical_Flag = 0x0200, // else Horizontal
kLCD_BGROrder_Flag = 0x0400, // else RGB order
+ // Generate A8 from LCD source (for GDI), only meaningful if fMaskFormat is kA8
+ // Perhaps we can store this (instead) in fMaskFormat, in hight bit?
+ kGenA8FromLCD_Flag = 0x0800,
+
+#ifdef SK_USE_COLOR_LUMINANCE
+ kLuminance_Bits = 3,
+#else
// luminance : 0 for black text, kLuminance_Max for white text
- kLuminance_Shift = 11, // to shift into the other flags above
+ kLuminance_Shift = 13, // shift to land in the high 3-bits of Flags
kLuminance_Bits = 3, // ensure Flags doesn't exceed 16bits
+#endif
};
// computed values
enum {
kHinting_Mask = kHintingBit1_Flag | kHintingBit2_Flag,
+#ifdef SK_USE_COLOR_LUMINANCE
+#else
kLuminance_Max = (1 << kLuminance_Bits) - 1,
kLuminance_Mask = kLuminance_Max << kLuminance_Shift,
+#endif
};
struct Rec {
@@ -193,6 +206,9 @@ public:
SkScalar fTextSize, fPreScaleX, fPreSkewX;
SkScalar fPost2x2[2][2];
SkScalar fFrameWidth, fMiterLimit;
+#ifdef SK_USE_COLOR_LUMINANCE
+ uint32_t fLumBits;
+#endif
uint8_t fMaskFormat;
uint8_t fStrokeJoin;
uint16_t fFlags;
@@ -213,7 +229,20 @@ public:
void setHinting(SkPaint::Hinting hinting) {
fFlags = (fFlags & ~kHinting_Mask) | (hinting << kHinting_Shift);
}
-
+
+ SkMask::Format getFormat() const {
+ return static_cast<SkMask::Format>(fMaskFormat);
+ }
+
+#ifdef SK_USE_COLOR_LUMINANCE
+ SkColor getLuminanceColor() const {
+ return fLumBits;
+ }
+
+ void setLuminanceColor(SkColor c) {
+ fLumBits = c;
+ }
+#else
unsigned getLuminanceBits() const {
return (fFlags & kLuminance_Mask) >> kLuminance_Shift;
}
@@ -230,10 +259,7 @@ public:
lum |= (lum << kLuminance_Bits*2);
return lum >> (4*kLuminance_Bits - 8);
}
-
- SkMask::Format getFormat() const {
- return static_cast<SkMask::Format>(fMaskFormat);
- }
+#endif
};
SkScalerContext(const SkDescriptor* desc);
@@ -277,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: