本文整理汇总了C++中SkDevice::unref方法的典型用法代码示例。如果您正苦于以下问题:C++ SkDevice::unref方法的具体用法?C++ SkDevice::unref怎么用?C++ SkDevice::unref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkDevice
的用法示例。
在下文中一共展示了SkDevice::unref方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
~DeviceCM() {
if (NULL != fDevice) {
fDevice->unlockPixels();
fDevice->unref();
}
SkDELETE(fPaint);
}
示例2: INHERITED
TiledPipeController::TiledPipeController(const SkBitmap& bitmap,
const SkMatrix* initial)
: INHERITED(NULL) {
int32_t top = 0;
int32_t bottom;
int32_t height = bitmap.height() / NumberOfTiles;
SkIRect rect;
for (int i = 0; i < NumberOfTiles; i++) {
bottom = i + 1 == NumberOfTiles ? bitmap.height() : top + height;
rect.setLTRB(0, top, bitmap.width(), bottom);
top = bottom;
bool extracted = bitmap.extractSubset(&fBitmaps[i], rect);
SkASSERT(extracted);
SkDevice* device = new SkDevice(fBitmaps[i]);
SkCanvas* canvas = new SkCanvas(device);
device->unref();
if (initial != NULL) {
canvas->setMatrix(*initial);
}
canvas->translate(SkIntToScalar(-rect.left()),
SkIntToScalar(-rect.top()));
if (0 == i) {
fReader.setCanvas(canvas);
} else {
fReaders[i - 1].setCanvas(canvas);
}
canvas->unref();
}
}
示例3: createBitmap
static SkBitmap createBitmap(const SkPath& path) {
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config,
SkImageWidget::kImageWidgetWidth,
SkImageWidget::kImageWidgetHeight);
bitmap.allocPixels();
bitmap.eraseColor(SK_ColorWHITE);
SkDevice* device = new SkDevice(bitmap);
SkCanvas canvas(device);
device->unref();
const SkRect& bounds = path.getBounds();
if (bounds.width() > bounds.height()) {
canvas.scale(SkDoubleToScalar((0.9*SkImageWidget::kImageWidgetWidth)/bounds.width()),
SkDoubleToScalar((0.9*SkImageWidget::kImageWidgetHeight)/bounds.width()));
} else {
canvas.scale(SkDoubleToScalar((0.9*SkImageWidget::kImageWidgetWidth)/bounds.height()),
SkDoubleToScalar((0.9*SkImageWidget::kImageWidgetHeight)/bounds.height()));
}
canvas.translate(-bounds.fLeft+2, -bounds.fTop+2);
SkPaint p;
p.setColor(SK_ColorBLACK);
p.setStyle(SkPaint::kStroke_Style);
canvas.drawPath(path, p);
return bitmap;
}
示例4: make_bitmap
static void make_bitmap(SkBitmap* bitmap, GrContext* ctx, SkIRect* center) {
SkDevice* dev;
const int kFixed = 28;
const int kStretchy = 8;
const int kSize = 2*kFixed + kStretchy;
#if SK_SUPPORT_GPU
if (ctx) {
dev = new SkGpuDevice(ctx, SkBitmap::kARGB_8888_Config, kSize, kSize);
*bitmap = dev->accessBitmap(false);
} else
#endif
{
bitmap->setConfig(SkBitmap::kARGB_8888_Config, kSize, kSize);
bitmap->allocPixels();
dev = new SkDevice(*bitmap);
}
SkCanvas canvas(dev);
dev->unref();
canvas.clear(SK_ColorTRANSPARENT);
SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize));
const SkScalar strokeWidth = SkIntToScalar(6);
const SkScalar radius = SkIntToScalar(kFixed) - strokeWidth/2;
center->setXYWH(kFixed, kFixed, kStretchy, kStretchy);
SkPaint paint;
paint.setAntiAlias(true);
paint.setColor(0xFFFF0000);
canvas.drawRoundRect(r, radius, radius, paint);
r.setXYWH(SkIntToScalar(kFixed), 0, SkIntToScalar(kStretchy), SkIntToScalar(kSize));
paint.setColor(0x8800FF00);
canvas.drawRect(r, paint);
r.setXYWH(0, SkIntToScalar(kFixed), SkIntToScalar(kSize), SkIntToScalar(kStretchy));
paint.setColor(0x880000FF);
canvas.drawRect(r, paint);
}