本文整理汇总了C++中SkIRect::is16Bit方法的典型用法代码示例。如果您正苦于以下问题:C++ SkIRect::is16Bit方法的具体用法?C++ SkIRect::is16Bit怎么用?C++ SkIRect::is16Bit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkIRect
的用法示例。
在下文中一共展示了SkIRect::is16Bit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMetrics
void SkScalerContext::getMetrics(SkGlyph* glyph) {
this->getGlyphContext(*glyph)->generateMetrics(glyph);
// for now we have separate cache entries for devkerning on and off
// in the future we might share caches, but make our measure/draw
// code make the distinction. Thus we zap the values if the caller
// has not asked for them.
if ((fRec.fFlags & SkScalerContext::kDevKernText_Flag) == 0) {
// no devkern, so zap the fields
glyph->fLsbDelta = glyph->fRsbDelta = 0;
}
// if either dimension is empty, zap the image bounds of the glyph
if (0 == glyph->fWidth || 0 == glyph->fHeight) {
glyph->fWidth = 0;
glyph->fHeight = 0;
glyph->fTop = 0;
glyph->fLeft = 0;
glyph->fMaskFormat = 0;
return;
}
if (fRec.fFrameWidth > 0 || fPathEffect != NULL || fRasterizer != NULL) {
SkPath devPath, fillPath;
SkMatrix fillToDevMatrix;
this->internalGetPath(*glyph, &fillPath, &devPath, &fillToDevMatrix);
if (fRasterizer) {
SkMask mask;
if (fRasterizer->rasterize(fillPath, fillToDevMatrix, NULL,
fMaskFilter, &mask,
SkMask::kJustComputeBounds_CreateMode)) {
glyph->fLeft = mask.fBounds.fLeft;
glyph->fTop = mask.fBounds.fTop;
glyph->fWidth = SkToU16(mask.fBounds.width());
glyph->fHeight = SkToU16(mask.fBounds.height());
} else {
goto SK_ERROR;
}
} else {
// just use devPath
SkIRect ir;
devPath.getBounds().roundOut(&ir);
if (ir.isEmpty() || !ir.is16Bit()) {
goto SK_ERROR;
}
glyph->fLeft = ir.fLeft;
glyph->fTop = ir.fTop;
glyph->fWidth = SkToU16(ir.width());
glyph->fHeight = SkToU16(ir.height());
}
}
if (SkMask::kARGB32_Format != glyph->fMaskFormat) {
glyph->fMaskFormat = fRec.fMaskFormat;
}
if (fMaskFilter) {
SkMask src, dst;
SkMatrix matrix;
glyph->toMask(&src);
fRec.getMatrixFrom2x2(&matrix);
src.fImage = NULL; // only want the bounds from the filter
if (fMaskFilter->filterMask(&dst, src, matrix, NULL)) {
SkASSERT(dst.fImage == NULL);
glyph->fLeft = dst.fBounds.fLeft;
glyph->fTop = dst.fBounds.fTop;
glyph->fWidth = SkToU16(dst.fBounds.width());
glyph->fHeight = SkToU16(dst.fBounds.height());
glyph->fMaskFormat = dst.fFormat;
}
}
return;
SK_ERROR:
// draw nothing 'cause we failed
glyph->fLeft = 0;
glyph->fTop = 0;
glyph->fWidth = 0;
glyph->fHeight = 0;
// put a valid value here, in case it was earlier set to
// MASK_FORMAT_JUST_ADVANCE
glyph->fMaskFormat = fRec.fMaskFormat;
}