当前位置: 首页>>代码示例>>C++>>正文


C++ SkWriteBuffer::writeToMemory方法代码示例

本文整理汇总了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
}
开发者ID:Tkkg1994,项目名称:Platfrom-kccat6,代码行数:36,代码来源:SkScalerContext.cpp

示例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();
}
开发者ID:BertiKarsunke,项目名称:skia,代码行数:8,代码来源:SkFlattenableSerialization.cpp

示例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();
}
开发者ID:zwdsjl,项目名称:skia,代码行数:12,代码来源:ColorFilterTest.cpp

示例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;
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:15,代码来源:SkGPipeWrite.cpp

示例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());
    }
}
开发者ID:atyenoria,项目名称:skia,代码行数:18,代码来源:SkJSONCanvas.cpp


注:本文中的SkWriteBuffer::writeToMemory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。