Fix ducky_yuv_blend in preabandoned context mode

TBR:robertphillips@google.com

Change-Id: I605cff35d5559597aab9129ebc83b9df81cb62ee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/306952
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2020-07-30 20:25:04 -04:00 committed by Skia Commit-Bot
parent 66fb075ad0
commit bcde9eec20

View File

@ -10,6 +10,7 @@
#include "include/core/SkPaint.h"
#include "include/core/SkYUVAIndex.h"
#include "include/core/SkYUVASizeInfo.h"
#include "include/gpu/GrRecordingContext.h"
#include "src/core/SkCachedData.h"
#include "src/image/SkImage_Base.h"
#include "tools/Resources.h"
@ -28,7 +29,7 @@ DEF_SIMPLE_GM_CAN_FAIL(ducky_yuv_blend, canvas, errorMsg, 560, 1130) {
// If we're on the GPU we do a second round of draws where the source image is YUV planes.
// Otherwise we just draw the original again,
if (auto* rContext = canvas->recordingContext()) {
if (auto* rContext = canvas->recordingContext(); rContext && !rContext->abandoned()) {
auto lazyYUV = sk_gpu_test::LazyYUVImage::Make(GetResourceAsData("images/ducky.jpg"));
if (lazyYUV) {
duckyFG[1] = lazyYUV->refImage(rContext);