本文整理汇总了C++中sk_sp::serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ sk_sp::serialize方法的具体用法?C++ sk_sp::serialize怎么用?C++ sk_sp::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sk_sp
的用法示例。
在下文中一共展示了sk_sp::serialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_pictures
static void test_pictures(skiatest::Reporter* reporter, sk_sp<SkPicture> p0, int count,
bool skipRoot) {
Context ctx;
if (skipRoot) {
ctx.fSkipMe = p0.get();
}
SkSerialProcs sprocs = makes(array_serial_proc, &ctx);
auto d0 = p0->serialize(&sprocs);
REPORTER_ASSERT(reporter, ctx.fArray.count() == count);
SkDeserialProcs dprocs = maked(array_deserial_proc, &ctx);
p0 = SkPicture::MakeFromData(d0.get(), &dprocs);
REPORTER_ASSERT(reporter, ctx.fArray.count() == 0);
}
示例2: test_serialize
static void test_serialize(skiatest::Reporter* r, sk_sp<SkColorSpace> space, bool isNamed) {
sk_sp<SkData> data1 = space->serialize();
size_t bytes = space->writeToMemory(nullptr);
sk_sp<SkData> data2 = SkData::MakeUninitialized(bytes);
space->writeToMemory(data2->writable_data());
sk_sp<SkColorSpace> newSpace1 = SkColorSpace::Deserialize(data1->data(), data1->size());
sk_sp<SkColorSpace> newSpace2 = SkColorSpace::Deserialize(data2->data(), data2->size());
if (isNamed) {
REPORTER_ASSERT(r, space.get() == newSpace1.get());
REPORTER_ASSERT(r, space.get() == newSpace2.get());
} else {
REPORTER_ASSERT(r, SkColorSpace::Equals(space.get(), newSpace1.get()));
REPORTER_ASSERT(r, SkColorSpace::Equals(space.get(), newSpace2.get()));
}
}