本文整理汇总了C++中SkIRect::offsetTo方法的典型用法代码示例。如果您正苦于以下问题:C++ SkIRect::offsetTo方法的具体用法?C++ SkIRect::offsetTo怎么用?C++ SkIRect::offsetTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkIRect
的用法示例。
在下文中一共展示了SkIRect::offsetTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clip
//.........这里部分代码省略.........
GrTextureDomain::kDecal_Mode,
GrTextureParams::kBilerp_FilterMode));
paint.addColorFragmentProcessor(std::move(fp));
srcRect.offset(-srcOffset);
srcOffset.set(0, 0);
} else {
GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
paint.addColorTextureProcessor(srcTexture.get(), nullptr, matrix, params);
}
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
shrink_irect_by_2(&dstRect, i < scaleFactorX, i < scaleFactorY);
dstDrawContext->fillRectToRect(clip, paint, SkMatrix::I(),
SkRect::Make(dstRect), SkRect::Make(srcRect));
srcDrawContext = dstDrawContext;
srcRect = dstRect;
srcTexture = srcDrawContext->asTexture();
dstDrawContext.swap(tmpDrawContext);
localSrcBounds = srcRect;
}
srcRect = localDstBounds;
scale_irect_roundout(&srcRect, 1.0f / scaleFactorX, 1.0f / scaleFactorY);
if (sigmaX > 0.0f) {
if (scaleFactorX > 1) {
SkASSERT(srcDrawContext);
// Clear out a radius to the right of the srcRect to prevent the
// X convolution from reading garbage.
clearRect = SkIRect::MakeXYWH(srcRect.fRight, srcRect.fTop,
radiusX, srcRect.height());
srcDrawContext->clear(&clearRect, 0x0, false);
}
convolve_gaussian(dstDrawContext.get(), clip, srcRect,
srcTexture.get(), Gr1DKernelEffect::kX_Direction, radiusX, sigmaX,
srcBounds, srcOffset);
srcDrawContext = dstDrawContext;
srcTexture = srcDrawContext->asTexture();
srcRect.offsetTo(0, 0);
dstDrawContext.swap(tmpDrawContext);
localSrcBounds = srcRect;
srcOffset.set(0, 0);
}
if (sigmaY > 0.0f) {
if (scaleFactorY > 1 || sigmaX > 0.0f) {
SkASSERT(srcDrawContext);
// Clear out a radius below the srcRect to prevent the Y
// convolution from reading garbage.
clearRect = SkIRect::MakeXYWH(srcRect.fLeft, srcRect.fBottom,
srcRect.width(), radiusY);
srcDrawContext->clear(&clearRect, 0x0, false);
}
convolve_gaussian(dstDrawContext.get(), clip, srcRect,
srcTexture.get(), Gr1DKernelEffect::kY_Direction, radiusY, sigmaY,
srcBounds, srcOffset);
srcDrawContext = dstDrawContext;
srcRect.offsetTo(0, 0);
dstDrawContext.swap(tmpDrawContext);
}
SkASSERT(srcDrawContext);
srcTexture = nullptr; // we don't use this from here on out
if (scaleFactorX > 1 || scaleFactorY > 1) {
// Clear one pixel to the right and below, to accommodate bilinear upsampling.
clearRect = SkIRect::MakeXYWH(srcRect.fLeft, srcRect.fBottom, srcRect.width() + 1, 1);
srcDrawContext->clear(&clearRect, 0x0, false);
clearRect = SkIRect::MakeXYWH(srcRect.fRight, srcRect.fTop, 1, srcRect.height());
srcDrawContext->clear(&clearRect, 0x0, false);
SkMatrix matrix;
matrix.setIDiv(srcDrawContext->width(), srcDrawContext->height());
GrPaint paint;
paint.setGammaCorrect(dstDrawContext->isGammaCorrect());
// FIXME: this should be mitchell, not bilinear.
GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
sk_sp<GrTexture> tex(srcDrawContext->asTexture());
paint.addColorTextureProcessor(tex.get(), nullptr, matrix, params);
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
SkIRect dstRect(srcRect);
scale_irect(&dstRect, scaleFactorX, scaleFactorY);
dstDrawContext->fillRectToRect(clip, paint, SkMatrix::I(),
SkRect::Make(dstRect), SkRect::Make(srcRect));
srcDrawContext = dstDrawContext;
srcRect = dstRect;
dstDrawContext.swap(tmpDrawContext);
}
return srcDrawContext;
}