aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkScalerContext.h
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2016-02-29 11:22:55 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-29 11:22:55 -0800
commit27876bc1156bcdd15cac7f0fe6228eb7806b8e96 (patch)
treedc5617a6be3255ce9eced721e9c3004dc8f58bcf /src/core/SkScalerContext.h
parent10d8fc29bc1605c134e98f5b58c2efb73cef6073 (diff)
Improve horizontal baseline detection.
The goal is to hint the baseline when hinting is possible, which is to say when the glyphs are be aligned with the pixel grid. The current code has three shortcomings. 1. correctly snaps when the horizontal baseline is on the x-axis but not when on the y-axis. Instead it is snapping the horizontal baseline when there is y-skew. 2. tests against the full device matrix instead of the relaxed matrix used by the scaler context. 3. has range issues when relaxing the matrix. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1740163002 Review URL: https://codereview.chromium.org/1740163002
Diffstat (limited to 'src/core/SkScalerContext.h')
-rw-r--r--src/core/SkScalerContext.h29
1 files changed, 13 insertions, 16 deletions
diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h
index 302698ee4e..9249bfb2a9 100644
--- a/src/core/SkScalerContext.h
+++ b/src/core/SkScalerContext.h
@@ -20,6 +20,12 @@ class SkMaskFilter;
class SkPathEffect;
class SkRasterizer;
+enum SkAxisAlignment {
+ kNone_SkAxisAlignment,
+ kX_SkAxisAlignment,
+ kY_SkAxisAlignment
+};
+
/*
* To allow this to be forward-declared, it must be its own typename, rather
* than a nested struct inside SkScalerContext (where it started).
@@ -245,6 +251,13 @@ public:
const Rec& getRec() const { return fRec; }
+ /**
+ * Return the axis (if any) that the baseline for horizontal text should land on.
+ * As an example, the identity matrix will return kX_SkAxisAlignment
+ */
+ SkAxisAlignment computeAxisAlignmentForHText();
+
+
protected:
Rec fRec;
@@ -340,22 +353,6 @@ private:
///////////////////////////////////////////////////////////////////////////////
-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
- */
-SkAxisAlignment SkComputeAxisAlignmentForHText(const SkMatrix& matrix);
-
-///////////////////////////////////////////////////////////////////////////////
-
SkPaint::Hinting SkScalerContextRec::getHinting() const {
unsigned hint = (fFlags & SkScalerContext::kHinting_Mask) >>
SkScalerContext::kHinting_Shift;