Clip FreeType glyph bitmap to mask.
authorBen Wagner <bungeman@behemoth.cnc.corp.google.com>
Thu, 15 Jun 2017 14:43:17 +0000 (10:43 -0400)
committerBen Wagner <bungeman@google.com>
Fri, 28 Jul 2017 19:49:23 +0000 (19:49 +0000)
commitd1f2d15b36f6a6a9d199581b998a7ca924a1f1a8
tree47553864d75d3e70edc693cdac3eed0cc7cee340
parenta20ae70af542208b06c21413f13c4c86269c0b84
Clip FreeType glyph bitmap to mask.

Skia has for some time assumed that when using FT_Render_Glyph with one
of the LCD render modes that one extra pixel would be applied to each
side of the resulting bitmap. FreieType has changed to make this more
conservative when possible, so the pre-allocated SkMask and the generated
FT_Bitmap may no longer agree on the size and origin.

This change ensures the SkMask and FT_Bitmap are the same size and their
origins align. This is not an ideal long term fix, but is both simple and
localized for easy and quick back-porting, should that become necessary.

BUG=skia:6663

Original-Change-Id: I49ec8f45376be8d867e8aef54eab79537731c310
Reviewed-on: https://skia-review.googlesource.com/20327
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>

BUG=chromium:726631

Change-Id: I9740bc7df544b402720caaf97244ff1fb05f3b81
Cherry-Pick: 6cdb5f2ad7684302a8a66217462d2aef4c5f4632
Approval: https://crbug.com/726631#c69
Reviewed-on: https://skia-review.googlesource.com/28185
Reviewed-by: Ben Wagner <bungeman@google.com>
src/ports/SkFontHost_FreeType_common.cpp