93 srcGlyph.flattenMetrics(writeBuffer);
110 srcGlyph.flattenMetrics(writeBuffer);
123 uint8_t badData[] = {1, 2, 3, 4, 5, 6, 7, 8};
135 static constexpr uint8_t
X = 0xff;
136 static constexpr uint8_t O = 0x00;
137 uint8_t imageData[][8] = {
149 srcGlyph.setImage(&alloc, imageData);
152 srcGlyph.flattenMetrics(writeBuffer);
153 srcGlyph.flattenImage(writeBuffer);
165 dstGlyph->addImageFromBuffer(readBuffer, &alloc);
167 const uint8_t* dstImage = (
const uint8_t*)dstGlyph->image();
168 for (
int y = 0;
y < dstGlyph->height(); ++
y) {
169 for (
int x = 0;
x < dstGlyph->width(); ++
x) {
176 srcGlyph.flattenMetrics(badWriteBuffer);
178 badWriteBuffer.writeInt(8);
180 data = badWriteBuffer.snapshotAsData();
190 dstGlyph->addImageFromBuffer(badReadBuffer, &alloc);
201 srcPath.
addRect(srcGlyph.rect());
203 srcGlyph.setPath(&alloc, &srcPath,
false);
206 srcGlyph.flattenMetrics(writeBuffer);
207 srcGlyph.flattenPath(writeBuffer);
219 dstGlyph->addPathFromBuffer(readBuffer, &alloc);
222 const SkPath* dstPath = dstGlyph->path();
228 srcGlyph.flattenMetrics(badWriteBuffer);
231 badWriteBuffer.writeInt(9);
233 data = badWriteBuffer.snapshotAsData();
242 dstGlyph->addPathFromBuffer(badReadBuffer, &alloc);
249 srcGlyph.flattenMetrics(badWriteBuffer);
251 data = badWriteBuffer.snapshotAsData();
261 dstGlyph->addPathFromBuffer(badReadBuffer, &alloc);
272 class TestDrawable final :
public SkDrawable {
288 srcGlyph.setDrawable(&alloc, srcDrawable);
292 srcGlyph.flattenMetrics(writeBuffer);
293 srcGlyph.flattenDrawable(writeBuffer);
305 dstGlyph->addDrawableFromBuffer(readBuffer, &alloc);
308 SkDrawable* dstDrawable = dstGlyph->drawable();
313 srcGlyph.flattenMetrics(badWriteBuffer);
315 badWriteBuffer.writeInt(8);
317 data = badWriteBuffer.snapshotAsData();
327 dstGlyph->addDrawableFromBuffer(badReadBuffer, &alloc);
333 class TestDrawable final :
public SkDrawable {
339 size_t onApproximateBytesUsed()
override {
342 void onDraw(
SkCanvas* canvas)
override {
365 badWriteBuffer.writeInt(8);
367 data = badWriteBuffer.snapshotAsData();