本文整理汇总了C++中SkRect::makeOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ SkRect::makeOffset方法的具体用法?C++ SkRect::makeOffset怎么用?C++ SkRect::makeOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkRect
的用法示例。
在下文中一共展示了SkRect::makeOffset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onDraw
void onDraw(SkCanvas* canvas) override {
if (NULL == fBitmap.pixelRef()) {
fImage.reset(make_image(canvas, &fCenter));
image_to_bitmap(fImage, &fBitmap);
}
// amount of bm that should not be stretched (unless we have to)
const SkScalar fixed = SkIntToScalar(fBitmap.width() - fCenter.width());
const SkTSize<SkScalar> size[] = {
{ fixed * 4 / 5, fixed * 4 / 5 }, // shrink in both axes
{ fixed * 4 / 5, fixed * 4 }, // shrink in X
{ fixed * 4, fixed * 4 / 5 }, // shrink in Y
{ fixed * 4, fixed * 4 }
};
canvas->drawBitmap(fBitmap, 10, 10, NULL);
SkScalar x = SkIntToScalar(100);
SkScalar y = SkIntToScalar(100);
SkPaint paint;
paint.setFilterQuality(kLow_SkFilterQuality);
for (int iy = 0; iy < 2; ++iy) {
for (int ix = 0; ix < 2; ++ix) {
int i = ix * 2 + iy;
SkRect r = SkRect::MakeXYWH(x + ix * fixed, y + iy * fixed,
size[i].width(), size[i].height());
canvas->drawBitmapNine(fBitmap, fCenter, r, &paint);
canvas->drawImageNine(fImage, fCenter, r.makeOffset(360, 0), &paint);
}
}
}
示例2: quickContains
bool GrClipStackClip::quickContains(const SkRect& rect) const {
if (!fStack) {
return true;
}
return fStack->quickContains(rect.makeOffset(SkIntToScalar(fOrigin.x()),
SkIntToScalar(fOrigin.y())));
}
示例3: onDraw
void onDraw(int loops, SkCanvas* canvas) override {
SkRect rect = SkRect::MakeWH(fDstRectSize, fDstRectSize);
SkPaint paint;
paint.setAlpha(0x40);
paint.setFilterQuality(kLow_SkFilterQuality);
paint.setAntiAlias(fAA);
for (int i = 0; i < loops; i++) {
for (int j = 0; j < kNumImages; ++j) {
SkVector translate = this->translation(i * kNumImages + j);
canvas->drawImageRect(fImages[j].get(), rect.makeOffset(translate.fX, translate.fY),
&paint);
}
// Prevent any batching except without multitexturing since we're trying to measure
// drawing distinct images and just repeating images here to increase the workload for
// timing reasons.
canvas->flush();
}
}
示例4: onDrawContent
void onDrawContent(SkCanvas* canvas) override {
const SkRect oval = fOval.makeOffset(fCenter.fX - fOval.centerX(),
fCenter.fY - fOval.centerY());
SkPaint p;
p.setAntiAlias(true);
p.setStyle(SkPaint::kStroke_Style);
canvas->drawOval(oval, p);
const SkRect r = SkRect::MakeLTRB(200, 200, 300, 300);
canvas->clipRect(r);
p.setStyle(SkPaint::kFill_Style);
p.setColor(SK_ColorRED);
canvas->drawRect(r, p);
p.setColor(0x800000FF);
canvas->drawOval(oval, p);
}