From 87a223401d8575d398eb369f7be7afdabbdfab08 Mon Sep 17 00:00:00 2001 From: robertphillips Date: Tue, 1 Mar 2016 14:49:44 -0800 Subject: 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 --- src/gpu/GrPathUtils.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src') 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) { -- cgit v1.2.3