From cf371bb41b4a0591347a076ce7d83336d4bbc6fb Mon Sep 17 00:00:00 2001 From: jvanverth Date: Thu, 10 Mar 2016 11:10:43 -0800 Subject: Use correct gradient calculation for rotated distance fields. For all uniform scaled matrices, we were using the y coordinate of the y-direction gradient of the v texel space coordinate to scale the distance values. The problem is, if you rotate by 90 degrees this value becomes 0. The correct answer is to take the length of the y-direction gradient. BUG=skia:4864 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1776383002 Review URL: https://codereview.chromium.org/1776383002 --- src/gpu/batches/GrAADistanceFieldPathRenderer.cpp | 4 +++- src/gpu/batches/GrAtlasTextBatch.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gpu/batches') diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp index 8525eb2fde..b585de963a 100644 --- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp +++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp @@ -190,8 +190,10 @@ private: return; } + const SkMatrix& ctm = this->viewMatrix(); uint32_t flags = 0; - flags |= this->viewMatrix().isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0; + flags |= ctm.isScaleTranslate() ? kScaleOnly_DistanceFieldEffectFlag : 0; + flags |= ctm.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0; GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBilerp_FilterMode); diff --git a/src/gpu/batches/GrAtlasTextBatch.cpp b/src/gpu/batches/GrAtlasTextBatch.cpp index 432322ff7a..1d8d7fe143 100644 --- a/src/gpu/batches/GrAtlasTextBatch.cpp +++ b/src/gpu/batches/GrAtlasTextBatch.cpp @@ -261,11 +261,11 @@ GrGeometryProcessor* GrAtlasTextBatch::setupDfProcessor(const SkMatrix& viewMatr bool isLCD = this->isLCD(); // set up any flags uint32_t flags = viewMatrix.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0; + flags |= viewMatrix.isScaleTranslate() ? kScaleOnly_DistanceFieldEffectFlag : 0; // see if we need to create a new effect if (isLCD) { flags |= kUseLCD_DistanceFieldEffectFlag; - flags |= viewMatrix.rectStaysRect() ? kRectToRect_DistanceFieldEffectFlag : 0; flags |= fUseBGR ? kBGR_DistanceFieldEffectFlag : 0; GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredColor); -- cgit v1.2.3