diff options
author | robertphillips <robertphillips@google.com> | 2016-03-01 14:49:44 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-01 14:49:44 -0800 |
commit | 87a223401d8575d398eb369f7be7afdabbdfab08 (patch) | |
tree | 8f4f6ac0d64ca0a6da5d46595a38d01774c4395a /src | |
parent | 9c0b02a557e9be663a0eb07519e1b6a61a6c3df2 (diff) |
Force values to 0.0f in QuadUVMatrix::set
BUG=skia:5002
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1749373002
Review URL: https://codereview.chromium.org/1749373002
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrPathUtils.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp index 0fd8b0e882..fcb32cbd9a 100644 --- a/src/gpu/GrPathUtils.cpp +++ b/src/gpu/GrPathUtils.cpp @@ -267,9 +267,7 @@ void GrPathUtils::QuadUVMatrix::set(const SkPoint qPts[3]) { double scale = 1.0/det; // compute adjugate matrix - double a0, a1, a2, a3, a4, a5, a6, a7, a8; - a0 = y1-y2; - a1 = x2-x1; + double a2, a3, a4, a5, a6, a7, a8; a2 = x1*y2-x2*y1; a3 = y2-y0; @@ -290,15 +288,11 @@ void GrPathUtils::QuadUVMatrix::set(const SkPoint qPts[3]) { m[SkMatrix::kMScaleY] = (float)(a7*scale); m[SkMatrix::kMTransY] = (float)(a8*scale); - m[SkMatrix::kMPersp0] = (float)((a0 + a3 + a6)*scale); - m[SkMatrix::kMPersp1] = (float)((a1 + a4 + a7)*scale); + // kMPersp0 & kMPersp1 should algebraically be zero + m[SkMatrix::kMPersp0] = 0.0f; + m[SkMatrix::kMPersp1] = 0.0f; m[SkMatrix::kMPersp2] = (float)((a2 + a5 + a8)*scale); - // The matrix should not have perspective. - SkDEBUGCODE(static const SkScalar gTOL = 1.f / 100.f); - SkASSERT(SkScalarAbs(m.get(SkMatrix::kMPersp0)) < gTOL); - SkASSERT(SkScalarAbs(m.get(SkMatrix::kMPersp1)) < gTOL); - // It may not be normalized to have 1.0 in the bottom right float m33 = m.get(SkMatrix::kMPersp2); if (1.f != m33) { |