Try out refFoo pattern on GrRenderTargetContext

Change-Id: Ifae5618f30c2202b9083f479b58556709ff6126a
Reviewed-on: https://skia-review.googlesource.com/6990
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2017-01-13 09:18:59 -05:00 committed by Skia Commit-Bot
parent 550148ba57
commit 75a475cf2e
10 changed files with 11 additions and 10 deletions

View File

@ -357,6 +357,7 @@ public:
bool isGammaCorrect() const { return SkToBool(fColorSpace.get()); }
const SkSurfaceProps& surfaceProps() const { return fSurfaceProps; }
SkColorSpace* getColorSpace() const { return fColorSpace.get(); }
sk_sp<SkColorSpace> refColorSpace() const { return fColorSpace; }
GrColorSpaceXform* getColorXformFromSRGB() const { return fColorXformFromSRGB.get(); }
GrSurfaceOrigin origin() const { return fRenderTargetProxy->origin(); }

View File

@ -176,7 +176,7 @@ sk_sp<SkSpecialImage> SkBlurImageFilterImpl::onFilterImage(SkSpecialImage* sourc
return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(dstBounds.width(), dstBounds.height()),
kNeedNewImageUniqueID_SpecialImage,
renderTargetContext->asTexture(),
sk_ref_sp(renderTargetContext->getColorSpace()),
renderTargetContext->refColorSpace(),
&source->props());
}
#endif

View File

@ -304,7 +304,7 @@ sk_sp<SkSpecialImage> SkImageFilter::DrawWithFP(GrContext* context,
return SkSpecialImage::MakeDeferredFromGpu(context, dstIRect,
kNeedNewImageUniqueID_SpecialImage,
sk_ref_sp(renderTargetContext->asDeferredTexture()),
sk_ref_sp(renderTargetContext->getColorSpace()));
renderTargetContext->refColorSpace());
}
#endif

View File

@ -143,7 +143,7 @@ public:
this->subset(),
kNeedNewImageUniqueID_SpecialImage,
fRenderTargetContext->asTexture(),
sk_ref_sp(fRenderTargetContext->getColorSpace()),
fRenderTargetContext->refColorSpace(),
&this->props()));
fRenderTargetContext = nullptr;
return tmp;

View File

@ -410,7 +410,7 @@ sk_sp<SkSpecialImage> ArithmeticImageFilterImpl::filterImageGPU(
SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
sk_ref_sp(renderTargetContext->asDeferredTexture()),
sk_ref_sp(renderTargetContext->getColorSpace()));
renderTargetContext->refColorSpace());
}
#endif

View File

@ -376,7 +376,7 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou
SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
sk_ref_sp(renderTargetContext->asDeferredTexture()),
sk_ref_sp(renderTargetContext->getColorSpace()));
renderTargetContext->refColorSpace());
}
#endif

View File

@ -467,7 +467,7 @@ sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(
SkIRect::MakeWH(offsetBounds.width(), offsetBounds.height()),
kNeedNewImageUniqueID_SpecialImage,
sk_ref_sp(renderTargetContext->asDeferredTexture()),
sk_ref_sp(renderTargetContext->getColorSpace()));
renderTargetContext->refColorSpace());
}
#endif

View File

@ -312,7 +312,7 @@ sk_sp<SkSpecialImage> SkXfermodeImageFilter_Base::filterImageGPU(
SkIRect::MakeWH(bounds.width(), bounds.height()),
kNeedNewImageUniqueID_SpecialImage,
sk_ref_sp(renderTargetContext->asDeferredTexture()),
sk_ref_sp(renderTargetContext->getColorSpace()));
renderTargetContext->refColorSpace());
}
sk_sp<GrFragmentProcessor>

View File

@ -129,7 +129,7 @@ static SkImageInfo make_info(GrRenderTargetContext* context, int w, int h, bool
}
return SkImageInfo::Make(w, h, colorType,
opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType,
sk_ref_sp(context->getColorSpace()));
context->refColorSpace());
}
SkGpuDevice::SkGpuDevice(GrContext* context, sk_sp<GrRenderTargetContext> renderTargetContext,
@ -1800,7 +1800,7 @@ SkBaseDevice* SkGpuDevice::onCreateDevice(const CreateInfo& cinfo, const SkPaint
fit,
cinfo.fInfo.width(), cinfo.fInfo.height(),
fRenderTargetContext->config(),
sk_ref_sp(fRenderTargetContext->getColorSpace()),
fRenderTargetContext->refColorSpace(),
fRenderTargetContext->desc().fSampleCnt,
kDefault_GrSurfaceOrigin,
&props));

View File

@ -306,7 +306,7 @@ static sk_sp<SkImage> make_from_yuv_textures_copy(GrContext* ctx, SkYUVColorSpac
ctx->flushSurfaceWrites(renderTargetContext->accessRenderTarget());
return sk_make_sp<SkImage_Gpu>(width, height, kNeedNewImageUniqueID,
kOpaque_SkAlphaType, renderTargetContext->asTexture(),
sk_ref_sp(renderTargetContext->getColorSpace()), budgeted);
renderTargetContext->refColorSpace(), budgeted);
}
sk_sp<SkImage> SkImage::MakeFromYUVTexturesCopy(GrContext* ctx, SkYUVColorSpace colorSpace,