blob: ad825e3d72c4d56cfdc24873b9bfad8ba0ce4f48 [file] [log] [blame]
Brian Salomon201700f2019-05-17 12:05:44 -04001/*
2 * Copyright 2019 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "gm/gm.h"
9#include "include/core/SkCanvas.h"
10#include "include/core/SkColor.h"
11#include "include/core/SkPaint.h"
12#include "include/core/SkRect.h"
13#include "include/core/SkSurface.h"
Brian Salomon024bd002019-06-11 11:38:16 -040014#include "include/core/SkYUVAIndex.h"
Brian Salomon201700f2019-05-17 12:05:44 -040015#include "include/gpu/GrContext.h"
16#include "src/core/SkAutoPixmapStorage.h"
17#include "src/core/SkConvertPixels.h"
Brian Salomon024bd002019-06-11 11:38:16 -040018#include "src/core/SkScopeExit.h"
19#include "src/gpu/GrContextPriv.h"
Brian Salomon201700f2019-05-17 12:05:44 -040020#include "tools/Resources.h"
21#include "tools/ToolUtils.h"
22
Brian Salomon9241a6d2019-10-03 13:26:54 -040023namespace {
24struct AsyncContext {
25 bool fCalled = false;
Brian Salomon63a0a752020-06-26 13:32:09 -040026 std::unique_ptr<const SkImage::AsyncReadResult> fResult;
Brian Salomon9241a6d2019-10-03 13:26:54 -040027};
28} // anonymous namespace
29
30// Making this a lambda in the test functions caused:
31// "error: cannot compile this forwarded non-trivially copyable parameter yet"
32// on x86/Win/Clang bot, referring to 'result'.
Brian Salomon63a0a752020-06-26 13:32:09 -040033static void async_callback(void* c, std::unique_ptr<const SkImage::AsyncReadResult> result) {
Brian Salomon9241a6d2019-10-03 13:26:54 -040034 auto context = static_cast<AsyncContext*>(c);
35 context->fResult = std::move(result);
36 context->fCalled = true;
37};
38
Brian Salomon201700f2019-05-17 12:05:44 -040039// Draws the image to a surface, does a asyncRescaleAndReadPixels of the image, and then sticks
40// the result in a raster image.
Brian Salomon63a0a752020-06-26 13:32:09 -040041template <typename Src>
42static sk_sp<SkImage> do_read_and_scale(Src* src,
43 GrContext* context,
44 const SkIRect& srcRect,
45 const SkImageInfo& ii,
46 SkImage::RescaleGamma rescaleGamma,
Brian Salomon286b5572019-05-20 10:25:50 -040047 SkFilterQuality quality) {
Brian Salomon63a0a752020-06-26 13:32:09 -040048 auto* asyncContext = new AsyncContext();
49 src->asyncRescaleAndReadPixels(ii, srcRect, rescaleGamma, quality, async_callback,
50 asyncContext);
51 if (context) {
52 context->submit();
Brian Salomon39278022020-06-02 11:47:26 -040053 }
Brian Salomon63a0a752020-06-26 13:32:09 -040054 while (!asyncContext->fCalled) {
Brian Salomon9c219782019-10-02 22:51:08 +000055 // Only GPU should actually be asynchronous.
Brian Salomon63a0a752020-06-26 13:32:09 -040056 SkASSERT(context);
57 context->checkAsyncWorkCompletion();
Brian Salomon9c219782019-10-02 22:51:08 +000058 }
Brian Salomon63a0a752020-06-26 13:32:09 -040059 if (!asyncContext->fResult) {
Brian Salomon9241a6d2019-10-03 13:26:54 -040060 return nullptr;
61 }
Brian Salomon63a0a752020-06-26 13:32:09 -040062 SkPixmap pixmap(ii, asyncContext->fResult->data(0), asyncContext->fResult->rowBytes(0));
Brian Salomon9241a6d2019-10-03 13:26:54 -040063 auto releasePixels = [](const void*, void* c) { delete static_cast<AsyncContext*>(c); };
Brian Salomon63a0a752020-06-26 13:32:09 -040064 return SkImage::MakeFromRaster(pixmap, releasePixels, asyncContext);
Ravi Mistrycb550102019-10-03 09:06:25 +000065}
66
Brian Salomon63a0a752020-06-26 13:32:09 -040067template <typename Src>
68static sk_sp<SkImage> do_read_and_scale_yuv(Src* src,
69 GrContext* context,
70 SkYUVColorSpace yuvCS,
71 const SkIRect& srcRect,
72 SkISize size,
73 SkImage::RescaleGamma rescaleGamma,
74 SkFilterQuality quality,
75 SkScopeExit* cleanup) {
Brian Salomon9241a6d2019-10-03 13:26:54 -040076 SkASSERT(!(size.width() & 0b1) && !(size.height() & 0b1));
Ravi Mistrycb550102019-10-03 09:06:25 +000077
Brian Salomon9241a6d2019-10-03 13:26:54 -040078 SkISize uvSize = {size.width()/2, size.height()/2};
79 SkImageInfo yII = SkImageInfo::Make(size, kGray_8_SkColorType, kPremul_SkAlphaType);
80 SkImageInfo uvII = SkImageInfo::Make(uvSize, kGray_8_SkColorType, kPremul_SkAlphaType);
Ravi Mistrycb550102019-10-03 09:06:25 +000081
Brian Salomon63a0a752020-06-26 13:32:09 -040082 AsyncContext asyncContext;
83 src->asyncRescaleAndReadPixelsYUV420(yuvCS, SkColorSpace::MakeSRGB(), srcRect, size,
84 rescaleGamma, quality, async_callback, &asyncContext);
85 if (context) {
86 context->submit();
Brian Salomon39278022020-06-02 11:47:26 -040087 }
Brian Salomon63a0a752020-06-26 13:32:09 -040088 while (!asyncContext.fCalled) {
Ravi Mistrycb550102019-10-03 09:06:25 +000089 // Only GPU should actually be asynchronous.
Brian Salomon63a0a752020-06-26 13:32:09 -040090 SkASSERT(context);
91 context->checkAsyncWorkCompletion();
Ravi Mistrycb550102019-10-03 09:06:25 +000092 }
Brian Salomon63a0a752020-06-26 13:32:09 -040093 if (!asyncContext.fResult) {
Brian Salomoncd5caa32019-06-11 17:02:19 -040094 return nullptr;
95 }
Brian Salomon024bd002019-06-11 11:38:16 -040096 GrBackendTexture backendTextures[3];
Robert Phillips0a15cc62019-07-30 12:49:10 -040097
Brian Salomon63a0a752020-06-26 13:32:09 -040098 SkPixmap yPM(yII, asyncContext.fResult->data(0), asyncContext.fResult->rowBytes(0));
99 SkPixmap uPM(uvII, asyncContext.fResult->data(1), asyncContext.fResult->rowBytes(1));
100 SkPixmap vPM(uvII, asyncContext.fResult->data(2), asyncContext.fResult->rowBytes(2));
Brian Salomon9241a6d2019-10-03 13:26:54 -0400101
Brian Salomon63a0a752020-06-26 13:32:09 -0400102 backendTextures[0] = context->createBackendTexture(yPM, GrRenderable::kNo, GrProtected::kNo);
103 backendTextures[1] = context->createBackendTexture(uPM, GrRenderable::kNo, GrProtected::kNo);
104 backendTextures[2] = context->createBackendTexture(vPM, GrRenderable::kNo, GrProtected::kNo);
Brian Salomon9241a6d2019-10-03 13:26:54 -0400105
Robert Phillips2e1142c2019-08-14 12:33:29 -0400106 SkYUVAIndex indices[4] = {
107 { 0, SkColorChannel::kR},
108 { 1, SkColorChannel::kR},
109 { 2, SkColorChannel::kR},
110 {-1, SkColorChannel::kR}
111 };
112
Brian Salomon63a0a752020-06-26 13:32:09 -0400113 *cleanup = {[context, backendTextures] {
Brian Salomon024bd002019-06-11 11:38:16 -0400114 GrFlushInfo flushInfo;
115 flushInfo.fFlags = kSyncCpu_GrFlushFlag;
Brian Salomon63a0a752020-06-26 13:32:09 -0400116 context->flush(flushInfo);
117 context->submit(true);
118 context->deleteBackendTexture(backendTextures[0]);
119 context->deleteBackendTexture(backendTextures[1]);
120 context->deleteBackendTexture(backendTextures[2]);
Brian Salomon024bd002019-06-11 11:38:16 -0400121 }};
122
Brian Salomon63a0a752020-06-26 13:32:09 -0400123 return SkImage::MakeFromYUVATextures(context, yuvCS, backendTextures, indices, size,
Brian Salomon024bd002019-06-11 11:38:16 -0400124 kTopLeft_GrSurfaceOrigin, SkColorSpace::MakeSRGB());
125}
126
Brian Salomon201700f2019-05-17 12:05:44 -0400127// Draws a grid of rescales. The columns are none, low, and high filter quality. The rows are
128// rescale in src gamma and rescale in linear gamma.
Brian Salomon63a0a752020-06-26 13:32:09 -0400129template <typename Src>
130static skiagm::DrawResult do_rescale_grid(SkCanvas* canvas,
131 Src* src,
132 GrContext* context,
133 const SkIRect& srcRect,
134 SkISize newSize,
135 bool doYUV420,
136 SkString* errorMsg,
137 int pad = 0) {
Brian Salomon024bd002019-06-11 11:38:16 -0400138 if (doYUV420) {
Brian Salomoncd5caa32019-06-11 17:02:19 -0400139 if (!canvas->getGrContext() || !canvas->getGrContext()->priv().asDirectContext()) {
140 errorMsg->printf("YUV420 only supported on direct GPU for now.");
Brian Salomon024bd002019-06-11 11:38:16 -0400141 return skiagm::DrawResult::kSkip;
142 }
143 }
Brian Salomon201700f2019-05-17 12:05:44 -0400144 if (canvas->imageInfo().colorType() == kUnknown_SkColorType) {
145 *errorMsg = "Not supported on recording/vector backends.";
146 return skiagm::DrawResult::kSkip;
147 }
Brian Salomon9241a6d2019-10-03 13:26:54 -0400148 const auto ii = canvas->imageInfo().makeDimensions(newSize);
Brian Salomona34e0fc2019-05-17 19:56:59 +0000149
Brian Salomon024bd002019-06-11 11:38:16 -0400150 SkYUVColorSpace yuvColorSpace = kRec601_SkYUVColorSpace;
Brian Salomona34e0fc2019-05-17 19:56:59 +0000151 canvas->save();
Brian Salomon63a0a752020-06-26 13:32:09 -0400152 for (auto gamma : {SkImage::RescaleGamma::kSrc, SkImage::RescaleGamma::kLinear}) {
Brian Salomona34e0fc2019-05-17 19:56:59 +0000153 canvas->save();
154 for (auto quality : {kNone_SkFilterQuality, kLow_SkFilterQuality, kHigh_SkFilterQuality}) {
Brian Salomon024bd002019-06-11 11:38:16 -0400155 SkScopeExit cleanup;
156 sk_sp<SkImage> result;
157 if (doYUV420) {
Brian Salomon63a0a752020-06-26 13:32:09 -0400158 result = do_read_and_scale_yuv(src, context, yuvColorSpace, srcRect, newSize, gamma,
Brian Salomon024bd002019-06-11 11:38:16 -0400159 quality, &cleanup);
Brian Salomoncd5caa32019-06-11 17:02:19 -0400160 if (!result) {
161 errorMsg->printf("YUV420 async call failed. Allowed for now.");
162 return skiagm::DrawResult::kSkip;
163 }
Brian Salomon024bd002019-06-11 11:38:16 -0400164 int nextCS = static_cast<int>(yuvColorSpace + 1) % (kLastEnum_SkYUVColorSpace + 1);
165 yuvColorSpace = static_cast<SkYUVColorSpace>(nextCS);
166 } else {
Brian Salomon63a0a752020-06-26 13:32:09 -0400167 result = do_read_and_scale(src, context, srcRect, ii, gamma, quality);
Brian Salomoncd5caa32019-06-11 17:02:19 -0400168 if (!result) {
169 errorMsg->printf("async read call failed.");
170 return skiagm::DrawResult::kFail;
171 }
Brian Salomon024bd002019-06-11 11:38:16 -0400172 }
173 canvas->drawImage(result, 0, 0);
Brian Salomon9241a6d2019-10-03 13:26:54 -0400174 canvas->translate(newSize.width() + pad, 0);
Brian Salomona34e0fc2019-05-17 19:56:59 +0000175 }
176 canvas->restore();
Brian Salomon9241a6d2019-10-03 13:26:54 -0400177 canvas->translate(0, newSize.height() + pad);
Brian Salomon451b01f2019-05-17 12:39:17 -0400178 }
Brian Salomona34e0fc2019-05-17 19:56:59 +0000179 canvas->restore();
180 return skiagm::DrawResult::kOk;
Brian Salomon451b01f2019-05-17 12:39:17 -0400181}
182
Brian Salomon63a0a752020-06-26 13:32:09 -0400183static skiagm::DrawResult do_rescale_image_grid(SkCanvas* canvas,
184 const char* imageFile,
185 const SkIRect& srcRect,
186 SkISize newSize,
187 bool doSurface,
188 bool doYUV420,
189 SkString* errorMsg) {
Brian Salomon286b5572019-05-20 10:25:50 -0400190 auto image = GetResourceAsImage(imageFile);
191 if (!image) {
192 errorMsg->printf("Could not load image file %s.", imageFile);
193 return skiagm::DrawResult::kFail;
194 }
195 if (canvas->imageInfo().colorType() == kUnknown_SkColorType) {
196 *errorMsg = "Not supported on recording/vector backends.";
197 return skiagm::DrawResult::kSkip;
198 }
Brian Salomon63a0a752020-06-26 13:32:09 -0400199 if (doSurface) {
200 // Turn the image into a surface in order to call the read and rescale API
201 auto surfInfo = image->imageInfo().makeDimensions(image->dimensions());
202 auto surface = canvas->makeSurface(surfInfo);
203 if (!surface && surfInfo.colorType() == kBGRA_8888_SkColorType) {
204 surfInfo = surfInfo.makeColorType(kRGBA_8888_SkColorType);
205 surface = canvas->makeSurface(surfInfo);
Brian Salomon1caf3782020-06-26 17:06:31 +0000206 }
Brian Salomon63a0a752020-06-26 13:32:09 -0400207 if (!surface) {
208 *errorMsg = "Could not create surface for image.";
209 // When testing abandoned GrContext we expect surface creation to fail.
210 if (canvas->getGrContext() && canvas->getGrContext()->abandoned()) {
211 return skiagm::DrawResult::kSkip;
212 }
213 return skiagm::DrawResult::kFail;
214 }
215 SkPaint paint;
216 paint.setBlendMode(SkBlendMode::kSrc);
217 surface->getCanvas()->drawImage(image, 0, 0, &paint);
218 return do_rescale_grid(canvas, surface.get(), canvas->getGrContext(), srcRect, newSize,
219 doYUV420, errorMsg);
220 } else if (auto ctx = canvas->getGrContext()) {
221 image = image->makeTextureImage(ctx);
222 if (!image) {
223 *errorMsg = "Could not create image.";
224 // When testing abandoned GrContext we expect surface creation to fail.
225 if (canvas->getGrContext() && canvas->getGrContext()->abandoned()) {
226 return skiagm::DrawResult::kSkip;
227 }
228 return skiagm::DrawResult::kFail;
229 }
Brian Salomon1caf3782020-06-26 17:06:31 +0000230 }
Brian Salomon63a0a752020-06-26 13:32:09 -0400231 return do_rescale_grid(canvas, image.get(), canvas->getGrContext(), srcRect, newSize, doYUV420,
232 errorMsg);
Brian Salomon286b5572019-05-20 10:25:50 -0400233}
234
Brian Salomon63a0a752020-06-26 13:32:09 -0400235#define DEF_RESCALE_AND_READ_SURF_GM(IMAGE_FILE, TAG, SRC_RECT, W, H) \
236 DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_##TAG, canvas, errorMsg, 3 * W, 2 * H) { \
237 ToolUtils::draw_checkerboard(canvas, SK_ColorDKGRAY, SK_ColorLTGRAY, 25); \
238 return do_rescale_image_grid(canvas, #IMAGE_FILE, SRC_RECT, {W, H}, true, false, \
239 errorMsg); \
Brian Salomon201700f2019-05-17 12:05:44 -0400240 }
241
Brian Salomon63a0a752020-06-26 13:32:09 -0400242#define DEF_RESCALE_AND_READ_YUV_SURF_GM(IMAGE_FILE, TAG, SRC_RECT, W, H) \
243 DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_yuv420_##TAG, canvas, errorMsg, 3 * W, 2 * H) { \
244 ToolUtils::draw_checkerboard(canvas, SK_ColorDKGRAY, SK_ColorLTGRAY, 25); \
245 return do_rescale_image_grid(canvas, #IMAGE_FILE, SRC_RECT, {W, H}, true, true, errorMsg); \
Brian Salomon024bd002019-06-11 11:38:16 -0400246 }
247
Brian Salomon63a0a752020-06-26 13:32:09 -0400248#define DEF_RESCALE_AND_READ_IMG_GM(IMAGE_FILE, TAG, SRC_RECT, W, H) \
249 DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_##TAG, canvas, errorMsg, 3 * W, 2 * H) { \
250 ToolUtils::draw_checkerboard(canvas, SK_ColorDKGRAY, SK_ColorLTGRAY, 25); \
251 return do_rescale_image_grid(canvas, #IMAGE_FILE, SRC_RECT, {W, H}, false, false, \
252 errorMsg); \
253 }
Brian Salomon024bd002019-06-11 11:38:16 -0400254
Brian Salomon63a0a752020-06-26 13:32:09 -0400255#define DEF_RESCALE_AND_READ_YUV_IMG_GM(IMAGE_FILE, TAG, SRC_RECT, W, H) \
256 DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_yuv420_##TAG, canvas, errorMsg, 3 * W, 2 * H) { \
257 ToolUtils::draw_checkerboard(canvas, SK_ColorDKGRAY, SK_ColorLTGRAY, 25); \
258 return do_rescale_image_grid(canvas, #IMAGE_FILE, SRC_RECT, {W, H}, true, true, errorMsg); \
259 }
Brian Salomon201700f2019-05-17 12:05:44 -0400260
Brian Salomon63a0a752020-06-26 13:32:09 -0400261DEF_RESCALE_AND_READ_YUV_SURF_GM(
262 images/yellow_rose.webp, rose, SkIRect::MakeXYWH(50, 5, 200, 150), 410, 376)
Brian Salomon201700f2019-05-17 12:05:44 -0400263
Brian Salomon63a0a752020-06-26 13:32:09 -0400264DEF_RESCALE_AND_READ_YUV_IMG_GM(
265 images/yellow_rose.webp, rose_down, SkIRect::MakeXYWH(50, 5, 200, 150), 106, 60)
266
267DEF_RESCALE_AND_READ_SURF_GM(
268 images/yellow_rose.webp, rose, SkIRect::MakeXYWH(100, 20, 100, 100), 410, 410)
269
270DEF_RESCALE_AND_READ_SURF_GM(images/dog.jpg, dog_down, SkIRect::MakeXYWH(0, 10, 180, 150), 45, 45)
271DEF_RESCALE_AND_READ_IMG_GM(images/dog.jpg, dog_up, SkIRect::MakeWH(180, 180), 800, 400)
272
273DEF_RESCALE_AND_READ_IMG_GM(
274 images/text.png, text_down, SkIRect::MakeWH(637, 105), (int)(0.7 * 637), (int)(0.7 * 105))
275DEF_RESCALE_AND_READ_SURF_GM(
276 images/text.png, text_up, SkIRect::MakeWH(637, 105), (int)(1.2 * 637), (int)(1.2 * 105))
277DEF_RESCALE_AND_READ_IMG_GM(images/text.png,
278 text_up_large,
279 SkIRect::MakeXYWH(300, 0, 300, 105),
280 (int)(2.4 * 300),
281 (int)(2.4 * 105))
Brian Salomon286b5572019-05-20 10:25:50 -0400282
Brian Salomona7e5c7c2020-01-27 15:41:40 -0500283// Exercises non-scaling YUV420. Reads from the original canvas's surface in order to
284// exercise case where source surface is not a texture (in glbert config).
285DEF_SIMPLE_GM_CAN_FAIL(async_yuv_no_scale, canvas, errorMsg, 400, 300) {
286 auto surface = canvas->getSurface();
287 if (!surface) {
288 *errorMsg = "Not supported on recording/vector backends.";
289 return skiagm::DrawResult::kSkip;
290 }
291
292 auto image = GetResourceAsImage("images/yellow_rose.webp");
293 if (!image) {
294 return skiagm::DrawResult::kFail;
295 }
296 SkPaint paint;
297 canvas->drawImage(image.get(), 0, 0);
298
299 SkScopeExit scopeExit;
300 auto yuvImage = do_read_and_scale_yuv(
Brian Salomon63a0a752020-06-26 13:32:09 -0400301 surface, surface->getContext(), kRec601_SkYUVColorSpace, SkIRect::MakeWH(400, 300),
302 {400, 300}, SkImage::RescaleGamma::kSrc, kNone_SkFilterQuality, &scopeExit);
Brian Salomona7e5c7c2020-01-27 15:41:40 -0500303
304 canvas->clear(SK_ColorWHITE);
305 canvas->drawImage(yuvImage.get(), 0, 0);
306
307 return skiagm::DrawResult::kOk;
308}
309
Brian Salomon286b5572019-05-20 10:25:50 -0400310DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_no_bleed, canvas, errorMsg, 60, 60) {
311 if (canvas->imageInfo().colorType() == kUnknown_SkColorType) {
312 *errorMsg = "Not supported on recording/vector backends.";
313 return skiagm::DrawResult::kSkip;
314 }
315
316 static constexpr int kBorder = 5;
317 static constexpr int kInner = 5;
318 const auto srcRect = SkIRect::MakeXYWH(kBorder, kBorder, kInner, kInner);
319 auto surfaceII =
320 SkImageInfo::Make(kInner + 2 * kBorder, kInner + 2 * kBorder, kRGBA_8888_SkColorType,
321 kPremul_SkAlphaType, SkColorSpace::MakeSRGB());
322 auto surface = canvas->makeSurface(surfaceII);
Brian Salomonaf9b7b92019-05-20 12:19:37 -0400323 if (!surface) {
324 *errorMsg = "Could not create surface for image.";
Brian Salomon9be911c2019-05-20 14:01:21 -0400325 // When testing abandoned GrContext we expect surface creation to fail.
326 if (canvas->getGrContext() && canvas->getGrContext()->abandoned()) {
327 return skiagm::DrawResult::kSkip;
328 }
Brian Salomonaf9b7b92019-05-20 12:19:37 -0400329 return skiagm::DrawResult::kFail;
330 }
Brian Salomon286b5572019-05-20 10:25:50 -0400331 surface->getCanvas()->clear(SK_ColorRED);
332 surface->getCanvas()->save();
333 surface->getCanvas()->clipRect(SkRect::Make(srcRect), SkClipOp::kIntersect, false);
334 surface->getCanvas()->clear(SK_ColorBLUE);
335 surface->getCanvas()->restore();
336 static constexpr int kPad = 2;
337 canvas->translate(kPad, kPad);
338 skiagm::DrawResult result;
Brian Salomon9241a6d2019-10-03 13:26:54 -0400339 SkISize downSize = {static_cast<int>(kInner/2), static_cast<int>(kInner / 2)};
Brian Salomon63a0a752020-06-26 13:32:09 -0400340 GrContext* context = canvas->getGrContext();
341 result = do_rescale_grid(canvas, surface.get(), context, srcRect, downSize, false, errorMsg,
342 kPad);
343
Brian Salomon286b5572019-05-20 10:25:50 -0400344 if (result != skiagm::DrawResult::kOk) {
345 return result;
346 }
Mike Kleinf68213f2020-01-27 12:16:22 -0600347 canvas->translate(0, 4 * downSize.height());
Brian Salomon9241a6d2019-10-03 13:26:54 -0400348 SkISize upSize = {static_cast<int>(kInner * 3.5), static_cast<int>(kInner * 4.6)};
Brian Salomon63a0a752020-06-26 13:32:09 -0400349 result =
350 do_rescale_grid(canvas, surface.get(), context, srcRect, upSize, false, errorMsg, kPad);
Brian Salomon286b5572019-05-20 10:25:50 -0400351 if (result != skiagm::DrawResult::kOk) {
352 return result;
353 }
354 return skiagm::DrawResult::kOk;
355}