diff options
-rw-r--r-- | gm/dcshader.cpp | 4 | ||||
-rw-r--r-- | gm/filltypespersp.cpp | 6 | ||||
-rw-r--r-- | include/core/SkMatrix.h | 19 | ||||
-rw-r--r-- | src/animator/SkDrawMatrix.cpp | 14 | ||||
-rw-r--r-- | src/core/SkScalerContext.cpp | 2 | ||||
-rwxr-xr-x | src/ports/SkFontHost_win.cpp | 2 | ||||
-rw-r--r-- | tests/MatrixTest.cpp | 10 | ||||
-rw-r--r-- | tests/PathTest.cpp | 2 | ||||
-rw-r--r-- | tests/RoundRectTest.cpp | 6 |
9 files changed, 30 insertions, 35 deletions
diff --git a/gm/dcshader.cpp b/gm/dcshader.cpp index 9e9a2c27ad..66b0c76b3a 100644 --- a/gm/dcshader.cpp +++ b/gm/dcshader.cpp @@ -249,8 +249,8 @@ protected: devMats.push_back().reset(); devMats.push_back().setRotate(45, 500, 500); devMats.push_back().setRotate(-30, 200, 200); - devMats.back().setPerspX(-SkScalarToPersp(SK_Scalar1 / 2000)); - devMats.back().setPerspY(SkScalarToPersp(SK_Scalar1 / 1000)); + devMats.back().setPerspX(-SK_Scalar1 / 2000); + devMats.back().setPerspY(SK_Scalar1 / 1000); SkTArray<SkMatrix> viewMats; diff --git a/gm/filltypespersp.cpp b/gm/filltypespersp.cpp index e9cf6a77f1..cfdb0150d8 100644 --- a/gm/filltypespersp.cpp +++ b/gm/filltypespersp.cpp @@ -98,7 +98,7 @@ protected: canvas->translate(SkIntToScalar(100), SkIntToScalar(100)); SkMatrix mat; mat.reset(); - mat.setPerspY(SkScalarToPersp(SK_Scalar1 / 1000)); + mat.setPerspY(SK_Scalar1 / 1000); canvas->concat(mat); canvas->drawPaint(bkgnrd); canvas->restore(); @@ -106,8 +106,8 @@ protected: // draw the paths in perspective SkMatrix persp; persp.reset(); - persp.setPerspX(SkScalarToPersp(-SK_Scalar1 / 1800)); - persp.setPerspY(SkScalarToPersp(SK_Scalar1 / 500)); + persp.setPerspX(-SK_Scalar1 / 1800); + persp.setPerspY(SK_Scalar1 / 500); canvas->concat(persp); canvas->translate(SkIntToScalar(20), SkIntToScalar(20)); diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h index fbf8308290..da7838b781 100644 --- a/include/core/SkMatrix.h +++ b/include/core/SkMatrix.h @@ -14,11 +14,6 @@ class SkString; -// TODO: can we remove these 3 (need to check chrome/android) -typedef SkScalar SkPersp; -#define SkScalarToPersp(x) (x) -#define SkPerspToScalar(x) (x) - /** \class SkMatrix The SkMatrix class holds a 3x3 matrix for transforming coordinates. @@ -135,8 +130,8 @@ public: SkScalar getSkewX() const { return fMat[kMSkewX]; } SkScalar getTranslateX() const { return fMat[kMTransX]; } SkScalar getTranslateY() const { return fMat[kMTransY]; } - SkPersp getPerspX() const { return fMat[kMPersp0]; } - SkPersp getPerspY() const { return fMat[kMPersp1]; } + SkScalar getPerspX() const { return fMat[kMPersp0]; } + SkScalar getPerspY() const { return fMat[kMPersp1]; } SkScalar& operator[](int index) { SkASSERT((unsigned)index < 9); @@ -156,12 +151,12 @@ public: void setSkewX(SkScalar v) { this->set(kMSkewX, v); } void setTranslateX(SkScalar v) { this->set(kMTransX, v); } void setTranslateY(SkScalar v) { this->set(kMTransY, v); } - void setPerspX(SkPersp v) { this->set(kMPersp0, v); } - void setPerspY(SkPersp v) { this->set(kMPersp1, v); } + void setPerspX(SkScalar v) { this->set(kMPersp0, v); } + void setPerspY(SkScalar v) { this->set(kMPersp1, v); } - void setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, - SkScalar skewY, SkScalar scaleY, SkScalar transY, - SkPersp persp0, SkPersp persp1, SkPersp persp2) { + void setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, + SkScalar skewY, SkScalar scaleY, SkScalar transY, + SkScalar persp0, SkScalar persp1, SkScalar persp2) { fMat[kMScaleX] = scaleX; fMat[kMSkewX] = skewX; fMat[kMTransX] = transX; diff --git a/src/animator/SkDrawMatrix.cpp b/src/animator/SkDrawMatrix.cpp index 80b04c1bcd..890a3296a3 100644 --- a/src/animator/SkDrawMatrix.cpp +++ b/src/animator/SkDrawMatrix.cpp @@ -119,10 +119,10 @@ void SkDrawMatrix::dump(SkAnimateMaker* maker) { result = fMatrix.getTranslateY(); if (result) SkDebugf("ty=\"%g\" ", SkScalarToFloat(result)); - result = SkPerspToScalar(fMatrix.getPerspX()); + result = fMatrix.getPerspX(); if (result) SkDebugf("perspect-x=\"%g\" ", SkScalarToFloat(result)); - result = SkPerspToScalar(fMatrix.getPerspY()); + result = fMatrix.getPerspY(); if (result) SkDebugf("perspect-y=\"%g\" ", SkScalarToFloat(result)); SkDebugf("/>\n"); @@ -190,9 +190,9 @@ void SkDrawMatrix::onEndElement(SkAnimateMaker& ) { fMatrix.setSkewY(vals[3]); fMatrix.setScaleY(vals[4]); fMatrix.setTranslateY(vals[5]); - fMatrix.setPerspX(SkScalarToPersp(vals[6])); - fMatrix.setPerspY(SkScalarToPersp(vals[7])); -// fMatrix.setPerspW(SkScalarToPersp(vals[8])); + fMatrix.setPerspX(vals[6]); + fMatrix.setPerspY(vals[7]); +// fMatrix.setPerspW(vals[8]); goto setConcat; } if (fChildHasID == false) { @@ -224,10 +224,10 @@ bool SkDrawMatrix::setProperty(int index, SkScriptValue& scriptValue) { fMatrix.setTranslateY((*scriptValue.fOperand.fArray)[1].fScalar); return true; case SK_PROPERTY(perspectX): - fMatrix.setPerspX(SkScalarToPersp((number))); + fMatrix.setPerspX(number); break; case SK_PROPERTY(perspectY): - fMatrix.setPerspY(SkScalarToPersp((number))); + fMatrix.setPerspY(number); break; case SK_PROPERTY(rotate): { SkMatrix temp; diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index dad8e5eb21..16cc940c06 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -693,7 +693,7 @@ void SkScalerContext::internalGetPath(const SkGlyph& glyph, SkPath* fillPath, void SkScalerContextRec::getMatrixFrom2x2(SkMatrix* dst) const { dst->setAll(fPost2x2[0][0], fPost2x2[0][1], 0, fPost2x2[1][0], fPost2x2[1][1], 0, - 0, 0, SkScalarToPersp(SK_Scalar1)); + 0, 0, 1); } void SkScalerContextRec::getLocalMatrix(SkMatrix* m) const { diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 6f4a60341f..1ec2bb5cf8 100755 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -854,7 +854,7 @@ void SkScalerContext_GDI::generateMetrics(SkGlyph* glyph) { SkMatrix m; m.setAll(SkFIXEDToScalar(fMat22.eM11), -SkFIXEDToScalar(fMat22.eM21), 0, -SkFIXEDToScalar(fMat22.eM12), SkFIXEDToScalar(fMat22.eM22), 0, - 0, 0, SkScalarToPersp(SK_Scalar1)); + 0, 0, 1); m.mapRect(&bounds); bounds.roundOut(&bounds); glyph->fLeft = SkScalarTruncToInt(bounds.fLeft); diff --git a/tests/MatrixTest.cpp b/tests/MatrixTest.cpp index 8a27a9eddf..7875d9ea45 100644 --- a/tests/MatrixTest.cpp +++ b/tests/MatrixTest.cpp @@ -202,7 +202,7 @@ static void test_matrix_min_max_scale(skiatest::Reporter* reporter) { SkMatrix perspX; perspX.reset(); - perspX.setPerspX(SkScalarToPersp(SK_Scalar1 / 1000)); + perspX.setPerspX(SK_Scalar1 / 1000); REPORTER_ASSERT(reporter, -SK_Scalar1 == perspX.getMinScale()); REPORTER_ASSERT(reporter, -SK_Scalar1 == perspX.getMaxScale()); // Verify that getMinMaxScales() doesn't update the scales array on failure. @@ -213,7 +213,7 @@ static void test_matrix_min_max_scale(skiatest::Reporter* reporter) { SkMatrix perspY; perspY.reset(); - perspY.setPerspY(SkScalarToPersp(-SK_Scalar1 / 500)); + perspY.setPerspY(-SK_Scalar1 / 500); REPORTER_ASSERT(reporter, -SK_Scalar1 == perspY.getMinScale()); REPORTER_ASSERT(reporter, -SK_Scalar1 == perspY.getMaxScale()); scales[0] = -5; @@ -358,13 +358,13 @@ static void test_matrix_preserve_shape(skiatest::Reporter* reporter) { // perspective x mat.reset(); - mat.setPerspX(SkScalarToPersp(SK_Scalar1 / 2)); + mat.setPerspX(SK_Scalar1 / 2); REPORTER_ASSERT(reporter, !mat.isSimilarity()); REPORTER_ASSERT(reporter, !mat.preservesRightAngles()); // perspective y mat.reset(); - mat.setPerspY(SkScalarToPersp(SK_Scalar1 / 2)); + mat.setPerspY(SK_Scalar1 / 2); REPORTER_ASSERT(reporter, !mat.isSimilarity()); REPORTER_ASSERT(reporter, !mat.preservesRightAngles()); @@ -867,7 +867,7 @@ DEF_TEST(Matrix, reporter) { REPORTER_ASSERT(reporter, affineEqual(TransY)); #undef affineEqual - mat.set(SkMatrix::kMPersp1, SkScalarToPersp(SK_Scalar1 / 2)); + mat.set(SkMatrix::kMPersp1, SK_Scalar1 / 2); REPORTER_ASSERT(reporter, !mat.asAffine(affine)); SkMatrix mat2; diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index a274694b71..16131dee80 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -2207,7 +2207,7 @@ static void test_transform(skiatest::Reporter* reporter) { { SkMatrix matrix; matrix.reset(); - matrix.setPerspX(SkScalarToPersp(4)); + matrix.setPerspX(4); SkPath p1; p1.moveTo(SkPoint::Make(0, 0)); diff --git a/tests/RoundRectTest.cpp b/tests/RoundRectTest.cpp index 261ec67ca0..b67718a6b1 100644 --- a/tests/RoundRectTest.cpp +++ b/tests/RoundRectTest.cpp @@ -433,11 +433,11 @@ static void test_transform_helper(skiatest::Reporter* reporter, const SkRRect& o assert_transform_failure(reporter, orig, matrix); matrix.reset(); - matrix.setPerspX(SkScalarToPersp(SkIntToScalar(4))); + matrix.setPerspX(4); assert_transform_failure(reporter, orig, matrix); matrix.reset(); - matrix.setPerspY(SkScalarToPersp(SkIntToScalar(5))); + matrix.setPerspY(5); assert_transform_failure(reporter, orig, matrix); // Rotation fails. @@ -492,7 +492,7 @@ static void test_transform_helper(skiatest::Reporter* reporter, const SkRRect& o REPORTER_ASSERT(reporter, orig.rect().top() == dst.rect().top()); // Keeping the scale, but adding a persp will make transform fail. - matrix.setPerspX(SkScalarToPersp(SkIntToScalar(7))); + matrix.setPerspX(7); assert_transform_failure(reporter, orig, matrix); // Scaling in -y will flip the round rect vertically. |