本文整理汇总了C++中SkMatrix::flatten方法的典型用法代码示例。如果您正苦于以下问题:C++ SkMatrix::flatten方法的具体用法?C++ SkMatrix::flatten怎么用?C++ SkMatrix::flatten使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkMatrix
的用法示例。
在下文中一共展示了SkMatrix::flatten方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_flatten
static void test_flatten(skiatest::Reporter* reporter, const SkMatrix& m) {
// add 100 in case we have a bug, I don't want to kill my stack in the test
char buffer[SkMatrix::kMaxFlattenSize + 100];
uint32_t size1 = m.flatten(NULL);
uint32_t size2 = m.flatten(buffer);
REPORTER_ASSERT(reporter, size1 == size2);
REPORTER_ASSERT(reporter, size1 <= SkMatrix::kMaxFlattenSize);
SkMatrix m2;
uint32_t size3 = m2.unflatten(buffer);
REPORTER_ASSERT(reporter, size1 == size2);
REPORTER_ASSERT(reporter, m == m2);
char buffer2[SkMatrix::kMaxFlattenSize + 100];
size3 = m2.flatten(buffer2);
REPORTER_ASSERT(reporter, size1 == size2);
REPORTER_ASSERT(reporter, memcmp(buffer, buffer2, size1) == 0);
}
示例2: SkWriteMatrix
void SkWriteMatrix(SkWriter32* writer, const SkMatrix& matrix) {
size_t size = matrix.flatten(NULL);
SkASSERT(SkAlign4(size) == size);
matrix.flatten(writer->reserve(size));
}