remove dead SkPersp macros

BUG=skia:
TBR=

Review URL: https://codereview.chromium.org/864713002
This commit is contained in:
reed 2015-01-20 19:58:36 -08:00 committed by Commit bot
parent 3e3b58d57a
commit 3f43f8ab9c
9 changed files with 30 additions and 35 deletions

View File

@ -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;

View File

@ -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));

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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);

View File

@ -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;

View File

@ -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));

View File

@ -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.