| Index: include/core/SkCanvas.h
|
| diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
|
| index 0ec167e1166e72870b90440ae31d4ca348a7cec4..55ff4f7ec8ddc554eda23e2dc321b2bd74ce3a1a 100644
|
| --- a/include/core/SkCanvas.h
|
| +++ b/include/core/SkCanvas.h
|
| @@ -19,6 +19,17 @@
|
| #include "SkSurfaceProps.h"
|
| #include "SkXfermode.h"
|
|
|
| +#ifdef SK_SUPPORT_LEGACY_DRAWTEXTONPATH
|
| + #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_PARAM
|
| + #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_ARG
|
| + #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_DEFAULT_METHOD \
|
| + SkCanvas::TextOnPathMethod method = SkCanvas::kStretch_TextOnPathMethod;
|
| +#else
|
| + #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_PARAM SkCanvas::TextOnPathMethod method,
|
| + #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_ARG method,
|
| + #define SK_SUPPORT_LEGACY_DRAWTEXTONPATH_DEFAULT_METHOD
|
| +#endif
|
| +
|
| class SkBaseDevice;
|
| class SkCanvasClipVisitor;
|
| class SkDraw;
|
| @@ -909,20 +920,21 @@ public:
|
| void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY,
|
| const SkPaint& paint);
|
|
|
| +#ifdef SK_SUPPORT_LEGACY_DRAWTEXTONPATH
|
| /** Draw the text, with origin at (x,y), using the specified paint, along
|
| the specified path. The paint's Align setting determins where along the
|
| path to start the text.
|
| @param text The text to be drawn
|
| @param byteLength The number of bytes to read from the text parameter
|
| @param path The path the text should follow for its baseline
|
| - @param hOffset The distance along the path to add to the text's
|
| + @param trangentOffset The distance along the path to add to the text's
|
| starting position
|
| - @param vOffset The distance above(-) or below(+) the path to
|
| + @param normalOffset The distance above(-) or below(+) the path to
|
| position the text
|
| @param paint The paint used for the text
|
| */
|
| - void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& path, SkScalar hOffset,
|
| - SkScalar vOffset, const SkPaint& paint);
|
| + void drawTextOnPathHV(const void* text, size_t byteLength, const SkPath& path,
|
| + SkScalar trangentOffset, SkScalar normalOffset, const SkPaint& paint);
|
|
|
| /** Draw the text, with origin at (x,y), using the specified paint, along
|
| the specified path. The paint's Align setting determins where along the
|
| @@ -936,6 +948,26 @@ public:
|
| */
|
| void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
|
| const SkMatrix* matrix, const SkPaint& paint);
|
| +#endif
|
| +
|
| + enum TextOnPathMethod {
|
| + kStretch_TextOnPathMethod, //!< warp the shape of each glyph to match the path
|
| + kAlign_TextOnPathMethod //!< rotate each glyph to align with the path's direction
|
| + };
|
| +
|
| + /**
|
| + * Draw the text, with origin at (x,y), using the specified paint, along
|
| + * the specified path. The paint's Align setting determins where along the
|
| + * path to start the text.
|
| + * @param text The text to be drawn
|
| + * @param byteLength The number of bytes to read from the text parameter
|
| + * @param path The path the text should follow for its baseline
|
| + * @param matrix (may be null) Applied to the text before it is mapped onto the path
|
| + * @param method How to orient/warp each glyph along the path.
|
| + * @param paint The paint used for the text
|
| + */
|
| + void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path,
|
| + const SkMatrix* matrix, TextOnPathMethod, const SkPaint& paint);
|
|
|
| /** Draw the text blob, offset by (x,y), using the specified paint.
|
| @param blob The text blob to be drawn
|
| @@ -1188,6 +1220,7 @@ protected:
|
|
|
| virtual void onDrawTextOnPath(const void* text, size_t byteLength,
|
| const SkPath& path, const SkMatrix* matrix,
|
| + SK_SUPPORT_LEGACY_DRAWTEXTONPATH_PARAM
|
| const SkPaint& paint);
|
|
|
| virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
|
|