@@ -306,7 +306,8 @@ sk_sp<SkImage> SkImage::MakeTextureFromCompressed(GrDirectContext* direct, sk_sp
306306 colorType, kOpaque_SkAlphaType , nullptr );
307307}
308308
309- sk_sp<SkImage> SkImage_Gpu::ConvertYUVATexturesToRGB (GrContext* ctx, SkYUVColorSpace yuvColorSpace,
309+ sk_sp<SkImage> SkImage_Gpu::ConvertYUVATexturesToRGB (GrRecordingContext* rContext,
310+ SkYUVColorSpace yuvColorSpace,
310311 const GrBackendTexture yuvaTextures[],
311312 const SkYUVAIndex yuvaIndices[4 ], SkISize size,
312313 GrSurfaceOrigin origin,
@@ -319,45 +320,48 @@ sk_sp<SkImage> SkImage_Gpu::ConvertYUVATexturesToRGB(GrContext* ctx, SkYUVColorS
319320 }
320321
321322 GrSurfaceProxyView tempViews[4 ];
322- if (!SkImage_GpuBase::MakeTempTextureProxies (ctx , yuvaTextures, numTextures, yuvaIndices,
323+ if (!SkImage_GpuBase::MakeTempTextureProxies (rContext , yuvaTextures, numTextures, yuvaIndices,
323324 origin, tempViews, nullptr )) {
324325 return nullptr ;
325326 }
326327
327328 const SkRect rect = SkRect::MakeIWH (size.width (), size.height ());
328- if (!RenderYUVAToRGBA (ctx, renderTargetContext, rect, yuvColorSpace, nullptr ,
329+ const GrCaps& caps = *rContext->priv ().caps ();
330+ if (!RenderYUVAToRGBA (caps, renderTargetContext, rect, yuvColorSpace, nullptr ,
329331 tempViews, yuvaIndices)) {
330332 return nullptr ;
331333 }
332334
333335 SkColorType ct = GrColorTypeToSkColorType (renderTargetContext->colorInfo ().colorType ());
334336 SkAlphaType at = GetAlphaTypeFromYUVAIndices (yuvaIndices);
337+ // TODO: Remove this use of backdoor.
338+ GrContext* backdoorGrCtx = rContext->priv ().backdoor ();
335339 // MDB: this call is okay bc we know 'renderTargetContext' was exact
336- return sk_make_sp<SkImage_Gpu>(sk_ref_sp (ctx ), kNeedNewImageUniqueID ,
340+ return sk_make_sp<SkImage_Gpu>(sk_ref_sp (backdoorGrCtx ), kNeedNewImageUniqueID ,
337341 renderTargetContext->readSurfaceView (), ct, at,
338342 renderTargetContext->colorInfo ().refColorSpace ());
339343}
340344
341- sk_sp<SkImage> SkImage::MakeFromYUVATexturesCopy (GrContext* ctx ,
345+ sk_sp<SkImage> SkImage::MakeFromYUVATexturesCopy (GrRecordingContext* rContext ,
342346 SkYUVColorSpace yuvColorSpace,
343347 const GrBackendTexture yuvaTextures[],
344348 const SkYUVAIndex yuvaIndices[4 ],
345349 SkISize imageSize,
346350 GrSurfaceOrigin imageOrigin,
347351 sk_sp<SkColorSpace> imageColorSpace) {
348352 auto renderTargetContext = GrRenderTargetContext::Make (
349- ctx , GrColorType::kRGBA_8888 , std::move (imageColorSpace), SkBackingFit::kExact ,
353+ rContext , GrColorType::kRGBA_8888 , std::move (imageColorSpace), SkBackingFit::kExact ,
350354 imageSize, 1 , GrMipmapped::kNo , GrProtected::kNo , imageOrigin);
351355 if (!renderTargetContext) {
352356 return nullptr ;
353357 }
354358
355- return SkImage_Gpu::ConvertYUVATexturesToRGB (ctx , yuvColorSpace, yuvaTextures, yuvaIndices,
359+ return SkImage_Gpu::ConvertYUVATexturesToRGB (rContext , yuvColorSpace, yuvaTextures, yuvaIndices,
356360 imageSize, imageOrigin, renderTargetContext.get ());
357361}
358362
359363sk_sp<SkImage> SkImage::MakeFromYUVATexturesCopyWithExternalBackend (
360- GrContext* ctx ,
364+ GrRecordingContext* rContext ,
361365 SkYUVColorSpace yuvColorSpace,
362366 const GrBackendTexture yuvaTextures[],
363367 const SkYUVAIndex yuvaIndices[4 ],
@@ -367,7 +371,7 @@ sk_sp<SkImage> SkImage::MakeFromYUVATexturesCopyWithExternalBackend(
367371 sk_sp<SkColorSpace> imageColorSpace,
368372 TextureReleaseProc textureReleaseProc,
369373 ReleaseContext releaseContext) {
370- const GrCaps* caps = ctx ->priv ().caps ();
374+ const GrCaps* caps = rContext ->priv ().caps ();
371375
372376 sk_sp<GrRefCntedCallback> releaseHelper;
373377 if (textureReleaseProc) {
@@ -389,13 +393,13 @@ sk_sp<SkImage> SkImage::MakeFromYUVATexturesCopyWithExternalBackend(
389393 // Needs to create a render target with external texture
390394 // in order to draw to it for the yuv->rgb conversion.
391395 auto renderTargetContext = GrRenderTargetContext::MakeFromBackendTexture (
392- ctx , grColorType, std::move (imageColorSpace), backendTexture, 1 , imageOrigin,
396+ rContext , grColorType, std::move (imageColorSpace), backendTexture, 1 , imageOrigin,
393397 nullptr , std::move (releaseHelper));
394398 if (!renderTargetContext) {
395399 return nullptr ;
396400 }
397401
398- return SkImage_Gpu::ConvertYUVATexturesToRGB (ctx , yuvColorSpace, yuvaTextures, yuvaIndices,
402+ return SkImage_Gpu::ConvertYUVATexturesToRGB (rContext , yuvColorSpace, yuvaTextures, yuvaIndices,
399403 imageSize, imageOrigin, renderTargetContext.get ());
400404}
401405
0 commit comments