use scalarcomparetype in matrix tests, so we don't do anything tricky

(unnecessary) when floats are fast



git-svn-id: http://skia.googlecode.com/svn/trunk@259 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@android.com 2009-07-08 14:46:11 +00:00
Родитель 187d559590
Коммит 31745581ca
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -18,6 +18,7 @@
#include "SkMatrix.h" #include "SkMatrix.h"
#include "Sk64.h" #include "Sk64.h"
#include "SkFloatBits.h" #include "SkFloatBits.h"
#include "SkScalarCompare.h"
#include "SkString.h" #include "SkString.h"
#ifdef SK_SCALAR_IS_FLOAT #ifdef SK_SCALAR_IS_FLOAT
@ -115,7 +116,7 @@ uint8_t SkMatrix::computeTypeMask() const {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
void SkMatrix::setTranslate(SkScalar dx, SkScalar dy) { void SkMatrix::setTranslate(SkScalar dx, SkScalar dy) {
if (SkScalarAs2sCompliment(dx) | SkScalarAs2sCompliment(dy)) { if (SkScalarToCompareType(dx) || SkScalarToCompareType(dy)) {
fMat[kMTransX] = dx; fMat[kMTransX] = dx;
fMat[kMTransY] = dy; fMat[kMTransY] = dy;
@ -137,7 +138,7 @@ bool SkMatrix::preTranslate(SkScalar dx, SkScalar dy) {
return this->preConcat(m); return this->preConcat(m);
} }
if (SkScalarAs2sCompliment(dx) | SkScalarAs2sCompliment(dy)) { if (SkScalarToCompareType(dx) || SkScalarToCompareType(dy)) {
fMat[kMTransX] += SkScalarMul(fMat[kMScaleX], dx) + fMat[kMTransX] += SkScalarMul(fMat[kMScaleX], dx) +
SkScalarMul(fMat[kMSkewX], dy); SkScalarMul(fMat[kMSkewX], dy);
fMat[kMTransY] += SkScalarMul(fMat[kMSkewY], dx) + fMat[kMTransY] += SkScalarMul(fMat[kMSkewY], dx) +
@ -155,7 +156,7 @@ bool SkMatrix::postTranslate(SkScalar dx, SkScalar dy) {
return this->postConcat(m); return this->postConcat(m);
} }
if (SkScalarAs2sCompliment(dx) | SkScalarAs2sCompliment(dy)) { if (SkScalarToCompareType(dx) || SkScalarToCompareType(dy)) {
fMat[kMTransX] += dx; fMat[kMTransX] += dx;
fMat[kMTransY] += dy; fMat[kMTransY] += dy;
this->setTypeMask(kUnknown_Mask); this->setTypeMask(kUnknown_Mask);