diff options
author | Ben Wagner <bungeman@google.com> | 2017-11-10 16:24:50 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-11-14 14:10:22 +0000 |
commit | 1662257bdaaaf26b016bf2a3e329c34f7f5ed581 (patch) | |
tree | a4f56bb7d0d0ec073e25d494d786637ea3a20a90 /src/effects/SkEmbossMaskFilter.cpp | |
parent | 5b65a84b990e4ed3b5534cd85167cdc3ed6c820a (diff) |
Alloc glyph image correctly for SkMask::k3D_Format.
Remove the no longer used outside Skia SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
define, and either delete the code it guards or update it to use the new
emboss mask filter factory.
Re-enable the code to test the emboss mask filter.
Add a test to ensure that embossed text is drawn correctly, as before
glyphs did not allocate the proper amount of memory for the k3D_Format
which the emboss mask filter produces.
Fixes SkEmbossMask::Emboss to write the whole of the mul and add planes
to avoid pixel differences and MemorySanitizer errors.
Update the GPU to understand the k3D_Format and use just the alpha
plane, ignoring the mul and add plane which it currently cannot support.
Change-Id: Icac1a3f37d6e8c6be3151df570f5e14111e18585
Reviewed-on: https://skia-review.googlesource.com/70260
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-on: https://skia-review.googlesource.com/70962
Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/effects/SkEmbossMaskFilter.cpp')
-rw-r--r-- | src/effects/SkEmbossMaskFilter.cpp | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/src/effects/SkEmbossMaskFilter.cpp b/src/effects/SkEmbossMaskFilter.cpp index 4caef9ef0b..b51e2545b6 100644 --- a/src/effects/SkEmbossMaskFilter.cpp +++ b/src/effects/SkEmbossMaskFilter.cpp @@ -17,26 +17,6 @@ sk_sp<SkMaskFilter> SkEmbossMaskFilter::Make(SkScalar blurSigma, const Light& li return sk_sp<SkMaskFilter>(new SkEmbossMaskFilter(blurSigma, light)); } -#ifdef SK_SUPPORT_LEGACY_EMBOSSMASKFILTER -sk_sp<SkMaskFilter> SkBlurMaskFilter::MakeEmboss(SkScalar blurSigma, const SkScalar direction[3], - SkScalar ambient, SkScalar specular) { - if (direction == nullptr) { - return nullptr; - } - - SkEmbossMaskFilter::Light light; - - memcpy(light.fDirection, direction, sizeof(light.fDirection)); - // ambient should be 0...1 as a scalar - light.fAmbient = SkUnitScalarClampToByte(ambient); - // specular should be 0..15.99 as a scalar - static const SkScalar kSpecularMultiplier = SkIntToScalar(255) / 16; - light.fSpecular = static_cast<U8CPU>(SkScalarPin(specular, 0, 16) * kSpecularMultiplier + 0.5); - - return SkEmbossMaskFilter::Make(blurSigma, light); -} -#endif - /////////////////////////////////////////////////////////////////////////////// static void normalize(SkScalar v[3]) { |