本文整理汇总了C++中GrTexture::origin方法的典型用法代码示例。如果您正苦于以下问题:C++ GrTexture::origin方法的具体用法?C++ GrTexture::origin怎么用?C++ GrTexture::origin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GrTexture
的用法示例。
在下文中一共展示了GrTexture::origin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setData
void GrGLDisplacementMapEffect::setData(const GrGLProgramDataManager& pdman,
const GrProcessor& proc) {
const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMapEffect>();
GrTexture* colorTex = displacementMap.texture(1);
SkScalar scaleX = SkScalarDiv(displacementMap.scale().fX, SkIntToScalar(colorTex->width()));
SkScalar scaleY = SkScalarDiv(displacementMap.scale().fY, SkIntToScalar(colorTex->height()));
pdman.set2f(fScaleUni, SkScalarToFloat(scaleX),
colorTex->origin() == kTopLeft_GrSurfaceOrigin ?
SkScalarToFloat(scaleY) : SkScalarToFloat(-scaleY));
fGLDomain.setData(pdman, displacementMap.domain(), colorTex->origin());
}
示例2: SkCrossContextImageData
std::unique_ptr<SkCrossContextImageData> SkCrossContextImageData::MakeFromEncoded(
GrContext* context, sk_sp<SkData> encoded, SkColorSpace* dstColorSpace) {
sk_sp<SkImage> codecImage = SkImage::MakeFromEncoded(std::move(encoded));
if (!codecImage) {
return nullptr;
}
// Some backends or drivers don't support (safely) moving resources between contexts
if (!context->caps()->crossContextTextureSupport()) {
return std::unique_ptr<SkCrossContextImageData>(
new SkCrossContextImageData(std::move(codecImage)));
}
sk_sp<SkImage> textureImage = codecImage->makeTextureImage(context, dstColorSpace);
if (!textureImage) {
// TODO: Force decode to raster here? Do mip-mapping, like getDeferredTextureImageData?
return std::unique_ptr<SkCrossContextImageData>(
new SkCrossContextImageData(std::move(codecImage)));
}
// Crack open the gpu image, extract the backend data, stick it in the SkCCID
GrTexture* texture = as_IB(textureImage)->peekTexture();
SkASSERT(texture);
GrBackendTextureDesc desc;
desc.fFlags = kNone_GrBackendTextureFlag;
desc.fOrigin = texture->origin();
desc.fWidth = texture->width();
desc.fHeight = texture->height();
desc.fConfig = texture->config();
desc.fSampleCnt = 0;
context->contextPriv().prepareSurfaceForExternalIO(as_IB(textureImage)->peekProxy());
auto textureData = texture->texturePriv().detachBackendTexture();
SkASSERT(textureData);
SkImageInfo info = as_IB(textureImage)->onImageInfo();
return std::unique_ptr<SkCrossContextImageData>(new SkCrossContextImageData(
desc, std::move(textureData), info.alphaType(), info.refColorSpace()));
}