diff options
author | 2011-08-23 21:30:47 +0000 | |
---|---|---|
committer | 2011-08-23 21:30:47 +0000 | |
commit | cb6ccdde5120ec45df208c0b958b263d8252a505 (patch) | |
tree | 5dcec7195df0e5298ceede61c2de8072c0543eea /include/core/SkScalerContext.h | |
parent | 1f221a70214fa1ab87b8a32dd66facf485f318ee (diff) |
respect subpixel positioning
git-svn-id: http://skia.googlecode.com/svn/trunk@2165 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkScalerContext.h')
-rw-r--r-- | include/core/SkScalerContext.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/core/SkScalerContext.h b/include/core/SkScalerContext.h index fe59b2a18e..e2ce537de1 100644 --- a/include/core/SkScalerContext.h +++ b/include/core/SkScalerContext.h @@ -293,5 +293,31 @@ private: #define kMaskFilter_SkDescriptorTag SkSetFourByteTag('m', 's', 'k', 'f') #define kRasterizer_SkDescriptorTag SkSetFourByteTag('r', 'a', 's', 't') +/////////////////////////////////////////////////////////////////////////////// + +enum SkAxisAlignment { + kNone_SkAxisAlignment, + kX_SkAxisAlignment, + kY_SkAxisAlignment +}; + +/** + * Return the axis (if any) that the baseline for horizontal text will land on + * after running through the specified matrix. + * + * As an example, the identity matrix will return kX_SkAxisAlignment + */ +static SkAxisAlignment SkComputeAxisAlignmentForHText(const SkMatrix& matrix) { + SkASSERT(!matrix.hasPerspective()); + + if (0 == matrix[SkMatrix::kMSkewY]) { + return kX_SkAxisAlignment; + } + if (0 == matrix[SkMatrix::kMScaleX]) { + return kY_SkAxisAlignment; + } + return kNone_SkAxisAlignment; +} + #endif |