Add SkColorSpace to GrDrawContext
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2164363002 Review-Url: https://codereview.chromium.org/2164363002
This commit is contained in:
parent
8602ede5fd
commit
dfe4f2e4fe
@ -36,7 +36,7 @@ protected:
|
|||||||
SkSurface* createSurface() override {
|
SkSurface* createSurface() override {
|
||||||
SkSurfaceProps props(INHERITED::getSurfaceProps());
|
SkSurfaceProps props(INHERITED::getSurfaceProps());
|
||||||
if (kGPU_DeviceType == fType) {
|
if (kGPU_DeviceType == fType) {
|
||||||
return SkSurface::MakeRenderTargetDirect(fRenderTarget, &props).release();
|
return SkSurface::MakeRenderTargetDirect(fRenderTarget, nullptr, &props).release();
|
||||||
}
|
}
|
||||||
static const SkImageInfo info = SkImageInfo::MakeN32Premul(
|
static const SkImageInfo info = SkImageInfo::MakeN32Premul(
|
||||||
SkScalarRoundToInt(this->width()), SkScalarRoundToInt(this->height()));
|
SkScalarRoundToInt(this->width()), SkScalarRoundToInt(this->height()));
|
||||||
|
@ -82,7 +82,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Return a new surface using the specified render target.
|
* Return a new surface using the specified render target.
|
||||||
*/
|
*/
|
||||||
static sk_sp<SkSurface> MakeRenderTargetDirect(GrRenderTarget*,
|
static sk_sp<SkSurface> MakeRenderTargetDirect(GrRenderTarget*, sk_sp<SkColorSpace> colorSpace,
|
||||||
const SkSurfaceProps* = nullptr);
|
const SkSurfaceProps* = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,7 +92,7 @@ public:
|
|||||||
* SkSurface.
|
* SkSurface.
|
||||||
*/
|
*/
|
||||||
static sk_sp<SkSurface> MakeFromBackendTexture(GrContext*, const GrBackendTextureDesc&,
|
static sk_sp<SkSurface> MakeFromBackendTexture(GrContext*, const GrBackendTextureDesc&,
|
||||||
const SkSurfaceProps*);
|
sk_sp<SkColorSpace>, const SkSurfaceProps*);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to wrap a pre-existing 3D API rendering target as a SkSurface. Skia will not assume
|
* Used to wrap a pre-existing 3D API rendering target as a SkSurface. Skia will not assume
|
||||||
@ -101,6 +101,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
static sk_sp<SkSurface> MakeFromBackendRenderTarget(GrContext*,
|
static sk_sp<SkSurface> MakeFromBackendRenderTarget(GrContext*,
|
||||||
const GrBackendRenderTargetDesc&,
|
const GrBackendRenderTargetDesc&,
|
||||||
|
sk_sp<SkColorSpace>,
|
||||||
const SkSurfaceProps*);
|
const SkSurfaceProps*);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,7 +113,28 @@ public:
|
|||||||
* SkSurface.
|
* SkSurface.
|
||||||
*/
|
*/
|
||||||
static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(
|
static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(
|
||||||
GrContext*, const GrBackendTextureDesc&, const SkSurfaceProps*);
|
GrContext*, const GrBackendTextureDesc&, sk_sp<SkColorSpace>, const SkSurfaceProps*);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Legacy versions of the above factories, without color space support. These create "legacy"
|
||||||
|
* surfaces that operate without gamma correction or color management.
|
||||||
|
*/
|
||||||
|
static sk_sp<SkSurface> MakeFromBackendTexture(GrContext* ctx, const GrBackendTextureDesc& desc,
|
||||||
|
const SkSurfaceProps* props) {
|
||||||
|
return MakeFromBackendTexture(ctx, desc, nullptr, props);
|
||||||
|
}
|
||||||
|
|
||||||
|
static sk_sp<SkSurface> MakeFromBackendRenderTarget(GrContext* ctx,
|
||||||
|
const GrBackendRenderTargetDesc& desc,
|
||||||
|
const SkSurfaceProps* props) {
|
||||||
|
return MakeFromBackendRenderTarget(ctx, desc, nullptr, props);
|
||||||
|
}
|
||||||
|
|
||||||
|
static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(
|
||||||
|
GrContext* ctx, const GrBackendTextureDesc& desc, const SkSurfaceProps* props) {
|
||||||
|
return MakeFromBackendTextureAsRenderTarget(ctx, desc, nullptr, props);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a new surface whose contents will be drawn to an offscreen
|
* Return a new surface whose contents will be drawn to an offscreen
|
||||||
@ -149,7 +171,7 @@ public:
|
|||||||
return NewRaster(SkImageInfo::MakeN32Premul(width, height), props);
|
return NewRaster(SkImageInfo::MakeN32Premul(width, height), props);
|
||||||
}
|
}
|
||||||
static SkSurface* NewRenderTargetDirect(GrRenderTarget* rt, const SkSurfaceProps* props) {
|
static SkSurface* NewRenderTargetDirect(GrRenderTarget* rt, const SkSurfaceProps* props) {
|
||||||
return MakeRenderTargetDirect(rt, props).release();
|
return MakeRenderTargetDirect(rt, nullptr, props).release();
|
||||||
}
|
}
|
||||||
static SkSurface* NewRenderTargetDirect(GrRenderTarget* target) {
|
static SkSurface* NewRenderTargetDirect(GrRenderTarget* target) {
|
||||||
return NewRenderTargetDirect(target, NULL);
|
return NewRenderTargetDirect(target, NULL);
|
||||||
|
@ -189,7 +189,8 @@ public:
|
|||||||
*
|
*
|
||||||
* @return a draw context
|
* @return a draw context
|
||||||
*/
|
*/
|
||||||
sk_sp<GrDrawContext> drawContext(sk_sp<GrRenderTarget> rt, const SkSurfaceProps* = nullptr);
|
sk_sp<GrDrawContext> drawContext(sk_sp<GrRenderTarget> rt, sk_sp<SkColorSpace> colorSpace,
|
||||||
|
const SkSurfaceProps* = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create both a GrRenderTarget and a matching GrDrawContext to wrap it.
|
* Create both a GrRenderTarget and a matching GrDrawContext to wrap it.
|
||||||
@ -199,6 +200,7 @@ public:
|
|||||||
sk_sp<GrDrawContext> newDrawContext(SkBackingFit fit,
|
sk_sp<GrDrawContext> newDrawContext(SkBackingFit fit,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
GrPixelConfig config,
|
GrPixelConfig config,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
int sampleCnt = 0,
|
int sampleCnt = 0,
|
||||||
GrSurfaceOrigin origin = kDefault_GrSurfaceOrigin,
|
GrSurfaceOrigin origin = kDefault_GrSurfaceOrigin,
|
||||||
const SkSurfaceProps* surfaceProps = nullptr,
|
const SkSurfaceProps* surfaceProps = nullptr,
|
||||||
|
@ -272,6 +272,7 @@ public:
|
|||||||
int numColorSamples() const { return fRenderTarget->numColorSamples(); }
|
int numColorSamples() const { return fRenderTarget->numColorSamples(); }
|
||||||
bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); }
|
bool isGammaCorrect() const { return fSurfaceProps.isGammaCorrect(); }
|
||||||
const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
|
const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
|
||||||
|
SkColorSpace* getColorSpace() const { return fColorSpace.get(); }
|
||||||
|
|
||||||
bool wasAbandoned() const;
|
bool wasAbandoned() const;
|
||||||
|
|
||||||
@ -288,7 +289,7 @@ public:
|
|||||||
GrAuditTrail* auditTrail() { return fAuditTrail; }
|
GrAuditTrail* auditTrail() { return fAuditTrail; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>,
|
GrDrawContext(GrContext*, GrDrawingManager*, sk_sp<GrRenderTarget>, sk_sp<SkColorSpace>,
|
||||||
const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwner*);
|
const SkSurfaceProps* surfaceProps, GrAuditTrail*, GrSingleOwner*);
|
||||||
|
|
||||||
GrDrawingManager* drawingManager() { return fDrawingManager; }
|
GrDrawingManager* drawingManager() { return fDrawingManager; }
|
||||||
@ -362,6 +363,7 @@ private:
|
|||||||
GrContext* fContext;
|
GrContext* fContext;
|
||||||
GrInstancedPipelineInfo fInstancedPipelineInfo;
|
GrInstancedPipelineInfo fInstancedPipelineInfo;
|
||||||
|
|
||||||
|
sk_sp<SkColorSpace> fColorSpace;
|
||||||
SkSurfaceProps fSurfaceProps;
|
SkSurfaceProps fSurfaceProps;
|
||||||
GrAuditTrail* fAuditTrail;
|
GrAuditTrail* fAuditTrail;
|
||||||
|
|
||||||
|
@ -297,7 +297,9 @@ public:
|
|||||||
return SkSurface::MakeRenderTarget(fCurContext, SkBudgeted::kNo, win->info(),
|
return SkSurface::MakeRenderTarget(fCurContext, SkBudgeted::kNo, win->info(),
|
||||||
fMSAASampleCount, &props).release();
|
fMSAASampleCount, &props).release();
|
||||||
} else {
|
} else {
|
||||||
return SkSurface::MakeRenderTargetDirect(fCurRenderTarget, &props).release();
|
return SkSurface::MakeRenderTargetDirect(fCurRenderTarget,
|
||||||
|
sk_ref_sp(win->info().colorSpace()),
|
||||||
|
&props).release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -283,7 +283,8 @@ sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context,
|
|||||||
|
|
||||||
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
bounds.width(), bounds.height(),
|
bounds.width(), bounds.height(),
|
||||||
kRGBA_8888_GrPixelConfig));
|
kRGBA_8888_GrPixelConfig,
|
||||||
|
std::move(colorSpace)));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -294,9 +295,9 @@ sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context,
|
|||||||
GrFixedClip clip(dstIRect);
|
GrFixedClip clip(dstIRect);
|
||||||
drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
|
drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect);
|
||||||
|
|
||||||
// TODO: Get the colorSpace from the drawContext (once it has one)
|
|
||||||
return SkSpecialImage::MakeFromGpu(dstIRect, kNeedNewImageUniqueID_SpecialImage,
|
return SkSpecialImage::MakeFromGpu(dstIRect, kNeedNewImageUniqueID_SpecialImage,
|
||||||
drawContext->asTexture(), std::move(colorSpace));
|
drawContext->asTexture(),
|
||||||
|
sk_ref_sp(drawContext->getColorSpace()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -391,7 +391,7 @@ public:
|
|||||||
|
|
||||||
return SkSpecialSurface::MakeRenderTarget(fTexture->getContext(),
|
return SkSpecialSurface::MakeRenderTarget(fTexture->getContext(),
|
||||||
info.width(), info.height(),
|
info.width(), info.height(),
|
||||||
config);
|
config, sk_ref_sp(info.colorSpace()));
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
|
sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
|
||||||
|
@ -155,13 +155,15 @@ private:
|
|||||||
|
|
||||||
sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrContext* context,
|
sk_sp<SkSpecialSurface> SkSpecialSurface::MakeRenderTarget(GrContext* context,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
GrPixelConfig config) {
|
GrPixelConfig config,
|
||||||
|
sk_sp<SkColorSpace> colorSpace) {
|
||||||
if (!context) {
|
if (!context) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
width, height, config));
|
width, height, config,
|
||||||
|
std::move(colorSpace)));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
static sk_sp<SkSpecialSurface> MakeRenderTarget(GrContext*,
|
static sk_sp<SkSpecialSurface> MakeRenderTarget(GrContext*,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
GrPixelConfig config);
|
GrPixelConfig config,
|
||||||
|
sk_sp<SkColorSpace> colorSpace);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,7 +104,7 @@ sk_sp<GrTexture> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* contex
|
|||||||
|
|
||||||
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
bounds.width(), bounds.height(),
|
bounds.width(), bounds.height(),
|
||||||
config));
|
config, nullptr));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -121,13 +121,14 @@ sk_sp<SkSpecialImage> SkBlurImageFilter::onFilterImage(SkSpecialImage* source,
|
|||||||
inputBounds.offset(-inputOffset);
|
inputBounds.offset(-inputOffset);
|
||||||
dstBounds.offset(-inputOffset);
|
dstBounds.offset(-inputOffset);
|
||||||
sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(
|
sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(
|
||||||
context,
|
context,
|
||||||
inputTexture.get(),
|
inputTexture.get(),
|
||||||
source->props().isGammaCorrect(),
|
sk_ref_sp(source->getColorSpace()),
|
||||||
dstBounds,
|
source->props().isGammaCorrect(),
|
||||||
&inputBounds,
|
dstBounds,
|
||||||
sigma.x(),
|
&inputBounds,
|
||||||
sigma.y()));
|
sigma.x(),
|
||||||
|
sigma.y()));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1248,7 +1248,7 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
|
|||||||
static const bool kIsGammaCorrect = false;
|
static const bool kIsGammaCorrect = false;
|
||||||
bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
|
bool isNormalBlur = (kNormal_SkBlurStyle == fBlurStyle);
|
||||||
sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(context, src,
|
sk_sp<GrDrawContext> drawContext(SkGpuBlurUtils::GaussianBlur(context, src,
|
||||||
kIsGammaCorrect,
|
nullptr, kIsGammaCorrect,
|
||||||
clipRect, nullptr,
|
clipRect, nullptr,
|
||||||
xformedSigma, xformedSigma));
|
xformedSigma, xformedSigma));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
|
@ -335,9 +335,9 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou
|
|||||||
SkMatrix matrix;
|
SkMatrix matrix;
|
||||||
matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y()));
|
matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y()));
|
||||||
|
|
||||||
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> drawContext(
|
||||||
bounds.width(), bounds.height(),
|
context->newDrawContext(SkBackingFit::kApprox, bounds.width(), bounds.height(),
|
||||||
kSkia8888_GrPixelConfig));
|
kSkia8888_GrPixelConfig, sk_ref_sp(source->getColorSpace())));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -346,11 +346,10 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou
|
|||||||
|
|
||||||
offset->fX = bounds.left();
|
offset->fX = bounds.left();
|
||||||
offset->fY = bounds.top();
|
offset->fY = bounds.top();
|
||||||
// TODO: Get the colorSpace from the drawContext (once it has one)
|
|
||||||
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
|
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
|
||||||
kNeedNewImageUniqueID_SpecialImage,
|
kNeedNewImageUniqueID_SpecialImage,
|
||||||
drawContext->asTexture(),
|
drawContext->asTexture(),
|
||||||
sk_ref_sp(source->getColorSpace()));
|
sk_ref_sp(drawContext->getColorSpace()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -182,6 +182,7 @@ namespace SkGpuBlurUtils {
|
|||||||
|
|
||||||
sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
|
sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
|
||||||
GrTexture* origSrc,
|
GrTexture* origSrc,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
bool gammaCorrect,
|
bool gammaCorrect,
|
||||||
const SkIRect& dstBounds,
|
const SkIRect& dstBounds,
|
||||||
const SkIRect* srcBounds,
|
const SkIRect* srcBounds,
|
||||||
@ -230,7 +231,7 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
|
|||||||
SkSurfaceProps::kLegacyFontHost_InitType);
|
SkSurfaceProps::kLegacyFontHost_InitType);
|
||||||
|
|
||||||
sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
width, height, config,
|
width, height, config, colorSpace,
|
||||||
0, kDefault_GrSurfaceOrigin,
|
0, kDefault_GrSurfaceOrigin,
|
||||||
&props));
|
&props));
|
||||||
if (!dstDrawContext) {
|
if (!dstDrawContext) {
|
||||||
@ -251,7 +252,7 @@ sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrDrawContext> tmpDrawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> tmpDrawContext(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
width, height, config,
|
width, height, config, colorSpace,
|
||||||
0, kDefault_GrSurfaceOrigin,
|
0, kDefault_GrSurfaceOrigin,
|
||||||
&props));
|
&props));
|
||||||
if (!tmpDrawContext) {
|
if (!tmpDrawContext) {
|
||||||
|
@ -23,6 +23,7 @@ namespace SkGpuBlurUtils {
|
|||||||
* Note: one of sigmaX and sigmaY should be non-zero!
|
* Note: one of sigmaX and sigmaY should be non-zero!
|
||||||
* @param context The GPU context
|
* @param context The GPU context
|
||||||
* @param srcTexture The source texture to be blurred.
|
* @param srcTexture The source texture to be blurred.
|
||||||
|
* @param colorSpace Color space of the source (used for the drawContext result, too).
|
||||||
* @param gammaCorrect Should blur be gamma-correct (sRGB to linear, etc...)
|
* @param gammaCorrect Should blur be gamma-correct (sRGB to linear, etc...)
|
||||||
* @param dstBounds The destination bounds, relative to the source texture.
|
* @param dstBounds The destination bounds, relative to the source texture.
|
||||||
* @param srcBounds The source bounds, relative to the source texture. If non-null,
|
* @param srcBounds The source bounds, relative to the source texture. If non-null,
|
||||||
@ -33,6 +34,7 @@ namespace SkGpuBlurUtils {
|
|||||||
*/
|
*/
|
||||||
sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
|
sk_sp<GrDrawContext> GaussianBlur(GrContext* context,
|
||||||
GrTexture* srcTexture,
|
GrTexture* srcTexture,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
bool gammaCorrect,
|
bool gammaCorrect,
|
||||||
const SkIRect& dstBounds,
|
const SkIRect& dstBounds,
|
||||||
const SkIRect* srcBounds,
|
const SkIRect* srcBounds,
|
||||||
|
@ -411,7 +411,8 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(SkSpecialIma
|
|||||||
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
offsetBounds.width(),
|
offsetBounds.width(),
|
||||||
offsetBounds.height(),
|
offsetBounds.height(),
|
||||||
kRGBA_8888_GrPixelConfig));
|
kRGBA_8888_GrPixelConfig,
|
||||||
|
sk_ref_sp(source->getColorSpace())));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -453,11 +454,10 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(SkSpecialIma
|
|||||||
this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomRight,
|
this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomRight,
|
||||||
kBottomRight_BoundaryMode, pSrcBounds, offsetBounds);
|
kBottomRight_BoundaryMode, pSrcBounds, offsetBounds);
|
||||||
|
|
||||||
// TODO: Get the colorSpace from the drawContext (once it has one)
|
|
||||||
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
|
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
|
||||||
kNeedNewImageUniqueID_SpecialImage,
|
kNeedNewImageUniqueID_SpecialImage,
|
||||||
drawContext->asTexture(),
|
drawContext->asTexture(),
|
||||||
sk_ref_sp(source->getColorSpace()));
|
sk_ref_sp(drawContext->getColorSpace()));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -474,6 +474,7 @@ static sk_sp<SkSpecialImage> apply_morphology(GrContext* context,
|
|||||||
SkISize radius) {
|
SkISize radius) {
|
||||||
sk_sp<GrTexture> srcTexture(input->asTextureRef(context));
|
sk_sp<GrTexture> srcTexture(input->asTextureRef(context));
|
||||||
SkASSERT(srcTexture);
|
SkASSERT(srcTexture);
|
||||||
|
sk_sp<SkColorSpace> colorSpace = sk_ref_sp(input->getColorSpace());
|
||||||
|
|
||||||
// setup new clip
|
// setup new clip
|
||||||
const GrFixedClip clip(SkIRect::MakeWH(srcTexture->width(), srcTexture->height()));
|
const GrFixedClip clip(SkIRect::MakeWH(srcTexture->width(), srcTexture->height()));
|
||||||
@ -486,7 +487,8 @@ static sk_sp<SkSpecialImage> apply_morphology(GrContext* context,
|
|||||||
if (radius.fWidth > 0) {
|
if (radius.fWidth > 0) {
|
||||||
sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
rect.width(), rect.height(),
|
rect.width(), rect.height(),
|
||||||
kSkia8888_GrPixelConfig));
|
kSkia8888_GrPixelConfig,
|
||||||
|
colorSpace));
|
||||||
if (!dstDrawContext) {
|
if (!dstDrawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -507,7 +509,8 @@ static sk_sp<SkSpecialImage> apply_morphology(GrContext* context,
|
|||||||
if (radius.fHeight > 0) {
|
if (radius.fHeight > 0) {
|
||||||
sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> dstDrawContext(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
rect.width(), rect.height(),
|
rect.width(), rect.height(),
|
||||||
kSkia8888_GrPixelConfig));
|
kSkia8888_GrPixelConfig,
|
||||||
|
colorSpace));
|
||||||
if (!dstDrawContext) {
|
if (!dstDrawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -519,10 +522,9 @@ static sk_sp<SkSpecialImage> apply_morphology(GrContext* context,
|
|||||||
srcTexture = dstDrawContext->asTexture();
|
srcTexture = dstDrawContext->asTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Get the colorSpace from the drawContext (once it has one)
|
|
||||||
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
|
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
|
||||||
kNeedNewImageUniqueID_SpecialImage,
|
kNeedNewImageUniqueID_SpecialImage,
|
||||||
std::move(srcTexture), sk_ref_sp(input->getColorSpace()),
|
std::move(srcTexture), std::move(colorSpace),
|
||||||
&input->props());
|
&input->props());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -243,7 +243,8 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter::filterImageGPU(SkSpecialImage* sour
|
|||||||
|
|
||||||
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
bounds.width(), bounds.height(),
|
bounds.width(), bounds.height(),
|
||||||
kSkia8888_GrPixelConfig));
|
kSkia8888_GrPixelConfig,
|
||||||
|
sk_ref_sp(source->getColorSpace())));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -252,11 +253,10 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter::filterImageGPU(SkSpecialImage* sour
|
|||||||
matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
|
matrix.setTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
|
||||||
drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds));
|
drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(bounds));
|
||||||
|
|
||||||
// TODO: Get the colorSpace from the drawContext (once it has one)
|
|
||||||
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
|
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bounds.height()),
|
||||||
kNeedNewImageUniqueID_SpecialImage,
|
kNeedNewImageUniqueID_SpecialImage,
|
||||||
drawContext->asTexture(),
|
drawContext->asTexture(),
|
||||||
sk_ref_sp(source->getColorSpace()));
|
sk_ref_sp(drawContext->getColorSpace()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -113,6 +113,7 @@ static sk_sp<GrTexture> create_mask_GPU(GrContext* context,
|
|||||||
maskRect.width(),
|
maskRect.width(),
|
||||||
maskRect.height(),
|
maskRect.height(),
|
||||||
config,
|
config,
|
||||||
|
nullptr,
|
||||||
sampleCnt));
|
sampleCnt));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -474,7 +474,7 @@ sk_sp<GrTexture> GrClipMaskManager::CreateAlphaClipMask(GrContext* context,
|
|||||||
sk_sp<GrDrawContext> dc(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> dc(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
clipSpaceIBounds.width(),
|
clipSpaceIBounds.width(),
|
||||||
clipSpaceIBounds.height(),
|
clipSpaceIBounds.height(),
|
||||||
config));
|
config, nullptr));
|
||||||
if (!dc) {
|
if (!dc) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -357,7 +357,10 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
|
|||||||
}
|
}
|
||||||
SkMatrix matrix;
|
SkMatrix matrix;
|
||||||
matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top));
|
matrix.setTranslate(SkIntToScalar(left), SkIntToScalar(top));
|
||||||
sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(renderTarget)));
|
// TODO: Need to decide the semantics of this function for color spaces. Do we support
|
||||||
|
// conversion from a passed-in color space? For now, specifying nullptr means that this
|
||||||
|
// path will do no conversion, so it will match the behavior of the non-draw path.
|
||||||
|
sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(renderTarget), nullptr));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -444,10 +447,14 @@ bool GrContext::readSurfacePixels(GrSurface* src,
|
|||||||
tempDrawInfo.fTempSurfaceFit= SkBackingFit::kApprox;
|
tempDrawInfo.fTempSurfaceFit= SkBackingFit::kApprox;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO: Need to decide the semantics of this function for color spaces. Do we support
|
||||||
|
// conversion to a passed-in color space? For now, specifying nullptr means that this
|
||||||
|
// path will do no conversion, so it will match the behavior of the non-draw path.
|
||||||
sk_sp<GrDrawContext> tempDC = this->newDrawContext(tempDrawInfo.fTempSurfaceFit,
|
sk_sp<GrDrawContext> tempDC = this->newDrawContext(tempDrawInfo.fTempSurfaceFit,
|
||||||
tempDrawInfo.fTempSurfaceDesc.fWidth,
|
tempDrawInfo.fTempSurfaceDesc.fWidth,
|
||||||
tempDrawInfo.fTempSurfaceDesc.fHeight,
|
tempDrawInfo.fTempSurfaceDesc.fHeight,
|
||||||
tempDrawInfo.fTempSurfaceDesc.fConfig,
|
tempDrawInfo.fTempSurfaceDesc.fConfig,
|
||||||
|
nullptr,
|
||||||
tempDrawInfo.fTempSurfaceDesc.fSampleCnt,
|
tempDrawInfo.fTempSurfaceDesc.fSampleCnt,
|
||||||
tempDrawInfo.fTempSurfaceDesc.fOrigin);
|
tempDrawInfo.fTempSurfaceDesc.fOrigin);
|
||||||
if (tempDC) {
|
if (tempDC) {
|
||||||
@ -534,7 +541,8 @@ bool GrContext::applyGamma(GrRenderTarget* dst, GrTexture* src, SkScalar gamma){
|
|||||||
|
|
||||||
SkSurfaceProps props(SkSurfaceProps::kGammaCorrect_Flag,
|
SkSurfaceProps props(SkSurfaceProps::kGammaCorrect_Flag,
|
||||||
SkSurfaceProps::kLegacyFontHost_InitType);
|
SkSurfaceProps::kLegacyFontHost_InitType);
|
||||||
sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst), &props));
|
// TODO: Supply color space?
|
||||||
|
sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst), nullptr, &props));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -596,7 +604,7 @@ bool GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe
|
|||||||
src->flushWrites();
|
src->flushWrites();
|
||||||
return fGpu->copySurface(dst, src, clippedSrcRect, clippedDstPoint);
|
return fGpu->copySurface(dst, src, clippedSrcRect, clippedDstPoint);
|
||||||
}
|
}
|
||||||
sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst->asRenderTarget())));
|
sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(dst->asRenderTarget()), nullptr));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -636,14 +644,16 @@ int GrContext::getRecommendedSampleCount(GrPixelConfig config,
|
|||||||
|
|
||||||
|
|
||||||
sk_sp<GrDrawContext> GrContext::drawContext(sk_sp<GrRenderTarget> rt,
|
sk_sp<GrDrawContext> GrContext::drawContext(sk_sp<GrRenderTarget> rt,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
const SkSurfaceProps* surfaceProps) {
|
const SkSurfaceProps* surfaceProps) {
|
||||||
ASSERT_SINGLE_OWNER
|
ASSERT_SINGLE_OWNER
|
||||||
return fDrawingManager->drawContext(std::move(rt), surfaceProps);
|
return fDrawingManager->drawContext(std::move(rt), std::move(colorSpace), surfaceProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrDrawContext> GrContext::newDrawContext(SkBackingFit fit,
|
sk_sp<GrDrawContext> GrContext::newDrawContext(SkBackingFit fit,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
GrPixelConfig config,
|
GrPixelConfig config,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
int sampleCnt,
|
int sampleCnt,
|
||||||
GrSurfaceOrigin origin,
|
GrSurfaceOrigin origin,
|
||||||
const SkSurfaceProps* surfaceProps,
|
const SkSurfaceProps* surfaceProps,
|
||||||
@ -667,7 +677,7 @@ sk_sp<GrDrawContext> GrContext::newDrawContext(SkBackingFit fit,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(tex->asRenderTarget()),
|
sk_sp<GrDrawContext> drawContext(this->drawContext(sk_ref_sp(tex->asRenderTarget()),
|
||||||
surfaceProps));
|
std::move(colorSpace), surfaceProps));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -69,6 +69,7 @@ bool GrDrawContext::wasAbandoned() const {
|
|||||||
GrDrawContext::GrDrawContext(GrContext* context,
|
GrDrawContext::GrDrawContext(GrContext* context,
|
||||||
GrDrawingManager* drawingMgr,
|
GrDrawingManager* drawingMgr,
|
||||||
sk_sp<GrRenderTarget> rt,
|
sk_sp<GrRenderTarget> rt,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
const SkSurfaceProps* surfaceProps,
|
const SkSurfaceProps* surfaceProps,
|
||||||
GrAuditTrail* auditTrail,
|
GrAuditTrail* auditTrail,
|
||||||
GrSingleOwner* singleOwner)
|
GrSingleOwner* singleOwner)
|
||||||
@ -77,6 +78,7 @@ GrDrawContext::GrDrawContext(GrContext* context,
|
|||||||
, fDrawTarget(SkSafeRef(fRenderTarget->getLastDrawTarget()))
|
, fDrawTarget(SkSafeRef(fRenderTarget->getLastDrawTarget()))
|
||||||
, fContext(context)
|
, fContext(context)
|
||||||
, fInstancedPipelineInfo(fRenderTarget.get())
|
, fInstancedPipelineInfo(fRenderTarget.get())
|
||||||
|
, fColorSpace(std::move(colorSpace))
|
||||||
, fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
|
, fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps))
|
||||||
, fAuditTrail(auditTrail)
|
, fAuditTrail(auditTrail)
|
||||||
#ifdef SK_DEBUG
|
#ifdef SK_DEBUG
|
||||||
|
@ -175,6 +175,7 @@ GrPathRenderer* GrDrawingManager::getPathRenderer(const GrPathRenderer::CanDrawP
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrDrawContext> GrDrawingManager::drawContext(sk_sp<GrRenderTarget> rt,
|
sk_sp<GrDrawContext> GrDrawingManager::drawContext(sk_sp<GrRenderTarget> rt,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
const SkSurfaceProps* surfaceProps) {
|
const SkSurfaceProps* surfaceProps) {
|
||||||
if (this->wasAbandoned()) {
|
if (this->wasAbandoned()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -191,13 +192,14 @@ sk_sp<GrDrawContext> GrDrawingManager::drawContext(sk_sp<GrRenderTarget> rt,
|
|||||||
GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAttachment(rt.get());
|
GrStencilAttachment* sb = fContext->resourceProvider()->attachStencilAttachment(rt.get());
|
||||||
if (sb) {
|
if (sb) {
|
||||||
return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext(
|
return sk_sp<GrDrawContext>(new GrPathRenderingDrawContext(
|
||||||
fContext, this, std::move(rt),
|
fContext, this, std::move(rt),
|
||||||
surfaceProps,
|
std::move(colorSpace), surfaceProps,
|
||||||
fContext->getAuditTrail(), fSingleOwner));
|
fContext->getAuditTrail(), fSingleOwner));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt), surfaceProps,
|
return sk_sp<GrDrawContext>(new GrDrawContext(fContext, this, std::move(rt),
|
||||||
|
std::move(colorSpace), surfaceProps,
|
||||||
fContext->getAuditTrail(),
|
fContext->getAuditTrail(),
|
||||||
fSingleOwner));
|
fSingleOwner));
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,8 @@ public:
|
|||||||
bool wasAbandoned() const { return fAbandoned; }
|
bool wasAbandoned() const { return fAbandoned; }
|
||||||
void freeGpuResources();
|
void freeGpuResources();
|
||||||
|
|
||||||
sk_sp<GrDrawContext> drawContext(sk_sp<GrRenderTarget> rt, const SkSurfaceProps*);
|
sk_sp<GrDrawContext> drawContext(sk_sp<GrRenderTarget> rt, sk_sp<SkColorSpace> colorSpace,
|
||||||
|
const SkSurfaceProps*);
|
||||||
|
|
||||||
// The caller automatically gets a ref on the returned drawTarget. It must
|
// The caller automatically gets a ref on the returned drawTarget. It must
|
||||||
// be balanced by an unref call.
|
// be balanced by an unref call.
|
||||||
|
@ -27,9 +27,9 @@ public:
|
|||||||
SkDrawFilter*, const SkIRect& clipBounds) override;
|
SkDrawFilter*, const SkIRect& clipBounds) override;
|
||||||
protected:
|
protected:
|
||||||
GrPathRenderingDrawContext(GrContext* ctx, GrDrawingManager* mgr, sk_sp<GrRenderTarget> rt,
|
GrPathRenderingDrawContext(GrContext* ctx, GrDrawingManager* mgr, sk_sp<GrRenderTarget> rt,
|
||||||
const SkSurfaceProps* surfaceProps, GrAuditTrail* at,
|
sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* surfaceProps,
|
||||||
GrSingleOwner* so)
|
GrAuditTrail* at, GrSingleOwner* so)
|
||||||
: INHERITED(ctx, mgr, std::move(rt), surfaceProps, at, so) {}
|
: INHERITED(ctx, mgr, std::move(rt), std::move(colorSpace), surfaceProps, at, so) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkAutoTDelete<GrStencilAndCoverTextContext> fStencilAndCoverTextContext;
|
SkAutoTDelete<GrStencilAndCoverTextContext> fStencilAndCoverTextContext;
|
||||||
|
@ -29,7 +29,7 @@ void GrRenderTarget::discard() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(this)));
|
sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(this), nullptr));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ static GrTexture* copy_on_gpu(GrTexture* inputTexture, const SkIRect* subset,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrDrawContext> copyDC = context->newDrawContext(SkBackingFit::kExact, copyParams.fWidth,
|
sk_sp<GrDrawContext> copyDC = context->newDrawContext(SkBackingFit::kExact, copyParams.fWidth,
|
||||||
copyParams.fHeight, config);
|
copyParams.fHeight, config, nullptr);
|
||||||
if (!copyDC) {
|
if (!copyDC) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -71,14 +71,14 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
|
|||||||
if (sizes[0] == sizes[1] && sizes[1] == sizes[2]) {
|
if (sizes[0] == sizes[1] && sizes[1] == sizes[2]) {
|
||||||
yuvDrawContext = context->newDrawContext(SkBackingFit::kApprox,
|
yuvDrawContext = context->newDrawContext(SkBackingFit::kApprox,
|
||||||
sizes[0].fWidth, sizes[0].fHeight,
|
sizes[0].fWidth, sizes[0].fHeight,
|
||||||
kRGBA_8888_GrPixelConfig);
|
kRGBA_8888_GrPixelConfig, nullptr);
|
||||||
if (!yuvDrawContext) {
|
if (!yuvDrawContext) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
yDrawContext = context->newDrawContext(SkBackingFit::kApprox,
|
yDrawContext = context->newDrawContext(SkBackingFit::kApprox,
|
||||||
sizes[0].fWidth, sizes[0].fHeight,
|
sizes[0].fWidth, sizes[0].fHeight,
|
||||||
singleChannelPixelConfig);
|
singleChannelPixelConfig, nullptr);
|
||||||
if (!yDrawContext) {
|
if (!yDrawContext) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -86,17 +86,17 @@ bool GrTextureToYUVPlanes(GrTexture* texture, const SkISize sizes[3], void* cons
|
|||||||
// TODO: Add support for GL_RG when available.
|
// TODO: Add support for GL_RG when available.
|
||||||
uvDrawContext = context->newDrawContext(SkBackingFit::kApprox,
|
uvDrawContext = context->newDrawContext(SkBackingFit::kApprox,
|
||||||
sizes[1].fWidth, sizes[1].fHeight,
|
sizes[1].fWidth, sizes[1].fHeight,
|
||||||
kRGBA_8888_GrPixelConfig);
|
kRGBA_8888_GrPixelConfig, nullptr);
|
||||||
if (!uvDrawContext) {
|
if (!uvDrawContext) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
uDrawContext = context->newDrawContext(SkBackingFit::kApprox,
|
uDrawContext = context->newDrawContext(SkBackingFit::kApprox,
|
||||||
sizes[1].fWidth, sizes[1].fHeight,
|
sizes[1].fWidth, sizes[1].fHeight,
|
||||||
singleChannelPixelConfig);
|
singleChannelPixelConfig, nullptr);
|
||||||
vDrawContext = context->newDrawContext(SkBackingFit::kApprox,
|
vDrawContext = context->newDrawContext(SkBackingFit::kApprox,
|
||||||
sizes[2].fWidth, sizes[2].fHeight,
|
sizes[2].fWidth, sizes[2].fHeight,
|
||||||
singleChannelPixelConfig);
|
singleChannelPixelConfig, nullptr);
|
||||||
if (!uDrawContext || !vDrawContext) {
|
if (!uDrawContext || !vDrawContext) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -113,9 +113,11 @@ sk_sp<GrTexture> GrYUVProvider::refAsTexture(GrContext* ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We never want to perform color-space conversion during the decode
|
||||||
sk_sp<GrDrawContext> drawContext(ctx->newDrawContext(SkBackingFit::kExact,
|
sk_sp<GrDrawContext> drawContext(ctx->newDrawContext(SkBackingFit::kExact,
|
||||||
desc.fWidth, desc.fHeight,
|
desc.fWidth, desc.fHeight,
|
||||||
desc.fConfig, desc.fSampleCnt));
|
desc.fConfig, nullptr,
|
||||||
|
desc.fSampleCnt));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -126,8 +126,8 @@ bool SkGpuDevice::CheckAlphaTypeAndGetFlags(
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<SkGpuDevice> SkGpuDevice::Make(sk_sp<GrRenderTarget> rt, const SkSurfaceProps* props,
|
sk_sp<SkGpuDevice> SkGpuDevice::Make(sk_sp<GrRenderTarget> rt, sk_sp<SkColorSpace> colorSpace,
|
||||||
InitContents init) {
|
const SkSurfaceProps* props, InitContents init) {
|
||||||
if (!rt || rt->wasDestroyed() || !rt->getContext()) {
|
if (!rt || rt->wasDestroyed() || !rt->getContext()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -141,7 +141,8 @@ sk_sp<SkGpuDevice> SkGpuDevice::Make(sk_sp<GrRenderTarget> rt, const SkSurfacePr
|
|||||||
|
|
||||||
GrContext* context = rt->getContext();
|
GrContext* context = rt->getContext();
|
||||||
|
|
||||||
sk_sp<GrDrawContext> drawContext(context->drawContext(std::move(rt), props));
|
sk_sp<GrDrawContext> drawContext(context->drawContext(std::move(rt), std::move(colorSpace),
|
||||||
|
props));
|
||||||
return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext), width, height, flags));
|
return sk_sp<SkGpuDevice>(new SkGpuDevice(std::move(drawContext), width, height, flags));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,7 +224,7 @@ sk_sp<GrDrawContext> SkGpuDevice::CreateDrawContext(GrContext* context,
|
|||||||
|
|
||||||
return context->newDrawContext(SkBackingFit::kExact, // Why exact?
|
return context->newDrawContext(SkBackingFit::kExact, // Why exact?
|
||||||
origInfo.width(), origInfo.height(),
|
origInfo.width(), origInfo.height(),
|
||||||
config, sampleCount,
|
config, sk_ref_sp(cs), sampleCount,
|
||||||
kDefault_GrSurfaceOrigin, surfaceProps, budgeted);
|
kDefault_GrSurfaceOrigin, surfaceProps, budgeted);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1842,6 +1843,7 @@ SkBaseDevice* SkGpuDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
|
|||||||
sk_sp<GrDrawContext> dc(fContext->newDrawContext(fit,
|
sk_sp<GrDrawContext> dc(fContext->newDrawContext(fit,
|
||||||
cinfo.fInfo.width(), cinfo.fInfo.height(),
|
cinfo.fInfo.width(), cinfo.fInfo.height(),
|
||||||
fDrawContext->config(),
|
fDrawContext->config(),
|
||||||
|
sk_ref_sp(fDrawContext->getColorSpace()),
|
||||||
fDrawContext->desc().fSampleCnt,
|
fDrawContext->desc().fSampleCnt,
|
||||||
kDefault_GrSurfaceOrigin,
|
kDefault_GrSurfaceOrigin,
|
||||||
&props));
|
&props));
|
||||||
|
@ -42,7 +42,8 @@ public:
|
|||||||
* MakeFromBackendTexture, MakeFromBackendRenderTarget,
|
* MakeFromBackendTexture, MakeFromBackendRenderTarget,
|
||||||
* and MakeFromBackendTextureAsRenderTarget. Only the first is worrisome.
|
* and MakeFromBackendTextureAsRenderTarget. Only the first is worrisome.
|
||||||
*/
|
*/
|
||||||
static sk_sp<SkGpuDevice> Make(sk_sp<GrRenderTarget> target,
|
static sk_sp<SkGpuDevice> Make(sk_sp<GrRenderTarget> target,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
const SkSurfaceProps*,
|
const SkSurfaceProps*,
|
||||||
InitContents);
|
InitContents);
|
||||||
|
|
||||||
|
@ -174,9 +174,9 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrDrawContext> readDC(context->newDrawContext(SkBackingFit::kExact, kSize, kSize,
|
sk_sp<GrDrawContext> readDC(context->newDrawContext(SkBackingFit::kExact, kSize, kSize,
|
||||||
kConfig));
|
kConfig, nullptr));
|
||||||
sk_sp<GrDrawContext> tempDC(context->newDrawContext(SkBackingFit::kExact, kSize, kSize,
|
sk_sp<GrDrawContext> tempDC(context->newDrawContext(SkBackingFit::kExact, kSize, kSize,
|
||||||
kConfig));
|
kConfig, nullptr));
|
||||||
if (!readDC || !tempDC) {
|
if (!readDC || !tempDC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -245,6 +245,7 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
|
|||||||
sk_sp<GrDrawContext> drawContext(ctx->newDrawContext(SkBackingFit::kExact,
|
sk_sp<GrDrawContext> drawContext(ctx->newDrawContext(SkBackingFit::kExact,
|
||||||
width, height,
|
width, height,
|
||||||
kRGBA_8888_GrPixelConfig,
|
kRGBA_8888_GrPixelConfig,
|
||||||
|
std::move(imageColorSpace),
|
||||||
0,
|
0,
|
||||||
origin));
|
origin));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
@ -262,7 +263,7 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
|
|||||||
ctx->flushSurfaceWrites(drawContext->accessRenderTarget());
|
ctx->flushSurfaceWrites(drawContext->accessRenderTarget());
|
||||||
return sk_make_sp<SkImage_Gpu>(width, height, kNeedNewImageUniqueID,
|
return sk_make_sp<SkImage_Gpu>(width, height, kNeedNewImageUniqueID,
|
||||||
kOpaque_SkAlphaType, drawContext->asTexture().get(),
|
kOpaque_SkAlphaType, drawContext->asTexture().get(),
|
||||||
std::move(imageColorSpace), budgeted);
|
sk_ref_sp(drawContext->getColorSpace()), budgeted);
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<SkImage> SkImage::MakeFromYUVTexturesCopy(GrContext* ctx, SkYUVColorSpace colorSpace,
|
sk_sp<SkImage> SkImage::MakeFromYUVTexturesCopy(GrContext* ctx, SkYUVColorSpace colorSpace,
|
||||||
|
@ -223,7 +223,8 @@ void SkSurface::prepareForExternalIO() {
|
|||||||
|
|
||||||
#if !SK_SUPPORT_GPU
|
#if !SK_SUPPORT_GPU
|
||||||
|
|
||||||
sk_sp<SkSurface> SkSurface::MakeRenderTargetDirect(GrRenderTarget*, const SkSurfaceProps*) {
|
sk_sp<SkSurface> SkSurface::MakeRenderTargetDirect(GrRenderTarget*, sk_sp<SkColorSpace>,
|
||||||
|
const SkSurfaceProps*) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,18 +234,19 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext*, SkBudgeted, const SkIma
|
|||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext*, const GrBackendTextureDesc&,
|
sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext*, const GrBackendTextureDesc&,
|
||||||
const SkSurfaceProps*) {
|
sk_sp<SkColorSpace>, const SkSurfaceProps*) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*,
|
sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*,
|
||||||
const GrBackendRenderTargetDesc&,
|
const GrBackendRenderTargetDesc&,
|
||||||
|
sk_sp<SkColorSpace>,
|
||||||
const SkSurfaceProps*) {
|
const SkSurfaceProps*) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext*, const GrBackendTextureDesc&,
|
sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext*, const GrBackendTextureDesc&,
|
||||||
const SkSurfaceProps*) {
|
sk_sp<SkColorSpace>, const SkSurfaceProps*) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,9 +132,11 @@ void SkSurface_Gpu::onPrepareForExternalIO() {
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
sk_sp<SkSurface> SkSurface::MakeRenderTargetDirect(GrRenderTarget* target,
|
sk_sp<SkSurface> SkSurface::MakeRenderTargetDirect(GrRenderTarget* target,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
const SkSurfaceProps* props) {
|
const SkSurfaceProps* props) {
|
||||||
sk_sp<SkGpuDevice> device(
|
sk_sp<SkGpuDevice> device(
|
||||||
SkGpuDevice::Make(sk_ref_sp(target), props, SkGpuDevice::kUninit_InitContents));
|
SkGpuDevice::Make(sk_ref_sp(target), std::move(colorSpace), props,
|
||||||
|
SkGpuDevice::kUninit_InitContents));
|
||||||
if (!device) {
|
if (!device) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -154,6 +156,7 @@ sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext* ctx, SkBudgeted budgeted
|
|||||||
|
|
||||||
sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context,
|
sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context,
|
||||||
const GrBackendTextureDesc& desc,
|
const GrBackendTextureDesc& desc,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
const SkSurfaceProps* props) {
|
const SkSurfaceProps* props) {
|
||||||
if (nullptr == context) {
|
if (nullptr == context) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -166,7 +169,8 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context,
|
|||||||
if (!surface) {
|
if (!surface) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
sk_sp<SkGpuDevice> device(SkGpuDevice::Make(sk_ref_sp(surface->asRenderTarget()), props,
|
sk_sp<SkGpuDevice> device(SkGpuDevice::Make(sk_ref_sp(surface->asRenderTarget()),
|
||||||
|
std::move(colorSpace), props,
|
||||||
SkGpuDevice::kUninit_InitContents));
|
SkGpuDevice::kUninit_InitContents));
|
||||||
if (!device) {
|
if (!device) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -176,6 +180,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context,
|
|||||||
|
|
||||||
sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
|
sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
|
||||||
const GrBackendRenderTargetDesc& desc,
|
const GrBackendRenderTargetDesc& desc,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
const SkSurfaceProps* props) {
|
const SkSurfaceProps* props) {
|
||||||
if (!context) {
|
if (!context) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -184,7 +189,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
|
|||||||
if (!rt) {
|
if (!rt) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rt), props,
|
sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rt), std::move(colorSpace), props,
|
||||||
SkGpuDevice::kUninit_InitContents));
|
SkGpuDevice::kUninit_InitContents));
|
||||||
if (!device) {
|
if (!device) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -194,6 +199,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
|
|||||||
|
|
||||||
sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* context,
|
sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* context,
|
||||||
const GrBackendTextureDesc& desc,
|
const GrBackendTextureDesc& desc,
|
||||||
|
sk_sp<SkColorSpace> colorSpace,
|
||||||
const SkSurfaceProps* props) {
|
const SkSurfaceProps* props) {
|
||||||
if (!context) {
|
if (!context) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -202,7 +208,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont
|
|||||||
if (!rt) {
|
if (!rt) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rt), props,
|
sk_sp<SkGpuDevice> device(SkGpuDevice::Make(std::move(rt), std::move(colorSpace), props,
|
||||||
SkGpuDevice::kUninit_InitContents));
|
SkGpuDevice::kUninit_InitContents));
|
||||||
if (!device) {
|
if (!device) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -45,7 +45,7 @@ static bool reset_dc(sk_sp<GrDrawContext>* dc, GrContext* context, int w, int h)
|
|||||||
}
|
}
|
||||||
context->freeGpuResources();
|
context->freeGpuResources();
|
||||||
|
|
||||||
*dc = context->newDrawContext(SkBackingFit::kExact, w, h, kRGBA_8888_GrPixelConfig);
|
*dc = context->newDrawContext(SkBackingFit::kExact, w, h, kRGBA_8888_GrPixelConfig, nullptr);
|
||||||
|
|
||||||
SkASSERT((*dc)->accessRenderTarget()->getUniqueID() != oldID);
|
SkASSERT((*dc)->accessRenderTarget()->getUniqueID() != oldID);
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(AADistanceFieldPathRenderer, reporter, ctxInfo)
|
|||||||
sk_sp<GrDrawContext> drawContext(ctxInfo.grContext()->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> drawContext(ctxInfo.grContext()->newDrawContext(SkBackingFit::kApprox,
|
||||||
800, 800,
|
800, 800,
|
||||||
kSkia8888_GrPixelConfig,
|
kSkia8888_GrPixelConfig,
|
||||||
|
nullptr,
|
||||||
0,
|
0,
|
||||||
kTopLeft_GrSurfaceOrigin));
|
kTopLeft_GrSurfaceOrigin));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
|
@ -158,6 +158,7 @@ static sk_sp<GrDrawContext> random_draw_context(GrContext* context,
|
|||||||
kRenderTargetWidth,
|
kRenderTargetWidth,
|
||||||
kRenderTargetHeight,
|
kRenderTargetHeight,
|
||||||
kRGBA_8888_GrPixelConfig,
|
kRGBA_8888_GrPixelConfig,
|
||||||
|
nullptr,
|
||||||
sampleCnt,
|
sampleCnt,
|
||||||
origin));
|
origin));
|
||||||
return drawContext;
|
return drawContext;
|
||||||
@ -345,7 +346,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) {
|
|||||||
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kExact,
|
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kExact,
|
||||||
kRenderTargetWidth,
|
kRenderTargetWidth,
|
||||||
kRenderTargetHeight,
|
kRenderTargetHeight,
|
||||||
kRGBA_8888_GrPixelConfig));
|
kRGBA_8888_GrPixelConfig,
|
||||||
|
nullptr));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
SkDebugf("Could not allocate a drawContext");
|
SkDebugf("Could not allocate a drawContext");
|
||||||
return false;
|
return false;
|
||||||
|
@ -367,7 +367,7 @@ static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context,
|
|||||||
if (context) {
|
if (context) {
|
||||||
return SkSpecialSurface::MakeRenderTarget(context,
|
return SkSpecialSurface::MakeRenderTarget(context,
|
||||||
widthHeight, widthHeight,
|
widthHeight, widthHeight,
|
||||||
kSkia8888_GrPixelConfig);
|
kSkia8888_GrPixelConfig, nullptr);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,8 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) {
|
|||||||
GrContext* context = ctxInfo.grContext();
|
GrContext* context = ctxInfo.grContext();
|
||||||
|
|
||||||
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kApprox,
|
||||||
1, 1, kRGBA_8888_GrPixelConfig));
|
1, 1, kRGBA_8888_GrPixelConfig,
|
||||||
|
nullptr));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
ERRORF(reporter, "Could not create draw context.");
|
ERRORF(reporter, "Could not create draw context.");
|
||||||
return;
|
return;
|
||||||
|
@ -397,7 +397,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadPixels_Gpu, reporter, ctxInfo) {
|
|||||||
desc.fOrigin = origin;
|
desc.fOrigin = origin;
|
||||||
SkAutoTUnref<GrTexture> surfaceTexture(
|
SkAutoTUnref<GrTexture> surfaceTexture(
|
||||||
ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo));
|
ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo));
|
||||||
auto surface(SkSurface::MakeRenderTargetDirect(surfaceTexture->asRenderTarget()));
|
auto surface(SkSurface::MakeRenderTargetDirect(surfaceTexture->asRenderTarget(), nullptr));
|
||||||
desc.fFlags = kNone_GrSurfaceFlags;
|
desc.fFlags = kNone_GrSurfaceFlags;
|
||||||
test_readpixels(reporter, surface, kLast_BitmapInit);
|
test_readpixels(reporter, surface, kLast_BitmapInit);
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
|
|||||||
|
|
||||||
// Now try writing on the single channel texture (if we could create as a RT).
|
// Now try writing on the single channel texture (if we could create as a RT).
|
||||||
if (texture->asRenderTarget()) {
|
if (texture->asRenderTarget()) {
|
||||||
sk_sp<SkSurface> surf(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget()));
|
sk_sp<SkSurface> surf(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget(),
|
||||||
|
nullptr));
|
||||||
SkCanvas* canvas = surf->getCanvas();
|
SkCanvas* canvas = surf->getCanvas();
|
||||||
|
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
|
@ -90,7 +90,8 @@ static void test_clear(skiatest::Reporter* reporter, GrContext* context,
|
|||||||
GrTexture* rectangleTexture) {
|
GrTexture* rectangleTexture) {
|
||||||
if (rectangleTexture->asRenderTarget()) {
|
if (rectangleTexture->asRenderTarget()) {
|
||||||
sk_sp<GrDrawContext> dc(
|
sk_sp<GrDrawContext> dc(
|
||||||
context->drawContext(sk_ref_sp(rectangleTexture->asRenderTarget())));
|
context->drawContext(sk_ref_sp(rectangleTexture->asRenderTarget()),
|
||||||
|
nullptr));
|
||||||
if (!dc) {
|
if (!dc) {
|
||||||
ERRORF(reporter, "Could not get GrDrawContext for rectangle texture.");
|
ERRORF(reporter, "Could not get GrDrawContext for rectangle texture.");
|
||||||
return;
|
return;
|
||||||
|
@ -123,12 +123,17 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SRGBMipMaps, reporter, ctxInfo) {
|
|||||||
SkSurfaceProps l32Props(SkSurfaceProps::kLegacyFontHost_InitType);
|
SkSurfaceProps l32Props(SkSurfaceProps::kLegacyFontHost_InitType);
|
||||||
SkSurfaceProps s32Props(SkSurfaceProps::kGammaCorrect_Flag,
|
SkSurfaceProps s32Props(SkSurfaceProps::kGammaCorrect_Flag,
|
||||||
SkSurfaceProps::kLegacyFontHost_InitType);
|
SkSurfaceProps::kLegacyFontHost_InitType);
|
||||||
|
sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
|
||||||
sk_sp<GrDrawContext> l32DrawContext = context->newDrawContext(SkBackingFit::kExact, rtS, rtS,
|
sk_sp<GrDrawContext> l32DrawContext = context->newDrawContext(SkBackingFit::kExact, rtS, rtS,
|
||||||
kSkia8888_GrPixelConfig, 0,
|
kSkia8888_GrPixelConfig,
|
||||||
|
nullptr,
|
||||||
|
0,
|
||||||
kDefault_GrSurfaceOrigin,
|
kDefault_GrSurfaceOrigin,
|
||||||
&l32Props);
|
&l32Props);
|
||||||
sk_sp<GrDrawContext> s32DrawContext = context->newDrawContext(SkBackingFit::kExact, rtS, rtS,
|
sk_sp<GrDrawContext> s32DrawContext = context->newDrawContext(SkBackingFit::kExact, rtS, rtS,
|
||||||
kSkiaGamma8888_GrPixelConfig, 0,
|
kSkiaGamma8888_GrPixelConfig,
|
||||||
|
std::move(srgbColorSpace),
|
||||||
|
0,
|
||||||
kDefault_GrSurfaceOrigin,
|
kDefault_GrSurfaceOrigin,
|
||||||
&s32Props);
|
&s32Props);
|
||||||
|
|
||||||
|
@ -81,7 +81,8 @@ DEF_TEST(SpecialSurface_Raster2, reporter) {
|
|||||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) {
|
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialSurface_Gpu1, reporter, ctxInfo) {
|
||||||
sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.grContext(),
|
sk_sp<SkSpecialSurface> surf(SkSpecialSurface::MakeRenderTarget(ctxInfo.grContext(),
|
||||||
kSmallerSize, kSmallerSize,
|
kSmallerSize, kSmallerSize,
|
||||||
kSkia8888_GrPixelConfig));
|
kSkia8888_GrPixelConfig,
|
||||||
|
nullptr));
|
||||||
|
|
||||||
test_surface(surf, reporter, 0);
|
test_surface(surf, reporter, 0);
|
||||||
}
|
}
|
||||||
|
@ -337,7 +337,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(UniqueImageSnapshot_Gpu, reporter, ctxInfo) {
|
|||||||
desc.fTextureHandle = textureObject;
|
desc.fTextureHandle = textureObject;
|
||||||
GrTexture* texture = context->textureProvider()->wrapBackendTexture(desc);
|
GrTexture* texture = context->textureProvider()->wrapBackendTexture(desc);
|
||||||
{
|
{
|
||||||
auto surface(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget()));
|
auto surface(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget(), nullptr));
|
||||||
test_unique_image_snap(reporter, surface.get(), true, imageBackingStore,
|
test_unique_image_snap(reporter, surface.get(), true, imageBackingStore,
|
||||||
surfaceBackingStore);
|
surfaceBackingStore);
|
||||||
}
|
}
|
||||||
|
@ -257,6 +257,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
|
|||||||
sk_sp<GrDrawContext> drawContext(ctxInfo.grContext()->newDrawContext(SkBackingFit::kApprox,
|
sk_sp<GrDrawContext> drawContext(ctxInfo.grContext()->newDrawContext(SkBackingFit::kApprox,
|
||||||
800, 800,
|
800, 800,
|
||||||
kSkia8888_GrPixelConfig,
|
kSkia8888_GrPixelConfig,
|
||||||
|
nullptr,
|
||||||
0,
|
0,
|
||||||
kTopLeft_GrSurfaceOrigin));
|
kTopLeft_GrSurfaceOrigin));
|
||||||
if (!drawContext) {
|
if (!drawContext) {
|
||||||
|
@ -416,7 +416,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WritePixels_Gpu, reporter, ctxInfo) {
|
|||||||
desc.fOrigin = origin;
|
desc.fOrigin = origin;
|
||||||
SkAutoTUnref<GrTexture> texture(
|
SkAutoTUnref<GrTexture> texture(
|
||||||
ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo));
|
ctxInfo.grContext()->textureProvider()->createTexture(desc, SkBudgeted::kNo));
|
||||||
auto surface(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget()));
|
auto surface(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget(), nullptr));
|
||||||
test_write_pixels(reporter, surface.get());
|
test_write_pixels(reporter, surface.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user