本文整理汇总了C++中SkPaint::canComputeFastBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPaint::canComputeFastBounds方法的具体用法?C++ SkPaint::canComputeFastBounds怎么用?C++ SkPaint::canComputeFastBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPaint
的用法示例。
在下文中一共展示了SkPaint::canComputeFastBounds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: didDrawPoints
void OpaqueRegionSkia::didDrawPoints(const GraphicsContext* context, SkCanvas::PointMode mode, int numPoints, const SkPoint points[], const SkPaint& paint)
{
if (!numPoints)
return;
SkRect rect;
rect.fLeft = points[0].fX;
rect.fRight = points[0].fX + 1;
rect.fTop = points[0].fY;
rect.fBottom = points[0].fY + 1;
for (int i = 1; i < numPoints; ++i) {
rect.fLeft = std::min(rect.fLeft, points[i].fX);
rect.fRight = std::max(rect.fRight, points[i].fX + 1);
rect.fTop = std::min(rect.fTop, points[i].fY);
rect.fBottom = std::max(rect.fBottom, points[i].fY + 1);
}
bool fillsBounds = false;
if (!paint.canComputeFastBounds())
didDrawUnbounded(context, paint, FillOrStroke);
else {
rect = paint.computeFastBounds(rect, &rect);
didDraw(context, rect, paint, 0, fillsBounds, FillOrStroke);
}
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:27,代码来源:OpaqueRegionSkia.cpp
示例2: drawPosTextH
void SkPictureRecord::drawPosTextH(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY,
const SkPaint& paint) {
size_t points = paint.countText(text, byteLength);
if (0 == points)
return;
bool fast = paint.canComputeFastBounds();
addDraw(fast ? DRAW_POS_TEXT_H_TOP_BOTTOM : DRAW_POS_TEXT_H);
addPaint(paint);
addText(text, byteLength);
addInt(points);
#ifdef SK_DEBUG_SIZE
size_t start = fWriter.size();
#endif
if (fast) {
addFontMetricsTopBottom(paint, constY);
}
addScalar(constY);
fWriter.writeMul4(xpos, points * sizeof(SkScalar));
#ifdef SK_DEBUG_SIZE
fPointBytes += fWriter.size() - start;
fPointWrites += points;
#endif
validate();
}
示例3: drawPosText
void SkPictureRecord::drawPosText(const void* text, size_t byteLength,
const SkPoint pos[], const SkPaint& paint) {
size_t points = paint.countText(text, byteLength);
if (0 == points)
return;
bool canUseDrawH = true;
// check if the caller really should have used drawPosTextH()
{
const SkScalar firstY = pos[0].fY;
for (size_t index = 1; index < points; index++) {
if (pos[index].fY != firstY) {
canUseDrawH = false;
break;
}
}
}
bool fast = canUseDrawH && paint.canComputeFastBounds();
if (fast) {
addDraw(DRAW_POS_TEXT_H_TOP_BOTTOM);
} else {
addDraw(canUseDrawH ? DRAW_POS_TEXT_H : DRAW_POS_TEXT);
}
addPaint(paint);
addText(text, byteLength);
addInt(points);
#ifdef SK_DEBUG_SIZE
size_t start = fWriter.size();
#endif
if (canUseDrawH) {
if (fast) {
addFontMetricsTopBottom(paint, pos[0].fY);
}
addScalar(pos[0].fY);
SkScalar* xptr = (SkScalar*)fWriter.reserve(points * sizeof(SkScalar));
for (size_t index = 0; index < points; index++)
*xptr++ = pos[index].fX;
}
else {
fWriter.writeMul4(pos, points * sizeof(SkPoint));
}
#ifdef SK_DEBUG_SIZE
fPointBytes += fWriter.size() - start;
fPointWrites += points;
#endif
validate();
}
示例4: drawText
void SkPictureRecord::drawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint) {
bool fast = paint.canComputeFastBounds();
addDraw(fast ? DRAW_TEXT_TOP_BOTTOM : DRAW_TEXT);
addPaint(paint);
addText(text, byteLength);
addScalar(x);
addScalar(y);
if (fast) {
addFontMetricsTopBottom(paint, y);
}
validate();
}