Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: src/gpu/GrPathUtils.cpp

Issue 1749373002: Force values to 0.0f in QuadUVMatrix::set (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPathUtils.cpp
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index 0fd8b0e8829a0032361205bb6397fb9cc79b06ae..fcb32cbd9a033f5761cd3d05e4058cf21df58e01 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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698