本文整理汇总了C++中SkAutoTUnref::setAllowSoftClip方法的典型用法代码示例。如果您正苦于以下问题:C++ SkAutoTUnref::setAllowSoftClip方法的具体用法?C++ SkAutoTUnref::setAllowSoftClip怎么用?C++ SkAutoTUnref::setAllowSoftClip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkAutoTUnref
的用法示例。
在下文中一共展示了SkAutoTUnref::setAllowSoftClip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupCanvas
SkCanvas* PictureRenderer::setupCanvas(int width, int height) {
SkAutoTUnref<SkCanvas> canvas;
switch(fDeviceType) {
case kBitmap_DeviceType: {
SkBitmap bitmap;
sk_tools::setup_bitmap(&bitmap, width, height);
canvas.reset(SkNEW_ARGS(SkCanvas, (bitmap)));
}
break;
#if SK_SUPPORT_GPU
#if SK_ANGLE
case kAngle_DeviceType:
// fall through
#endif
#if SK_MESA
case kMesa_DeviceType:
// fall through
#endif
case kGPU_DeviceType:
case kNVPR_DeviceType: {
SkAutoTUnref<GrSurface> target;
if (fGrContext) {
// create a render target to back the device
GrSurfaceDesc desc;
desc.fConfig = kSkia8888_GrPixelConfig;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
desc.fWidth = width;
desc.fHeight = height;
desc.fSampleCnt = fSampleCount;
target.reset(fGrContext->textureProvider()->createTexture(desc, false, NULL, 0));
}
uint32_t flags = fUseDFText ? SkSurfaceProps::kUseDistanceFieldFonts_Flag : 0;
SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
SkAutoTUnref<SkGpuDevice> device(
SkGpuDevice::Create(target->asRenderTarget(), &props,
SkGpuDevice::kUninit_InitContents));
if (!device) {
return NULL;
}
canvas.reset(SkNEW_ARGS(SkCanvas, (device)));
break;
}
#endif
default:
SkASSERT(0);
return NULL;
}
if (fHasDrawFilters) {
if (fDrawFilters[0] & PictureRenderer::kAAClip_DrawFilterFlag) {
canvas->setAllowSoftClip(false);
}
canvas.reset(SkNEW_ARGS(FlagsFilterCanvas, (canvas.get(), fDrawFilters)));
}
this->scaleToScaleFactor(canvas);
// Pictures often lie about their extent (i.e., claim to be 100x100 but
// only ever draw to 90x100). Clear here so the undrawn portion will have
// a consistent color
canvas->clear(SK_ColorTRANSPARENT);
return canvas.detach();
}