Brian Salomon | 201700f | 2019-05-17 12:05:44 -0400 | [diff] [blame] | 1 | /* |
| 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 Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 14 | #include "include/core/SkYUVAIndex.h" |
Brian Salomon | 201700f | 2019-05-17 12:05:44 -0400 | [diff] [blame] | 15 | #include "include/gpu/GrContext.h" |
| 16 | #include "src/core/SkAutoPixmapStorage.h" |
| 17 | #include "src/core/SkConvertPixels.h" |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 18 | #include "src/core/SkScopeExit.h" |
| 19 | #include "src/gpu/GrContextPriv.h" |
Brian Salomon | 201700f | 2019-05-17 12:05:44 -0400 | [diff] [blame] | 20 | #include "tools/Resources.h" |
| 21 | #include "tools/ToolUtils.h" |
| 22 | |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 23 | namespace { |
| 24 | struct AsyncContext { |
| 25 | bool fCalled = false; |
| 26 | std::unique_ptr<const SkSurface::AsyncReadResult> fResult; |
| 27 | }; |
| 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'. |
| 33 | static void async_callback(void* c, std::unique_ptr<const SkSurface::AsyncReadResult> result) { |
| 34 | auto context = static_cast<AsyncContext*>(c); |
| 35 | context->fResult = std::move(result); |
| 36 | context->fCalled = true; |
| 37 | }; |
| 38 | |
Brian Salomon | 201700f | 2019-05-17 12:05:44 -0400 | [diff] [blame] | 39 | // Draws the image to a surface, does a asyncRescaleAndReadPixels of the image, and then sticks |
| 40 | // the result in a raster image. |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 41 | static sk_sp<SkImage> do_read_and_scale(SkSurface* surface, const SkIRect& srcRect, |
| 42 | const SkImageInfo& ii, SkSurface::RescaleGamma rescaleGamma, |
| 43 | SkFilterQuality quality) { |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 44 | auto* context = new AsyncContext(); |
| 45 | surface->asyncRescaleAndReadPixels(ii, srcRect, rescaleGamma, quality, async_callback, context); |
| 46 | while (!context->fCalled) { |
Brian Salomon | 9c21978 | 2019-10-02 22:51:08 +0000 | [diff] [blame] | 47 | // Only GPU should actually be asynchronous. |
| 48 | SkASSERT(surface->getCanvas()->getGrContext()); |
| 49 | surface->getCanvas()->getGrContext()->checkAsyncWorkCompletion(); |
| 50 | } |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 51 | if (!context->fResult) { |
| 52 | return nullptr; |
| 53 | } |
| 54 | SkPixmap pixmap(ii, context->fResult->data(0), context->fResult->rowBytes(0)); |
| 55 | auto releasePixels = [](const void*, void* c) { delete static_cast<AsyncContext*>(c); }; |
| 56 | return SkImage::MakeFromRaster(pixmap, releasePixels, context); |
Ravi Mistry | cb55010 | 2019-10-03 09:06:25 +0000 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | static sk_sp<SkImage> do_read_and_scale_yuv(SkSurface* surface, SkYUVColorSpace yuvCS, |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 60 | const SkIRect& srcRect, SkISize size, |
Ravi Mistry | cb55010 | 2019-10-03 09:06:25 +0000 | [diff] [blame] | 61 | SkSurface::RescaleGamma rescaleGamma, |
| 62 | SkFilterQuality quality, SkScopeExit* cleanup) { |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 63 | SkASSERT(!(size.width() & 0b1) && !(size.height() & 0b1)); |
Ravi Mistry | cb55010 | 2019-10-03 09:06:25 +0000 | [diff] [blame] | 64 | |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 65 | SkISize uvSize = {size.width()/2, size.height()/2}; |
| 66 | SkImageInfo yII = SkImageInfo::Make(size, kGray_8_SkColorType, kPremul_SkAlphaType); |
| 67 | SkImageInfo uvII = SkImageInfo::Make(uvSize, kGray_8_SkColorType, kPremul_SkAlphaType); |
Ravi Mistry | cb55010 | 2019-10-03 09:06:25 +0000 | [diff] [blame] | 68 | |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 69 | AsyncContext context; |
| 70 | surface->asyncRescaleAndReadPixelsYUV420(yuvCS, SkColorSpace::MakeSRGB(), srcRect, size, |
| 71 | rescaleGamma, quality, async_callback, &context); |
Ravi Mistry | cb55010 | 2019-10-03 09:06:25 +0000 | [diff] [blame] | 72 | while (!context.fCalled) { |
| 73 | // Only GPU should actually be asynchronous. |
| 74 | SkASSERT(surface->getCanvas()->getGrContext()); |
| 75 | surface->getCanvas()->getGrContext()->checkAsyncWorkCompletion(); |
| 76 | } |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 77 | if (!context.fResult) { |
Brian Salomon | cd5caa3 | 2019-06-11 17:02:19 -0400 | [diff] [blame] | 78 | return nullptr; |
| 79 | } |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 80 | auto* gr = surface->getCanvas()->getGrContext(); |
| 81 | GrBackendTexture backendTextures[3]; |
Robert Phillips | 0a15cc6 | 2019-07-30 12:49:10 -0400 | [diff] [blame] | 82 | |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 83 | SkPixmap yPM(yII, context.fResult->data(0), context.fResult->rowBytes(0)); |
| 84 | SkPixmap uPM(uvII, context.fResult->data(1), context.fResult->rowBytes(1)); |
| 85 | SkPixmap vPM(uvII, context.fResult->data(2), context.fResult->rowBytes(2)); |
| 86 | |
| 87 | backendTextures[0] = gr->createBackendTexture(yPM, GrRenderable::kNo, GrProtected::kNo); |
| 88 | backendTextures[1] = gr->createBackendTexture(uPM, GrRenderable::kNo, GrProtected::kNo); |
| 89 | backendTextures[2] = gr->createBackendTexture(vPM, GrRenderable::kNo, GrProtected::kNo); |
| 90 | |
Robert Phillips | 2e1142c | 2019-08-14 12:33:29 -0400 | [diff] [blame] | 91 | SkYUVAIndex indices[4] = { |
| 92 | { 0, SkColorChannel::kR}, |
| 93 | { 1, SkColorChannel::kR}, |
| 94 | { 2, SkColorChannel::kR}, |
| 95 | {-1, SkColorChannel::kR} |
| 96 | }; |
| 97 | |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 98 | *cleanup = {[gr, backendTextures] { |
| 99 | GrFlushInfo flushInfo; |
| 100 | flushInfo.fFlags = kSyncCpu_GrFlushFlag; |
| 101 | gr->flush(flushInfo); |
| 102 | gr->deleteBackendTexture(backendTextures[0]); |
| 103 | gr->deleteBackendTexture(backendTextures[1]); |
| 104 | gr->deleteBackendTexture(backendTextures[2]); |
| 105 | }}; |
| 106 | |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 107 | return SkImage::MakeFromYUVATextures(gr, yuvCS, backendTextures, indices, size, |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 108 | kTopLeft_GrSurfaceOrigin, SkColorSpace::MakeSRGB()); |
| 109 | } |
| 110 | |
Brian Salomon | 201700f | 2019-05-17 12:05:44 -0400 | [diff] [blame] | 111 | // Draws a grid of rescales. The columns are none, low, and high filter quality. The rows are |
| 112 | // rescale in src gamma and rescale in linear gamma. |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 113 | static skiagm::DrawResult do_rescale_grid(SkCanvas* canvas, SkSurface* surface, |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 114 | const SkIRect& srcRect, SkISize newSize, bool doYUV420, |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 115 | SkString* errorMsg, int pad = 0) { |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 116 | if (doYUV420) { |
Brian Salomon | cd5caa3 | 2019-06-11 17:02:19 -0400 | [diff] [blame] | 117 | if (!canvas->getGrContext() || !canvas->getGrContext()->priv().asDirectContext()) { |
| 118 | errorMsg->printf("YUV420 only supported on direct GPU for now."); |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 119 | return skiagm::DrawResult::kSkip; |
| 120 | } |
| 121 | } |
Brian Salomon | 201700f | 2019-05-17 12:05:44 -0400 | [diff] [blame] | 122 | if (canvas->imageInfo().colorType() == kUnknown_SkColorType) { |
| 123 | *errorMsg = "Not supported on recording/vector backends."; |
| 124 | return skiagm::DrawResult::kSkip; |
| 125 | } |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 126 | const auto ii = canvas->imageInfo().makeDimensions(newSize); |
Brian Salomon | a34e0fc | 2019-05-17 19:56:59 +0000 | [diff] [blame] | 127 | |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 128 | SkYUVColorSpace yuvColorSpace = kRec601_SkYUVColorSpace; |
Brian Salomon | a34e0fc | 2019-05-17 19:56:59 +0000 | [diff] [blame] | 129 | canvas->save(); |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 130 | for (auto gamma : {SkSurface::RescaleGamma::kSrc, SkSurface::RescaleGamma::kLinear}) { |
Brian Salomon | a34e0fc | 2019-05-17 19:56:59 +0000 | [diff] [blame] | 131 | canvas->save(); |
| 132 | for (auto quality : {kNone_SkFilterQuality, kLow_SkFilterQuality, kHigh_SkFilterQuality}) { |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 133 | SkScopeExit cleanup; |
| 134 | sk_sp<SkImage> result; |
| 135 | if (doYUV420) { |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 136 | result = do_read_and_scale_yuv(surface, yuvColorSpace, srcRect, newSize, gamma, |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 137 | quality, &cleanup); |
Brian Salomon | cd5caa3 | 2019-06-11 17:02:19 -0400 | [diff] [blame] | 138 | if (!result) { |
| 139 | errorMsg->printf("YUV420 async call failed. Allowed for now."); |
| 140 | return skiagm::DrawResult::kSkip; |
| 141 | } |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 142 | int nextCS = static_cast<int>(yuvColorSpace + 1) % (kLastEnum_SkYUVColorSpace + 1); |
| 143 | yuvColorSpace = static_cast<SkYUVColorSpace>(nextCS); |
| 144 | } else { |
| 145 | result = do_read_and_scale(surface, srcRect, ii, gamma, quality); |
Brian Salomon | cd5caa3 | 2019-06-11 17:02:19 -0400 | [diff] [blame] | 146 | if (!result) { |
| 147 | errorMsg->printf("async read call failed."); |
| 148 | return skiagm::DrawResult::kFail; |
| 149 | } |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 150 | } |
| 151 | canvas->drawImage(result, 0, 0); |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 152 | canvas->translate(newSize.width() + pad, 0); |
Brian Salomon | a34e0fc | 2019-05-17 19:56:59 +0000 | [diff] [blame] | 153 | } |
| 154 | canvas->restore(); |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 155 | canvas->translate(0, newSize.height() + pad); |
Brian Salomon | 451b01f | 2019-05-17 12:39:17 -0400 | [diff] [blame] | 156 | } |
Brian Salomon | a34e0fc | 2019-05-17 19:56:59 +0000 | [diff] [blame] | 157 | canvas->restore(); |
| 158 | return skiagm::DrawResult::kOk; |
Brian Salomon | 451b01f | 2019-05-17 12:39:17 -0400 | [diff] [blame] | 159 | } |
| 160 | |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 161 | static skiagm::DrawResult do_rescale_image_grid(SkCanvas* canvas, const char* imageFile, |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 162 | const SkIRect& srcRect, SkISize newSize, |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 163 | bool doYUV420, SkString* errorMsg) { |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 164 | auto image = GetResourceAsImage(imageFile); |
| 165 | if (!image) { |
| 166 | errorMsg->printf("Could not load image file %s.", imageFile); |
| 167 | return skiagm::DrawResult::kFail; |
| 168 | } |
| 169 | if (canvas->imageInfo().colorType() == kUnknown_SkColorType) { |
| 170 | *errorMsg = "Not supported on recording/vector backends."; |
| 171 | return skiagm::DrawResult::kSkip; |
| 172 | } |
| 173 | // Turn the image into a surface in order to call the read and rescale API |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 174 | auto surfInfo = image->imageInfo().makeDimensions(image->dimensions()); |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 175 | auto surface = canvas->makeSurface(surfInfo); |
| 176 | if (!surface && surfInfo.colorType() == kBGRA_8888_SkColorType) { |
| 177 | surfInfo = surfInfo.makeColorType(kRGBA_8888_SkColorType); |
| 178 | surface = canvas->makeSurface(surfInfo); |
| 179 | } |
| 180 | if (!surface) { |
| 181 | *errorMsg = "Could not create surface for image."; |
Brian Salomon | 9be911c | 2019-05-20 14:01:21 -0400 | [diff] [blame] | 182 | // When testing abandoned GrContext we expect surface creation to fail. |
| 183 | if (canvas->getGrContext() && canvas->getGrContext()->abandoned()) { |
| 184 | return skiagm::DrawResult::kSkip; |
| 185 | } |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 186 | return skiagm::DrawResult::kFail; |
| 187 | } |
| 188 | SkPaint paint; |
| 189 | paint.setBlendMode(SkBlendMode::kSrc); |
| 190 | surface->getCanvas()->drawImage(image, 0, 0, &paint); |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 191 | return do_rescale_grid(canvas, surface.get(), srcRect, newSize, doYUV420, errorMsg); |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 192 | } |
| 193 | |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 194 | #define DEF_RESCALE_AND_READ_GM(IMAGE_FILE, TAG, SRC_RECT, W, H) \ |
| 195 | DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_##TAG, canvas, errorMsg, 3 * W, 2 * H) { \ |
| 196 | ToolUtils::draw_checkerboard(canvas, SK_ColorDKGRAY, SK_ColorLTGRAY, 25); \ |
| 197 | return do_rescale_image_grid(canvas, #IMAGE_FILE, SRC_RECT, {W, H}, false, errorMsg); \ |
Brian Salomon | 201700f | 2019-05-17 12:05:44 -0400 | [diff] [blame] | 198 | } |
| 199 | |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 200 | #define DEF_RESCALE_AND_READ_YUV_GM(IMAGE_FILE, TAG, SRC_RECT, W, H) \ |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 201 | DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_yuv420_##TAG, canvas, errorMsg, 3 * W, 2 * H) { \ |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 202 | ToolUtils::draw_checkerboard(canvas, SK_ColorDKGRAY, SK_ColorLTGRAY, 25); \ |
| 203 | return do_rescale_image_grid(canvas, #IMAGE_FILE, SRC_RECT, {W, H}, true, errorMsg); \ |
Brian Salomon | 024bd00 | 2019-06-11 11:38:16 -0400 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | DEF_RESCALE_AND_READ_YUV_GM(images/yellow_rose.webp, rose, SkIRect::MakeXYWH(50, 5, 200, 150), |
| 207 | 410, 376) |
| 208 | |
Brian Salomon | 201700f | 2019-05-17 12:05:44 -0400 | [diff] [blame] | 209 | DEF_RESCALE_AND_READ_GM(images/yellow_rose.webp, rose, SkIRect::MakeXYWH(100, 20, 100, 100), |
| 210 | 410, 410) |
| 211 | |
| 212 | DEF_RESCALE_AND_READ_GM(images/dog.jpg, dog_down, SkIRect::MakeXYWH(0, 10, 180, 150), 45, 45) |
Brian Salomon | c7e9f78 | 2019-05-28 20:39:53 -0400 | [diff] [blame] | 213 | DEF_RESCALE_AND_READ_GM(images/dog.jpg, dog_up, SkIRect::MakeWH(180, 180), 800, 400) |
Brian Salomon | 201700f | 2019-05-17 12:05:44 -0400 | [diff] [blame] | 214 | |
| 215 | DEF_RESCALE_AND_READ_GM(images/text.png, text_down, SkIRect::MakeWH(637, 105), (int)(0.7 * 637), |
| 216 | (int)(0.7 * 105)) |
| 217 | DEF_RESCALE_AND_READ_GM(images/text.png, text_up, SkIRect::MakeWH(637, 105), (int)(1.2 * 637), |
| 218 | (int)(1.2 * 105)) |
| 219 | DEF_RESCALE_AND_READ_GM(images/text.png, text_up_large, SkIRect::MakeXYWH(300, 0, 300, 105), |
| 220 | (int)(2.4 * 300), (int)(2.4 * 105)) |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 221 | |
| 222 | DEF_SIMPLE_GM_CAN_FAIL(async_rescale_and_read_no_bleed, canvas, errorMsg, 60, 60) { |
| 223 | if (canvas->imageInfo().colorType() == kUnknown_SkColorType) { |
| 224 | *errorMsg = "Not supported on recording/vector backends."; |
| 225 | return skiagm::DrawResult::kSkip; |
| 226 | } |
| 227 | |
| 228 | static constexpr int kBorder = 5; |
| 229 | static constexpr int kInner = 5; |
| 230 | const auto srcRect = SkIRect::MakeXYWH(kBorder, kBorder, kInner, kInner); |
| 231 | auto surfaceII = |
| 232 | SkImageInfo::Make(kInner + 2 * kBorder, kInner + 2 * kBorder, kRGBA_8888_SkColorType, |
| 233 | kPremul_SkAlphaType, SkColorSpace::MakeSRGB()); |
| 234 | auto surface = canvas->makeSurface(surfaceII); |
Brian Salomon | af9b7b9 | 2019-05-20 12:19:37 -0400 | [diff] [blame] | 235 | if (!surface) { |
| 236 | *errorMsg = "Could not create surface for image."; |
Brian Salomon | 9be911c | 2019-05-20 14:01:21 -0400 | [diff] [blame] | 237 | // When testing abandoned GrContext we expect surface creation to fail. |
| 238 | if (canvas->getGrContext() && canvas->getGrContext()->abandoned()) { |
| 239 | return skiagm::DrawResult::kSkip; |
| 240 | } |
Brian Salomon | af9b7b9 | 2019-05-20 12:19:37 -0400 | [diff] [blame] | 241 | return skiagm::DrawResult::kFail; |
| 242 | } |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 243 | surface->getCanvas()->clear(SK_ColorRED); |
| 244 | surface->getCanvas()->save(); |
| 245 | surface->getCanvas()->clipRect(SkRect::Make(srcRect), SkClipOp::kIntersect, false); |
| 246 | surface->getCanvas()->clear(SK_ColorBLUE); |
| 247 | surface->getCanvas()->restore(); |
| 248 | static constexpr int kPad = 2; |
| 249 | canvas->translate(kPad, kPad); |
| 250 | skiagm::DrawResult result; |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 251 | SkISize downSize = {static_cast<int>(kInner/2), static_cast<int>(kInner / 2)}; |
| 252 | result = do_rescale_grid(canvas, surface.get(), srcRect, downSize, false, errorMsg, kPad); |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 253 | if (result != skiagm::DrawResult::kOk) { |
| 254 | return result; |
| 255 | } |
Mike Klein | f68213f | 2020-01-27 12:16:22 -0600 | [diff] [blame^] | 256 | canvas->translate(0, 4 * downSize.height()); |
Brian Salomon | 9241a6d | 2019-10-03 13:26:54 -0400 | [diff] [blame] | 257 | SkISize upSize = {static_cast<int>(kInner * 3.5), static_cast<int>(kInner * 4.6)}; |
| 258 | result = do_rescale_grid(canvas, surface.get(), srcRect, upSize, false, errorMsg, kPad); |
Brian Salomon | 286b557 | 2019-05-20 10:25:50 -0400 | [diff] [blame] | 259 | if (result != skiagm::DrawResult::kOk) { |
| 260 | return result; |
| 261 | } |
| 262 | return skiagm::DrawResult::kOk; |
| 263 | } |