Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: include/core/SkPaint.h

Issue 2186663004: SkPaint intercept API for SkTextBlob and horizontal text (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: GM size, comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/texteffects.cpp ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPaint.h
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index ef80b73f21f7b0f1d6b01755f9ffebc92d809b0c..ea7eedd65f0917764a6c9ceb39e1c3e3167bd70e 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -33,6 +33,7 @@ class SkRasterizer;
struct SkScalerContextEffects;
class SkShader;
class SkSurfaceProps;
+class SkTextBlob;
class SkTypeface;
#define kBicubicFilterBitmap_Flag kHighQualityFilterBitmap_Flag
@@ -964,6 +965,40 @@ public:
int getPosTextIntercepts(const void* text, size_t length, const SkPoint pos[],
const SkScalar bounds[2], SkScalar* intervals) const;
+ /** Return the number of intervals that intersect the intercept along the axis of the advance.
+ * The return count is zero or a multiple of two, and is at most the number of glyphs * 2 in
+ * string. The caller may pass nullptr for intervals to determine the size of the interval
+ * array, or may conservatively pre-allocate an array with length * 2 entries. The computed
+ * intervals are cached by glyph to improve performance for multiple calls.
+ * This permits constructing an underline that skips the descenders.
+ *
+ * @param text The text.
+ * @param length Number of bytes of text.
+ * @param xpos Array of x-positions, used to position each character.
+ * @param constY The shared Y coordinate for all of the positions.
+ * @param bounds The lower and upper line parallel to the advance.
+ * @param array If not null, the glyph bounds contained by the advance parallel lines.
+ *
+ * @return The number of intersections, which may be zero.
+ */
+ int getPosTextHIntercepts(const void* text, size_t length, const SkScalar xpos[],
+ SkScalar constY, const SkScalar bounds[2], SkScalar* intervals) const;
+
+ /** Return the number of intervals that intersect the intercept along the axis of the advance.
+ * The return count is zero or a multiple of two, and is at most the number of glyphs * 2 in
+ * text blob. The caller may pass nullptr for intervals to determine the size of the interval
+ * array. The computed intervals are cached by glyph to improve performance for multiple calls.
+ * This permits constructing an underline that skips the descenders.
+ *
+ * @param blob The text blob.
+ * @param bounds The lower and upper line parallel to the advance.
+ * @param array If not null, the glyph bounds contained by the advance parallel lines.
+ *
+ * @return The number of intersections, which may be zero.
+ */
+ int getTextBlobIntercepts(const SkTextBlob* blob, const SkScalar bounds[2],
+ SkScalar* intervals) const;
+
/**
* Return a rectangle that represents the union of the bounds of all
* of the glyphs, but each one positioned at (0,0). This may be conservatively large, and
« no previous file with comments | « gm/texteffects.cpp ('k') | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698