本文整理汇总了C++中SkWriteBuffer::writeTypeface方法的典型用法代码示例。如果您正苦于以下问题:C++ SkWriteBuffer::writeTypeface方法的具体用法?C++ SkWriteBuffer::writeTypeface怎么用?C++ SkWriteBuffer::writeTypeface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkWriteBuffer
的用法示例。
在下文中一共展示了SkWriteBuffer::writeTypeface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write_paint
/*
* Header:
* paint flags : 32
* non_def bits : 16
* xfermode enum : 8
* pad zeros : 8
*/
static void write_paint(SkWriteBuffer& writer, const SkPaint& paint, unsigned usage) {
uint32_t packedFlags = pack_paint_flags(paint.getFlags(), paint.getHinting(),
paint.getTextAlign(), paint.getFilterQuality(),
paint.getStyle(), paint.getStrokeCap(),
paint.getStrokeJoin(), paint.getTextEncoding());
writer.write32(packedFlags);
unsigned nondef = compute_nondef(paint, (PaintUsage)usage);
const uint8_t pad = 0;
writer.write32((nondef << 16) | ((unsigned)paint.getBlendMode() << 8) | pad);
CHECK_WRITE_SCALAR(writer, nondef, paint, TextSize);
CHECK_WRITE_SCALAR(writer, nondef, paint, TextScaleX);
CHECK_WRITE_SCALAR(writer, nondef, paint, TextSkewX);
CHECK_WRITE_SCALAR(writer, nondef, paint, StrokeWidth);
CHECK_WRITE_SCALAR(writer, nondef, paint, StrokeMiter);
if (nondef & kColor_NonDef) {
writer.write32(paint.getColor());
}
if (nondef & kTypeface_NonDef) {
// TODO: explore idea of writing bits indicating "use the prev (or prev N) face"
// e.g. 1-N bits is an index into a ring buffer of typefaces
SkTypeface* tf = paint.getTypeface();
SkASSERT(tf);
writer.writeTypeface(tf);
}
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, PathEffect);
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, Shader);
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, MaskFilter);
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, ColorFilter);
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, Rasterizer);
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, ImageFilter);
CHECK_WRITE_FLATTENABLE(writer, nondef, paint, DrawLooper);
}