diff options
author | Jim Van Verth <jvanverth@google.com> | 2018-05-03 10:40:30 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-04 13:56:02 +0000 |
commit | d401da64f0eb94239442018395ab150bc9535746 (patch) | |
tree | 652857da6ce723e4937c375e317a98a852486c78 /src/core/SkMask.h | |
parent | 9eeede2e710f0e5fab0f65e06e8d40a40cdaebcd (diff) |
Use MaskFilter to create SDFs for text.
Easy way to store SDFs in the glyph cache.
Change-Id: Ia67e5c8619862bdee6aa3b293e30507d029e3bf1
Bug: skia:
Reviewed-on: https://skia-review.googlesource.com/123748
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src/core/SkMask.h')
-rw-r--r-- | src/core/SkMask.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/SkMask.h b/src/core/SkMask.h index 1acd8f9cc3..86022a0e9d 100644 --- a/src/core/SkMask.h +++ b/src/core/SkMask.h @@ -25,10 +25,11 @@ struct SkMask { k3D_Format, //!< 3 8bit per pixl planes: alpha, mul, add kARGB32_Format, //!< SkPMColor kLCD16_Format, //!< 565 alpha for r/g/b + kSDF_Format, //!< 8bits representing signed distance field }; enum { - kCountMaskFormats = kLCD16_Format + 1 + kCountMaskFormats = kSDF_Format + 1 }; uint8_t* fImage; @@ -68,7 +69,7 @@ struct SkMask { x,y are in the same coordiate space as fBounds. */ uint8_t* getAddr8(int x, int y) const { - SkASSERT(kA8_Format == fFormat); + SkASSERT(kA8_Format == fFormat || kSDF_Format == fFormat); SkASSERT(fBounds.contains(x, y)); SkASSERT(fImage != nullptr); return fImage + x - fBounds.fLeft + (y - fBounds.fTop) * fRowBytes; @@ -126,6 +127,11 @@ struct SkMask { kJustRenderImage_CreateMode, //!< render into preallocate mask kComputeBoundsAndRenderImage_CreateMode //!< compute bounds, alloc image and render into it }; + + /** + * Returns initial destination mask data padded by radiusX and radiusY + */ + static SkMask PrepareDestination(int radiusX, int radiusY, const SkMask& src); }; /////////////////////////////////////////////////////////////////////////////// |