本文整理汇总了C++中SkPaint::computeFastBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPaint::computeFastBounds方法的具体用法?C++ SkPaint::computeFastBounds怎么用?C++ SkPaint::computeFastBounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPaint
的用法示例。
在下文中一共展示了SkPaint::computeFastBounds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw_savelayer_with_paint
static void draw_savelayer_with_paint(const SkIPoint& off,
SkCanvas* canvas,
const SkPaint& p) {
SkPaint redStroked;
redStroked.setColor(SK_ColorRED);
redStroked.setStyle(SkPaint::kStroke_Style);
SkPaint blueStroked;
blueStroked.setColor(SK_ColorBLUE);
blueStroked.setStyle(SkPaint::kStroke_Style);
const SkRect bounds = SkRect::MakeWH(10, 10);
SkRect storage;
canvas->save();
canvas->translate(30, 30);
canvas->translate(SkIntToScalar(off.fX), SkIntToScalar(off.fY));
canvas->scale(1.5f, 1.5f);
const SkRect& fastBound = p.computeFastBounds(bounds, &storage);
canvas->saveLayer(&fastBound, &p);
canvas->restore();
canvas->drawRect(bounds, redStroked);
canvas->drawRect(fastBound, blueStroked);
canvas->restore();
}
示例2: draw_geom_with_paint
static void draw_geom_with_paint(drawMth draw, const SkIPoint& off,
SkCanvas* canvas, const SkPaint& p) {
SkPaint redStroked;
redStroked.setColor(SK_ColorRED);
redStroked.setStyle(SkPaint::kStroke_Style);
SkPaint blueStroked;
blueStroked.setColor(SK_ColorBLUE);
blueStroked.setStyle(SkPaint::kStroke_Style);
const SkRect r = SkRect::MakeLTRB(20, 20, 30, 30);
SkRect storage;
canvas->save();
canvas->translate(SkIntToScalar(off.fX), SkIntToScalar(off.fY));
canvas->scale(1.5f, 1.5f);
const SkRect& fastBound = p.computeFastBounds(r, &storage);
canvas->save();
canvas->clipRect(fastBound);
(*draw)(canvas, r, p);
canvas->restore();
canvas->drawRect(r, redStroked);
canvas->drawRect(fastBound, blueStroked);
canvas->restore();
}
示例3: 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
示例4: computeFontMetricsTopBottom
// Return fontmetrics.fTop,fBottom in topbot[0,1], after they have been
// tweaked by paint.computeFastBounds().
//
static void computeFontMetricsTopBottom(const SkPaint& paint, SkScalar topbot[2]) {
SkPaint::FontMetrics metrics;
paint.getFontMetrics(&metrics);
SkRect bounds;
// construct a rect so we can see any adjustments from the paint.
// we use 0,1 for left,right, just so the rect isn't empty
bounds.set(0, metrics.fTop, SK_Scalar1, metrics.fBottom);
(void)paint.computeFastBounds(bounds, &bounds);
topbot[0] = bounds.fTop;
topbot[1] = bounds.fBottom;
}
示例5: addFontMetricsTopBottom
void SkPictureRecord::addFontMetricsTopBottom(const SkPaint& paint,
SkScalar baselineY) {
SkPaint::FontMetrics metrics;
paint.getFontMetrics(&metrics);
SkRect bounds;
// construct a rect so we can see any adjustments from the paint.
// we use 0,1 for left,right, just so the rect isn't empty
bounds.set(0, metrics.fTop + baselineY,
SK_Scalar1, metrics.fBottom + baselineY);
(void)paint.computeFastBounds(bounds, &bounds);
// now record the top and bottom
addScalar(bounds.fTop);
addScalar(bounds.fBottom);
}