本文整理汇总了C++中SkWriteBuffer::writeToMemory方法的典型用法代码示例。如果您正苦于以下问题:C++ SkWriteBuffer::writeToMemory方法的具体用法?C++ SkWriteBuffer::writeToMemory怎么用?C++ SkWriteBuffer::writeToMemory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkWriteBuffer
的用法示例。
在下文中一共展示了SkWriteBuffer::writeToMemory方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allocNextContext
// Return the context associated with the next logical typeface, or NULL if
// there are no more entries in the fallback chain.
SkScalerContext* SkScalerContext::allocNextContext() const {
#ifdef SK_BUILD_FOR_ANDROID
SkTypeface* newFace = SkAndroidNextLogicalTypeface(fRec.fFontID,
fRec.fOrigFontID,
fPaintOptionsAndroid);
if (0 == newFace) {
return NULL;
}
SkAutoTUnref<SkTypeface> aur(newFace);
uint32_t newFontID = newFace->uniqueID();
SkWriteBuffer androidBuffer;
fPaintOptionsAndroid.flatten(androidBuffer);
SkAutoDescriptor ad(sizeof(fRec) + androidBuffer.bytesWritten()
+ SkDescriptor::ComputeOverhead(2));
SkDescriptor* desc = ad.getDesc();
desc->init();
SkScalerContext::Rec* newRec =
(SkScalerContext::Rec*)desc->addEntry(kRec_SkDescriptorTag,
sizeof(fRec), &fRec);
androidBuffer.writeToMemory(desc->addEntry(kAndroidOpts_SkDescriptorTag,
androidBuffer.bytesWritten(), NULL));
newRec->fFontID = newFontID;
desc->computeChecksum();
return newFace->createScalerContext(desc);
#else
return NULL;
#endif
}
示例2: SkValidatingSerializeFlattenable
SkData* SkValidatingSerializeFlattenable(SkFlattenable* flattenable) {
SkWriteBuffer writer;
writer.writeFlattenable(flattenable);
size_t size = writer.bytesWritten();
auto data = SkData::MakeUninitialized(size);
writer.writeToMemory(data->writable_data());
return data.release();
}
示例3: rb
static sk_sp<SkColorFilter> reincarnate_colorfilter(SkFlattenable* obj) {
SkWriteBuffer wb;
wb.writeFlattenable(obj);
size_t size = wb.bytesWritten();
SkAutoSMalloc<1024> storage(size);
// make a copy into storage
wb.writeToMemory(storage.get());
SkReadBuffer rb(storage.get(), size);
return rb.readColorFilter();
}
示例4: shuttleBitmap
bool SkGPipeCanvas::shuttleBitmap(const SkBitmap& bm, int32_t slot) {
SkASSERT(shouldFlattenBitmaps(fFlags));
SkWriteBuffer buffer;
buffer.setNamedFactoryRecorder(fFactorySet);
buffer.writeBitmap(bm);
this->flattenFactoryNames();
size_t size = buffer.bytesWritten();
if (this->needOpBytes(size)) {
this->writeOp(kDef_Bitmap_DrawOp, 0, slot);
void* dst = static_cast<void*>(fWriter.reserve(size));
buffer.writeToMemory(dst);
return true;
}
return false;
}
示例5: flatten
static void flatten(const SkFlattenable* flattenable, Json::Value* target, bool sendBinaries) {
if (sendBinaries) {
SkWriteBuffer buffer;
flattenable->flatten(buffer);
void* data = sk_malloc_throw(buffer.bytesWritten());
buffer.writeToMemory(data);
Json::Value bytes;
encode_data(data, buffer.bytesWritten(), &bytes);
Json::Value jsonFlattenable;
jsonFlattenable[SKJSONCANVAS_ATTRIBUTE_NAME] = Json::Value(flattenable->getTypeName());
jsonFlattenable[SKJSONCANVAS_ATTRIBUTE_BYTES] = bytes;
(*target) = jsonFlattenable;
free(data);
}
else {
(*target)[SKJSONCANVAS_ATTRIBUTE_DESCRIPTION] = Json::Value(flattenable->getTypeName());
}
}