void SkGPipeCanvas::didSetMatrix(const SkMatrix& matrix) { NOTIFY_SETUP(this); if (this->needOpBytes(matrix.writeToMemory(nullptr))) { this->writeOp(kSetMatrix_DrawOp); fWriter.writeMatrix(matrix); } this->INHERITED::didSetMatrix(matrix); }
void SkPictureRecord::recordConcat(const SkMatrix& matrix) { this->validate(fWriter.bytesWritten(), 0); // op + matrix size_t size = kUInt32Size + matrix.writeToMemory(nullptr); size_t initialOffset = this->addDraw(CONCAT, &size); this->addMatrix(matrix); this->validate(initialOffset, size); }
void SkPictureRecord::didSetMatrix(const SkMatrix& matrix) { this->validate(fWriter.bytesWritten(), 0); // op + matrix size_t size = kUInt32Size + matrix.writeToMemory(nullptr); size_t initialOffset = this->addDraw(SET_MATRIX, &size); this->addMatrix(matrix); this->validate(initialOffset, size); this->INHERITED::didSetMatrix(matrix); }
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.writeToMemory(NULL); uint32_t size2 = m.writeToMemory(buffer); REPORTER_ASSERT(reporter, size1 == size2); REPORTER_ASSERT(reporter, size1 <= SkMatrix::kMaxFlattenSize); SkMatrix m2; uint32_t size3 = m2.readFromMemory(buffer); REPORTER_ASSERT(reporter, size1 == size3); REPORTER_ASSERT(reporter, are_equal(reporter, m, m2)); char buffer2[SkMatrix::kMaxFlattenSize + 100]; size3 = m2.writeToMemory(buffer2); REPORTER_ASSERT(reporter, size1 == size3); REPORTER_ASSERT(reporter, memcmp(buffer, buffer2, size1) == 0); }
void SkGPipeCanvas::recordConcat(const SkMatrix& m) { if (this->needOpBytes(m.writeToMemory(nullptr))) { this->writeOp(kConcat_DrawOp); fWriter.writeMatrix(m); } }