本文整理汇总了C++中sk_sp::config方法的典型用法代码示例。如果您正苦于以下问题:C++ sk_sp::config方法的具体用法?C++ sk_sp::config怎么用?C++ sk_sp::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sk_sp
的用法示例。
在下文中一共展示了sk_sp::config方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: samplerState
sk_sp<GrTextureProxy> GrTextureProducer::CopyOnGpu(GrContext* context,
sk_sp<GrTextureProxy> inputProxy,
const CopyParams& copyParams,
bool dstWillRequireMipMaps) {
SkASSERT(context);
const SkRect dstRect = SkRect::MakeIWH(copyParams.fWidth, copyParams.fHeight);
GrMipMapped mipMapped = dstWillRequireMipMaps ? GrMipMapped::kYes : GrMipMapped::kNo;
sk_sp<SkColorSpace> colorSpace;
if (GrPixelConfigIsSRGB(inputProxy->config())) {
colorSpace = SkColorSpace::MakeSRGB();
}
sk_sp<GrRenderTargetContext> copyRTC =
context->contextPriv().makeDeferredRenderTargetContextWithFallback(
SkBackingFit::kExact, dstRect.width(), dstRect.height(), inputProxy->config(),
std::move(colorSpace), 1, mipMapped, inputProxy->origin());
if (!copyRTC) {
return nullptr;
}
GrPaint paint;
paint.setGammaCorrect(true);
SkRect localRect = SkRect::MakeWH(inputProxy->width(), inputProxy->height());
bool needsDomain = false;
if (copyParams.fFilter != GrSamplerState::Filter::kNearest) {
bool resizing = localRect.width() != dstRect.width() ||
localRect.height() != dstRect.height();
needsDomain = resizing && !GrProxyProvider::IsFunctionallyExact(inputProxy.get());
}
if (needsDomain) {
const SkRect domain = localRect.makeInset(0.5f, 0.5f);
// This would cause us to read values from outside the subset. Surely, the caller knows
// better!
SkASSERT(copyParams.fFilter != GrSamplerState::Filter::kMipMap);
paint.addColorFragmentProcessor(
GrTextureDomainEffect::Make(std::move(inputProxy), SkMatrix::I(), domain,
GrTextureDomain::kClamp_Mode, copyParams.fFilter));
} else {
GrSamplerState samplerState(GrSamplerState::WrapMode::kClamp, copyParams.fFilter);
paint.addColorTextureProcessor(std::move(inputProxy), SkMatrix::I(), samplerState);
}
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
copyRTC->fillRectToRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), dstRect,
localRect);
return copyRTC->asTextureProxyRef();
}
示例2: SkDEBUGFAIL
sk_sp<GrRenderTargetContext> GrDrawingManager::makeRenderTargetContext(
sk_sp<GrSurfaceProxy> sProxy,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps,
bool managedOpList) {
if (this->wasAbandoned() || !sProxy->asRenderTargetProxy()) {
return nullptr;
}
// SkSurface catches bad color space usage at creation. This check handles anything that slips
// by, including internal usage.
if (!SkSurface_Gpu::Valid(fContext, sProxy->config(), colorSpace.get())) {
SkDEBUGFAIL("Invalid config and colorspace combination");
return nullptr;
}
sk_sp<GrRenderTargetProxy> rtp(sk_ref_sp(sProxy->asRenderTargetProxy()));
return sk_sp<GrRenderTargetContext>(new GrRenderTargetContext(
fContext, this, std::move(rtp),
std::move(colorSpace),
surfaceProps,
fContext->contextPriv().getAuditTrail(),
fSingleOwner, managedOpList));
}
示例3: GrSurfaceContext
GrTextureContext::GrTextureContext(GrRecordingContext* context,
sk_sp<GrTextureProxy> textureProxy,
sk_sp<SkColorSpace> colorSpace)
: GrSurfaceContext(context, textureProxy->config(), std::move(colorSpace))
, fTextureProxy(std::move(textureProxy))
, fOpList(sk_ref_sp(fTextureProxy->getLastTextureOpList())) {
SkDEBUGCODE(this->validate();)
}
示例4: INHERITED
GrBicubicEffect::GrBicubicEffect(sk_sp<GrTextureProxy> proxy,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix &matrix,
const SkRect& domain)
: INHERITED(ModulationFlags(proxy->config()), proxy,
std::move(colorSpaceXform), matrix,
GrSamplerParams(SkShader::kClamp_TileMode, GrSamplerParams::kNone_FilterMode))
, fDomain(proxy.get(), domain, GrTextureDomain::kClamp_Mode) {
this->initClassID<GrBicubicEffect>();
}
示例5: INHERITED
GrBicubicEffect::GrBicubicEffect(sk_sp<GrTextureProxy> proxy,
const SkMatrix& matrix,
const SkRect& domain)
: INHERITED(kGrBicubicEffect_ClassID, ModulateByConfigOptimizationFlags(proxy->config()))
, fCoordTransform(matrix, proxy.get())
, fDomain(proxy.get(), domain, GrTextureDomain::kClamp_Mode)
, fTextureSampler(std::move(proxy)) {
this->addCoordTransform(&fCoordTransform);
this->setTextureSamplerCnt(1);
}
示例6: ModulateByConfigOptimizationFlags
GrBicubicEffect::GrBicubicEffect(sk_sp<GrTextureProxy> proxy,
const SkMatrix& matrix,
const GrSamplerState::WrapMode wrapModes[2])
: INHERITED{kGrBicubicEffect_ClassID, ModulateByConfigOptimizationFlags(proxy->config())}
, fCoordTransform(matrix, proxy.get())
, fDomain(GrTextureDomain::IgnoredDomain())
, fTextureSampler(std::move(proxy),
GrSamplerState(wrapModes, GrSamplerState::Filter::kNearest)) {
this->addCoordTransform(&fCoordTransform);
this->setTextureSamplerCnt(1);
}
示例7: INHERITED
GrTextureAdjuster::GrTextureAdjuster(GrContext* context, sk_sp<GrTextureProxy> original,
SkAlphaType alphaType,
uint32_t uniqueID,
SkColorSpace* cs)
: INHERITED(original->width(), original->height(),
GrPixelConfigIsAlphaOnly(original->config()))
, fContext(context)
, fOriginal(std::move(original))
, fAlphaType(alphaType)
, fColorSpace(cs)
, fUniqueID(uniqueID) {}
示例8: GrSamplerParams
GrBicubicEffect::GrBicubicEffect(sk_sp<GrTextureProxy> proxy,
sk_sp<GrColorSpaceXform> colorSpaceXform,
const SkMatrix &matrix,
const SkShader::TileMode tileModes[2])
: INHERITED{ModulationFlags(proxy->config()),
GR_PROXY_MOVE(proxy),
std::move(colorSpaceXform),
matrix,
GrSamplerParams(tileModes, GrSamplerParams::kNone_FilterMode)}
, fDomain(GrTextureDomain::IgnoredDomain()) {
this->initClassID<GrBicubicEffect>();
}
示例9: test_basic_draw_as_src
// skbug.com/5932
static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* context,
sk_sp<GrTextureProxy> rectProxy, uint32_t expectedPixelValues[]) {
sk_sp<GrRenderTargetContext> rtContext(context->contextPriv().makeDeferredRenderTargetContext(
SkBackingFit::kExact, rectProxy->width(),
rectProxy->height(), rectProxy->config(),
nullptr));
for (auto filter : {GrSamplerState::Filter::kNearest,
GrSamplerState::Filter::kBilerp,
GrSamplerState::Filter::kMipMap}) {
rtContext->clear(nullptr, 0xDDCCBBAA, GrRenderTargetContext::CanClearFullscreen::kYes);
auto fp = GrSimpleTextureEffect::Make(rectProxy, SkMatrix::I(), filter);
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));
rtContext->drawPaint(GrNoClip(), std::move(paint), SkMatrix::I());
test_read_pixels(reporter, rtContext.get(), expectedPixelValues,
"RectangleTexture-basic-draw");
}
}
示例10: INHERITED
GrMorphologyEffect::GrMorphologyEffect(sk_sp<GrTextureProxy> proxy,
Direction direction,
int radius,
Type type,
const float range[2])
: INHERITED(kGrMorphologyEffect_ClassID, ModulateByConfigOptimizationFlags(proxy->config()))
, fCoordTransform(proxy.get())
, fTextureSampler(std::move(proxy))
, fDirection(direction)
, fRadius(radius)
, fType(type)
, fUseRange(SkToBool(range)) {
this->addCoordTransform(&fCoordTransform);
this->setTextureSamplerCnt(1);
if (fUseRange) {
fRange[0] = range[0];
fRange[1] = range[1];
}
}
示例11: SkDEBUGFAIL
sk_sp<GrRenderTargetContext> GrDrawingManager::makeRenderTargetContext(
sk_sp<GrRenderTargetProxy> rtp,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps) {
if (this->wasAbandoned()) {
return nullptr;
}
// SkSurface catches bad color space usage at creation. This check handles anything that slips
// by, including internal usage. We allow a null color space here, for read/write pixels and
// other special code paths. If a color space is provided, though, enforce all other rules.
if (colorSpace && !SkSurface_Gpu::Valid(fContext, rtp->config(), colorSpace.get())) {
SkDEBUGFAIL("Invalid config and colorspace combination");
return nullptr;
}
bool useDIF = false;
if (surfaceProps) {
useDIF = surfaceProps->isUseDeviceIndependentFonts();
}
if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() &&
rtp->isStencilBufferMultisampled()) {
// TODO: defer stencil buffer attachment for PathRenderingDrawContext
sk_sp<GrRenderTarget> rt(sk_ref_sp(rtp->instantiate(fContext->textureProvider())));
GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAttachment(rt.get());
if (sb) {
return sk_sp<GrRenderTargetContext>(new GrPathRenderingRenderTargetContext(
fContext, this, std::move(rtp),
std::move(colorSpace), surfaceProps,
fContext->getAuditTrail(), fSingleOwner));
}
}
return sk_sp<GrRenderTargetContext>(new GrRenderTargetContext(fContext, this, std::move(rtp),
std::move(colorSpace),
surfaceProps,
fContext->getAuditTrail(),
fSingleOwner));
}