Index: src/core/SkScalerContext.h |
diff --git a/src/core/SkScalerContext.h b/src/core/SkScalerContext.h |
index b78efef9c23727049eaf55e7c321b7d10c3ddc72..88b52860fb88503fe69e7a64db7cc66dcbcb92cf 100644 |
--- a/src/core/SkScalerContext.h |
+++ b/src/core/SkScalerContext.h |
@@ -86,6 +86,50 @@ struct SkScalerContextRec { |
void getSingleMatrix(SkMatrix*) const; |
void getSingleMatrixWithoutTextSize(SkMatrix*) const; |
+ /** The kind of scale which will be applied by the underlying port (pre-matrix). */ |
+ enum PreMatrixScale { |
+ kFull_PreMatrixScale, // The underlying port can apply both x and y scale. |
+ kVertical_PreMatrixScale, // The underlying port can only apply a y scale. |
+ kVerticalInteger_PreMatrixScale // The underlying port can only apply an integer y scale. |
+ }; |
+ /** |
+ * Compute useful matrices for use with sizing in underlying libraries. |
+ * |
+ * There are two kinds of text size, a 'requested/logical size' which is like asking for size |
+ * '12' and a 'real' size which is the size after the matrix is applied. The matrices produced |
+ * by this method are based on the 'real' size. This method effectively finds the total device |
+ * matrix and decomposes it in various ways. |
+ * |
+ * The most useful decomposition is into 'scale' and 'remaining'. The 'scale' is applied first |
+ * and then the 'remaining' to fully apply the total matrix. This decomposition is useful when |
+ * the text size ('scale') may have meaning apart from the total matrix. This is true when |
+ * hinting, and sometimes true for other properties as well. |
+ * |
+ * The second (optional) decomposition is of 'remaining' into a non-rotational part |
+ * 'remainingWithoutRotation' and a rotational part 'remainingRotation'. The 'scale' is applied |
+ * first, then 'remainingWithoutRotation', then 'remainingRotation' to fully apply the total |
+ * matrix. This decomposition is helpful when only horizontal metrics can be trusted, so the |
+ * 'scale' and 'remainingWithoutRotation' will be handled by the underlying library, but |
+ * the final rotation 'remainingRotation' will be handled manually. |
+ * |
+ * The 'total' matrix is also (optionally) available. This is useful in cases where the |
+ * underlying library will not be used, often when working directly with font data. |
+ * |
+ * The parameters 'scale' and 'remaining' are required, the other pointers may be NULL. |
+ * |
+ * @param preMatrixScale the kind of scale to extract from the total matrix. |
+ * @param scale the scale extracted from the total matrix (both values positive). |
+ * @param remaining apply after scale to apply the total matrix. |
+ * @param remainingWithoutRotation apply after scale to apply the total matrix sans rotation. |
+ * @param remainingRotation apply after remainingWithoutRotation to apply the total matrix. |
+ * @param total the total matrix. |
+ */ |
+ void computeMatrices(PreMatrixScale preMatrixScale, |
+ SkVector* scale, SkMatrix* remaining, |
+ SkMatrix* remainingWithoutRotation = NULL, |
+ SkMatrix* remainingRotation = NULL, |
+ SkMatrix* total = NULL); |
+ |
inline SkPaint::Hinting getHinting() const; |
inline void setHinting(SkPaint::Hinting); |