blob: f61ec15ea25e0be66f01e77579234c2082c13f18 [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"
Robert Phillipsb7bfbc22020-07-01 12:55:01 -040016#include "include/gpu/GrRecordingContext.h"
Brian Salomon201700f2019-05-17 12:05:44 -040017#include "src/core/SkAutoPixmapStorage.h"
18#include "src/core/SkConvertPixels.h"
Brian Salomon024bd002019-06-11 11:38:16 -040019#include "src/core/SkScopeExit.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] {
Greg Danielce9f0162020-06-30 13:42:46 -0400114 context->flush();
Brian Salomon63a0a752020-06-26 13:32:09 -0400115 context->submit(true);
116 context->deleteBackendTexture(backendTextures[0]);
117 context->deleteBackendTexture(backendTextures[1]);
118 context->deleteBackendTexture(backendTextures[2]);
Brian Salomon024bd002019-06-11 11:38:16 -0400119 }};
120
Brian Salomon63a0a752020-06-26 13:32:09 -0400121 return SkImage::MakeFromYUVATextures(context, yuvCS, backendTextures, indices, size,
Brian Salomon024bd002019-06-11 11:38:16 -0400122 kTopLeft_GrSurfaceOrigin, SkColorSpace::MakeSRGB());
123}
124
Brian Salomon201700f2019-05-17 12:05:44 -0400125// Draws a grid of rescales. The columns are none, low, and high filter quality. The rows are
126// rescale in src gamma and rescale in linear gamma.
Brian Salomon63a0a752020-06-26 13:32:09 -0400127template <typename Src>
128static skiagm::DrawResult do_rescale_grid(SkCanvas* canvas,
129 Src* src,
130 GrContext* context,
131 const SkIRect& srcRect,
132 SkISize newSize,
133 bool doYUV420,
134 SkString* errorMsg,
135 int pad = 0) {
Adlai Hollere3ad5272020-07-07 10:27:55 -0400136 if (doYUV420 && !GrAsDirectContext(canvas->recordingContext())) {
137 errorMsg->printf("YUV420 only supported on direct GPU for now.");
138 return skiagm::DrawResult::kSkip;
Brian Salomon024bd002019-06-11 11:38:16 -0400139 }
Brian Salomon201700f2019-05-17 12:05:44 -0400140 if (canvas->imageInfo().colorType() == kUnknown_SkColorType) {
141 *errorMsg = "Not supported on recording/vector backends.";
142 return skiagm::DrawResult::kSkip;
143 }
Brian Salomon9241a6d2019-10-03 13:26:54 -0400144 const auto ii = canvas->imageInfo().makeDimensions(newSize);
Brian Salomona34e0fc2019-05-17 19:56:59 +0000145
Brian Salomon024bd002019-06-11 11:38:16 -0400146 SkYUVColorSpace yuvColorSpace = kRec601_SkYUVColorSpace;
Brian Salomona34e0fc2019-05-17 19:56:59 +0000147 canvas->save();
Brian Salomon63a0a752020-06-26 13:32:09 -0400148 for (auto gamma : {SkImage::RescaleGamma::kSrc, SkImage::RescaleGamma::kLinear}) {
Brian Salomona34e0fc2019-05-17 19:56:59 +0000149 canvas->save();
150 for (auto quality : {kNone_SkFilterQuality, kLow_SkFilterQuality, kHigh_SkFilterQuality}) {
Brian Salomon024bd002019-06-11 11:38:16 -0400151 SkScopeExit cleanup;
152 sk_sp<SkImage> result;
153 if (doYUV420) {
Brian Salomon63a0a752020-06-26 13:32:09 -0400154 result = do_read_and_scale_yuv(src, context, yuvColorSpace, srcRect, newSize, gamma,
Brian Salomon024bd002019-06-11 11:38:16 -0400155 quality, &cleanup);
Brian Salomoncd5caa32019-06-11 17:02:19 -0400156 if (!result) {
157 errorMsg->printf("YUV420 async call failed. Allowed for now.");
158 return skiagm::DrawResult::kSkip;
159 }
Brian Salomon024bd002019-06-11 11:38:16 -0400160 int nextCS = static_cast<int>(yuvColorSpace + 1) % (kLastEnum_SkYUVColorSpace + 1);
161 yuvColorSpace = static_cast<SkYUVColorSpace>(nextCS);
162 } else {
Brian Salomon63a0a752020-06-26 13:32:09 -0400163 result = do_read_and_scale(src, context, srcRect, ii, gamma, quality);
Brian Salomoncd5caa32019-06-11 17:02:19 -0400164 if (!result) {
165 errorMsg->printf("async read call failed.");
166 return skiagm::DrawResult::kFail;
167 }
Brian Salomon024bd002019-06-11 11:38:16 -0400168 }
169 canvas->drawImage(result, 0, 0);
Brian Salomon9241a6d2019-10-03 13:26:54 -0400170 canvas->translate(newSize.width() + pad, 0);
Brian Salomona34e0fc2019-05-17 19:56:59 +0000171 }
172 canvas->restore();
Brian Salomon9241a6d2019-10-03 13:26:54 -0400173 canvas->translate(0, newSize.height() + pad);
Brian Salomon451b01f2019-05-17 12:39:17 -0400174 }
Brian Salomona34e0fc2019-05-17 19:56:59 +0000175 canvas->restore();
176 return skiagm::DrawResult::kOk;
Brian Salomon451b01f2019-05-17 12:39:17 -0400177}
178
Brian Salomon63a0a752020-06-26 13:32:09 -0400179static skiagm::DrawResult do_rescale_image_grid(SkCanvas* canvas,
180 const char* imageFile,
181 const SkIRect& srcRect,
182 SkISize newSize,
183 bool doSurface,
184 bool doYUV420,
185 SkString* errorMsg) {
Brian Salomon286b5572019-05-20 10:25:50 -0400186 auto image = GetResourceAsImage(imageFile);
187 if (!image) {
188 errorMsg->printf("Could not load image file %s.", imageFile);
189 return skiagm::DrawResult::kFail;
190 }
191 if (canvas->imageInfo().colorType() == kUnknown_SkColorType) {
192 *errorMsg = "Not supported on recording/vector backends.";
193 return skiagm::DrawResult::kSkip;
194 }
Brian Salomon63a0a752020-06-26 13:32:09 -0400195 if (doSurface) {
196 // Turn the image into a surface in order to call the read and rescale API
197 auto surfInfo = image->imageInfo().makeDimensions(image->dimensions());
198 auto surface = canvas->makeSurface(surfInfo);
199 if (!surface && surfInfo.colorType() == kBGRA_8888_SkColorType) {
200 surfInfo = surfInfo.makeColorType(kRGBA_8888_SkColorType);
201 surface = canvas->makeSurface(surfInfo);
Brian Salomon1caf3782020-06-26 17:06:31 +0000202 }
Brian Salomon63a0a752020-06-26 13:32:09 -0400203 if (!surface) {
204 *errorMsg = "Could not create surface for image.";
205 // When testing abandoned GrContext we expect surface creation to fail.
Robert Phillips9eb00022020-06-30 15:30:12 -0400206 if (canvas->recordingContext() && canvas->recordingContext()->abandoned()) {
Brian Salomon63a0a752020-06-26 13:32:09 -0400207 return skiagm::DrawResult::kSkip;
208 }
209 return skiagm::DrawResult::kFail;
210 }
211 SkPaint paint;
212 paint.setBlendMode(SkBlendMode::kSrc);
213 surface->getCanvas()->drawImage(image, 0, 0, &paint);
214 return do_rescale_grid(canvas, surface.get(), canvas->getGrContext(), srcRect, newSize,
215 doYUV420, errorMsg);
216 } else if (auto ctx = canvas->getGrContext()) {
217 image = image->makeTextureImage(ctx);
218 if (!image) {
219 *errorMsg = "Could not create image.";
220 // When testing abandoned GrContext we expect surface creation to fail.
Robert Phillips9eb00022020-06-30 15:30:12 -0400221 if (canvas->recordingContext() && canvas->recordingContext()->abandoned()) {
Brian Salomon63a0a752020-06-26 13:32:09 -0400222 return skiagm::DrawResult::kSkip;
223 }
224 return skiagm::DrawResult::kFail;
225 }
Brian Salomon1caf3782020-06-26 17:06:31 +0000226 }
Brian Salomon63a0a752020-06-26 13:32:09 -0400227 return do_rescale_grid(canvas, image.get(), canvas->getGrContext(), srcRect, newSize, doYUV420,
228 errorMsg);
Brian Salomon286b5572019-05-20 10:25:50 -0400229}
230
Brian Salomon63a0a752020-06-26 13:32:09 -0400231#define DEF_RESCALE_AND_READ_SURF_GM(IMAGE_FILE, TAG, SRC_RECT, W, H) \
232 DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_##TAG, canvas, errorMsg, 3 * W, 2 * H) { \
233 ToolUtils::draw_checkerboard(canvas, SK_ColorDKGRAY, SK_ColorLTGRAY, 25); \
234 return do_rescale_image_grid(canvas, #IMAGE_FILE, SRC_RECT, {W, H}, true, false, \
235 errorMsg); \
Brian Salomon201700f2019-05-17 12:05:44 -0400236 }
237
Brian Salomon63a0a752020-06-26 13:32:09 -0400238#define DEF_RESCALE_AND_READ_YUV_SURF_GM(IMAGE_FILE, TAG, SRC_RECT, W, H) \
239 DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_yuv420_##TAG, canvas, errorMsg, 3 * W, 2 * H) { \
240 ToolUtils::draw_checkerboard(canvas, SK_ColorDKGRAY, SK_ColorLTGRAY, 25); \
241 return do_rescale_image_grid(canvas, #IMAGE_FILE, SRC_RECT, {W, H}, true, true, errorMsg); \
Brian Salomon024bd002019-06-11 11:38:16 -0400242 }
243
Brian Salomon63a0a752020-06-26 13:32:09 -0400244#define DEF_RESCALE_AND_READ_IMG_GM(IMAGE_FILE, TAG, SRC_RECT, W, H) \
245 DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_##TAG, canvas, errorMsg, 3 * W, 2 * H) { \
246 ToolUtils::draw_checkerboard(canvas, SK_ColorDKGRAY, SK_ColorLTGRAY, 25); \
247 return do_rescale_image_grid(canvas, #IMAGE_FILE, SRC_RECT, {W, H}, false, false, \
248 errorMsg); \
249 }
Brian Salomon024bd002019-06-11 11:38:16 -0400250
Brian Salomon63a0a752020-06-26 13:32:09 -0400251#define DEF_RESCALE_AND_READ_YUV_IMG_GM(IMAGE_FILE, TAG, SRC_RECT, W, H) \
252 DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_yuv420_##TAG, canvas, errorMsg, 3 * W, 2 * H) { \
253 ToolUtils::draw_checkerboard(canvas, SK_ColorDKGRAY, SK_ColorLTGRAY, 25); \
254 return do_rescale_image_grid(canvas, #IMAGE_FILE, SRC_RECT, {W, H}, true, true, errorMsg); \
255 }
Brian Salomon201700f2019-05-17 12:05:44 -0400256
Brian Salomon63a0a752020-06-26 13:32:09 -0400257DEF_RESCALE_AND_READ_YUV_SURF_GM(
258 images/yellow_rose.webp, rose, SkIRect::MakeXYWH(50, 5, 200, 150), 410, 376)
Brian Salomon201700f2019-05-17 12:05:44 -0400259
Brian Salomon63a0a752020-06-26 13:32:09 -0400260DEF_RESCALE_AND_READ_YUV_IMG_GM(
261 images/yellow_rose.webp, rose_down, SkIRect::MakeXYWH(50, 5, 200, 150), 106, 60)
262
263DEF_RESCALE_AND_READ_SURF_GM(
264 images/yellow_rose.webp, rose, SkIRect::MakeXYWH(100, 20, 100, 100), 410, 410)
265
266DEF_RESCALE_AND_READ_SURF_GM(images/dog.jpg, dog_down, SkIRect::MakeXYWH(0, 10, 180, 150), 45, 45)
267DEF_RESCALE_AND_READ_IMG_GM(images/dog.jpg, dog_up, SkIRect::MakeWH(180, 180), 800, 400)
268
269DEF_RESCALE_AND_READ_IMG_GM(
270 images/text.png, text_down, SkIRect::MakeWH(637, 105), (int)(0.7 * 637), (int)(0.7 * 105))
271DEF_RESCALE_AND_READ_SURF_GM(
272 images/text.png, text_up, SkIRect::MakeWH(637, 105), (int)(1.2 * 637), (int)(1.2 * 105))
273DEF_RESCALE_AND_READ_IMG_GM(images/text.png,
274 text_up_large,
275 SkIRect::MakeXYWH(300, 0, 300, 105),
276 (int)(2.4 * 300),
277 (int)(2.4 * 105))
Brian Salomon286b5572019-05-20 10:25:50 -0400278
Brian Salomona7e5c7c2020-01-27 15:41:40 -0500279// Exercises non-scaling YUV420. Reads from the original canvas's surface in order to
280// exercise case where source surface is not a texture (in glbert config).
281DEF_SIMPLE_GM_CAN_FAIL(async_yuv_no_scale, canvas, errorMsg, 400, 300) {
282 auto surface = canvas->getSurface();
283 if (!surface) {
284 *errorMsg = "Not supported on recording/vector backends.";
285 return skiagm::DrawResult::kSkip;
286 }
287
288 auto image = GetResourceAsImage("images/yellow_rose.webp");
289 if (!image) {
290 return skiagm::DrawResult::kFail;
291 }
292 SkPaint paint;
293 canvas->drawImage(image.get(), 0, 0);
294
295 SkScopeExit scopeExit;
296 auto yuvImage = do_read_and_scale_yuv(
Brian Salomon63a0a752020-06-26 13:32:09 -0400297 surface, surface->getContext(), kRec601_SkYUVColorSpace, SkIRect::MakeWH(400, 300),
298 {400, 300}, SkImage::RescaleGamma::kSrc, kNone_SkFilterQuality, &scopeExit);
Brian Salomona7e5c7c2020-01-27 15:41:40 -0500299
300 canvas->clear(SK_ColorWHITE);
301 canvas->drawImage(yuvImage.get(), 0, 0);
302
303 return skiagm::DrawResult::kOk;
304}
305
Brian Salomon286b5572019-05-20 10:25:50 -0400306DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_no_bleed, canvas, errorMsg, 60, 60) {
307 if (canvas->imageInfo().colorType() == kUnknown_SkColorType) {
308 *errorMsg = "Not supported on recording/vector backends.";
309 return skiagm::DrawResult::kSkip;
310 }
311
312 static constexpr int kBorder = 5;
313 static constexpr int kInner = 5;
314 const auto srcRect = SkIRect::MakeXYWH(kBorder, kBorder, kInner, kInner);
315 auto surfaceII =
316 SkImageInfo::Make(kInner + 2 * kBorder, kInner + 2 * kBorder, kRGBA_8888_SkColorType,
317 kPremul_SkAlphaType, SkColorSpace::MakeSRGB());
318 auto surface = canvas->makeSurface(surfaceII);
Brian Salomonaf9b7b92019-05-20 12:19:37 -0400319 if (!surface) {
320 *errorMsg = "Could not create surface for image.";
Brian Salomon9be911c2019-05-20 14:01:21 -0400321 // When testing abandoned GrContext we expect surface creation to fail.
322 if (canvas->getGrContext() && canvas->getGrContext()->abandoned()) {
323 return skiagm::DrawResult::kSkip;
324 }
Brian Salomonaf9b7b92019-05-20 12:19:37 -0400325 return skiagm::DrawResult::kFail;
326 }
Brian Salomon286b5572019-05-20 10:25:50 -0400327 surface->getCanvas()->clear(SK_ColorRED);
328 surface->getCanvas()->save();
329 surface->getCanvas()->clipRect(SkRect::Make(srcRect), SkClipOp::kIntersect, false);
330 surface->getCanvas()->clear(SK_ColorBLUE);
331 surface->getCanvas()->restore();
332 static constexpr int kPad = 2;
333 canvas->translate(kPad, kPad);
334 skiagm::DrawResult result;
Brian Salomon9241a6d2019-10-03 13:26:54 -0400335 SkISize downSize = {static_cast<int>(kInner/2), static_cast<int>(kInner / 2)};
Brian Salomon63a0a752020-06-26 13:32:09 -0400336 GrContext* context = canvas->getGrContext();
337 result = do_rescale_grid(canvas, surface.get(), context, srcRect, downSize, false, errorMsg,
338 kPad);
339
Brian Salomon286b5572019-05-20 10:25:50 -0400340 if (result != skiagm::DrawResult::kOk) {
341 return result;
342 }
Mike Kleinf68213f2020-01-27 12:16:22 -0600343 canvas->translate(0, 4 * downSize.height());
Brian Salomon9241a6d2019-10-03 13:26:54 -0400344 SkISize upSize = {static_cast<int>(kInner * 3.5), static_cast<int>(kInner * 4.6)};
Brian Salomon63a0a752020-06-26 13:32:09 -0400345 result =
346 do_rescale_grid(canvas, surface.get(), context, srcRect, upSize, false, errorMsg, kPad);
Brian Salomon286b5572019-05-20 10:25:50 -0400347 if (result != skiagm::DrawResult::kOk) {
348 return result;
349 }
350 return skiagm::DrawResult::kOk;
351}