aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2016-03-10 11:10:43 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-10 11:10:43 -0800
commitcf371bb41b4a0591347a076ce7d83336d4bbc6fb (patch)
treecd0e34686433786ab2a759ddf619f86faa718931 /src/gpu/batches
parent4ba051cbcfbd379714250b1fe463c1610e7df04c (diff)
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
Diffstat (limited to 'src/gpu/batches')
-rw-r--r--src/gpu/batches/GrAADistanceFieldPathRenderer.cpp4
-rw-r--r--src/gpu/batches/GrAtlasTextBatch.cpp2
2 files changed, 4 insertions, 2 deletions
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);