for (int i = 0; i < REPEAT_LOOP; ++i) {
SkPath line, path;
- line.moveTo(SkIntToScalar(1), SkIntToScalar(2));
+ line.moveTo(SkIntToScalar(1), SkIntToScalar(2));
line.lineTo(SkIntToScalar(4 + i), SkIntToScalar(1));
paint.getFillPath(line, &path);
draw_fatpath(canvas, surface, &path, 1);
#endif
typedef float SkMScalar;
typedef int32_t SkMIntScalar;
-
+
static inline float SkFloatToMScalar(float x) {
return x;
}
kAffine_Mask = 0x04, //!< set if the matrix skews or rotates
kPerspective_Mask = 0x08 //!< set if the matrix is in perspective
};
-
+
/**
* Returns a bitfield describing the transformations the matrix may
* perform. The bitfield is computed conservatively, so it may include
inline bool isIdentity() const {
return 0 == this->getType();
}
-
+
void setIdentity();
inline void reset() { this->setIdentity();}
// we are always packed with no extra bits, allowing us to call memcpy
// without fear of copying uninitialized bits.
mutable SkMIntScalar fTypeMask;
-
+
enum {
kUnknown_Mask = 0x80,
SkMScalar scaleX() const { return fMat[0][0]; }
SkMScalar scaleY() const { return fMat[1][1]; }
SkMScalar scaleZ() const { return fMat[2][2]; }
-
+
SkMScalar perspX() const { return fMat[0][3]; }
SkMScalar perspY() const { return fMat[1][3]; }
SkMScalar perspZ() const { return fMat[2][3]; }
}
}
}
-
+
void addToHead(const T& t) {
this->validate();
Node* node = this->createNode();
int SkMatrix44::computeTypeMask() const {
unsigned mask = 0;
-
+
if (0 != perspX() || 0 != perspY() || 0 != perspZ() || 1 != fMat[3][3]) {
return kTranslate_Mask | kScale_Mask | kAffine_Mask | kPerspective_Mask;
}
fMat[3][1] = ty;
fMat[3][2] = tz;
fMat[3][3] = 1;
-
+
int mask = kIdentity_Mask;
if (0 != tx || 0 != ty || 0 != tz) {
mask |= kTranslate_Mask;
fMat[1][1] = sy;
fMat[2][2] = sz;
fMat[3][3] = 1;
-
+
int mask = kIdentity_Mask;
if (0 != sx || 0 != sy || 0 != sz) {
mask |= kScale_Mask;
}
result[i] = SkMScalarToScalar(value);
}
-
+
if (storage == result) {
memcpy(dst, storage, sizeof(storage));
}
void SkMatrix44::mapMScalars(const SkMScalar src[4], SkMScalar dst[4]) const {
SkMScalar storage[4];
SkMScalar* result = (src == dst) ? storage : dst;
-
+
for (int i = 0; i < 4; i++) {
SkMScalar value = 0;
for (int j = 0; j < 4; j++) {
}
result[i] = value;
}
-
+
if (storage == result) {
memcpy(dst, storage, sizeof(storage));
}
REPORTER_ASSERT(reporter, iter3.get()->fID == iter1.get()->fID);
REPORTER_ASSERT(reporter, iter4.get()->fID == iter1.get()->fID);
REPORTER_ASSERT(reporter, list1 == list2);
-
+
list2.reset();
// use both before/after in-place construction on an empty list
SkNEW_INSERT_IN_LLIST_BEFORE(&list2, list2.headIter(), ListElement, (1));
REPORTER_ASSERT(reporter, list2 == list1);
list2.reset();
-
+
SkNEW_INSERT_IN_LLIST_AFTER(&list2, list2.tailIter(), ListElement, (1));
REPORTER_ASSERT(reporter, list2 == list1);
REPORTER_ASSERT(reporter, prev.next()->fID == iter.get()->fID);
}
}
- }
+ }
}
++count;
} else {
int n = random.nextULessThan(list1.count());
Iter::IterStart start;
ListElement* (Iter::*incrFunc)();
-
+
if (random.nextBool()) {
start = Iter::kHead_IterStart;
incrFunc = &Iter::next;
static void test_gettype(skiatest::Reporter* reporter) {
SkMatrix44 matrix;
-
+
REPORTER_ASSERT(reporter, matrix.isIdentity());
REPORTER_ASSERT(reporter, SkMatrix44::kIdentity_Mask == matrix.getType());
-
+
int expectedMask;
matrix.set(1, 1, 0);
matrix.set(2, 0, 1);
expectedMask |= SkMatrix44::kAffine_Mask;
REPORTER_ASSERT(reporter, matrix.getType() == expectedMask);
-
+
matrix.set(3, 2, 1);
REPORTER_ASSERT(reporter, matrix.getType() & SkMatrix44::kPerspective_Mask);
}
a.setDouble(row, col, row * 4 + col);
}
}
-
+
double bufferd[16];
float bufferf[16];
a.asColMajord(bufferd);
dst.fRight += SK_Scalar1;
matrix.setRectToRect(src, dst, SkMatrix::kFill_ScaleToFit);
- REPORTER_ASSERT(reporter,
+ REPORTER_ASSERT(reporter,
(SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask) == matrix.getType());
REPORTER_ASSERT(reporter, matrix.rectStaysRect());