blob: 368e594ab88a2ce1ee0b2cbb6e5f2505e2387a2e [file] [log] [blame]
robertphillipsb6c65e92016-02-04 10:52:42 -08001/*
2 * Copyright 2016 Google Inc.
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
robertphillipsc5035e72016-03-17 06:58:39 -07008#include "SkAutoPixmapStorage.h"
robertphillipsb6c65e92016-02-04 10:52:42 -08009#include "SkBitmap.h"
10#include "SkCanvas.h"
11#include "SkImage.h"
robertphillipsc5035e72016-03-17 06:58:39 -070012#include "SkPixmap.h"
robertphillipsb6c65e92016-02-04 10:52:42 -080013#include "SkSpecialImage.h"
14#include "SkSpecialSurface.h"
robertphillipsb4bd11e2016-03-21 13:44:18 -070015#include "SkSurface.h"
robertphillipsb6c65e92016-02-04 10:52:42 -080016#include "Test.h"
17
Robert Phillips8caf85f2018-04-05 09:30:38 -040018#include "GrBackendSurface.h"
robertphillipsb6c65e92016-02-04 10:52:42 -080019#include "GrContext.h"
Robert Phillips1afd4cd2018-01-08 13:40:32 -050020#include "GrContextPriv.h"
Robert Phillips0bd24dc2018-01-16 08:06:32 -050021#include "GrProxyProvider.h"
Robert Phillips37430132016-11-09 06:50:43 -050022#include "GrSurfaceProxy.h"
Mike Reed84dd8572017-03-08 22:21:00 -050023#include "GrTextureProxy.h"
Brian Osman3b655982017-03-07 16:58:08 -050024#include "SkGr.h"
robertphillipsb6c65e92016-02-04 10:52:42 -080025
robertphillipsb6c65e92016-02-04 10:52:42 -080026
27// This test creates backing resources exactly sized to [kFullSize x kFullSize].
28// It then wraps them in an SkSpecialImage with only the center (red) region being active.
29// It then draws the SkSpecialImage to a full sized (all blue) canvas and checks that none
30// of the inactive (green) region leaked out.
31
32static const int kSmallerSize = 10;
33static const int kPad = 3;
34static const int kFullSize = kSmallerSize + 2 * kPad;
35
36// Create a bitmap with red in the center and green around it
37static SkBitmap create_bm() {
38 SkBitmap bm;
39 bm.allocN32Pixels(kFullSize, kFullSize, true);
40
41 SkCanvas temp(bm);
42
43 temp.clear(SK_ColorGREEN);
44 SkPaint p;
45 p.setColor(SK_ColorRED);
46 p.setAntiAlias(false);
47
48 temp.drawRect(SkRect::MakeXYWH(SkIntToScalar(kPad), SkIntToScalar(kPad),
halcanary9d524f22016-03-29 09:03:52 -070049 SkIntToScalar(kSmallerSize), SkIntToScalar(kSmallerSize)),
robertphillipsb6c65e92016-02-04 10:52:42 -080050 p);
51
52 return bm;
53}
54
55// Basic test of the SkSpecialImage public API (e.g., peekTexture, peekPixels & draw)
robertphillips37bd7c32016-03-17 14:31:39 -070056static void test_image(const sk_sp<SkSpecialImage>& img, skiatest::Reporter* reporter,
Robert Phillips6de99042017-01-31 11:31:39 -050057 GrContext* context, bool isGPUBacked,
robertphillipsc5035e72016-03-17 06:58:39 -070058 int offset, int size) {
robertphillips3e302272016-04-20 11:48:36 -070059 const SkIRect subset = img->subset();
robertphillipsc5035e72016-03-17 06:58:39 -070060 REPORTER_ASSERT(reporter, offset == subset.left());
61 REPORTER_ASSERT(reporter, offset == subset.top());
robertphillipsb6c65e92016-02-04 10:52:42 -080062 REPORTER_ASSERT(reporter, kSmallerSize == subset.width());
63 REPORTER_ASSERT(reporter, kSmallerSize == subset.height());
64
65 //--------------
Robert Phillips2c6d2bf2017-02-21 10:19:29 -050066 // Test that isTextureBacked reports the correct backing type
Robert Phillips6de99042017-01-31 11:31:39 -050067 REPORTER_ASSERT(reporter, isGPUBacked == img->isTextureBacked());
robertphillips64612512016-04-08 12:10:42 -070068
robertphillips64612512016-04-08 12:10:42 -070069 //--------------
Robert Phillips8e1c4e62017-02-19 12:27:01 -050070 // Test asTextureProxyRef - as long as there is a context this should succeed
robertphillips64612512016-04-08 12:10:42 -070071 if (context) {
Robert Phillips8e1c4e62017-02-19 12:27:01 -050072 sk_sp<GrTextureProxy> proxy(img->asTextureProxyRef(context));
73 REPORTER_ASSERT(reporter, proxy);
robertphillips64612512016-04-08 12:10:42 -070074 }
robertphillipsb6c65e92016-02-04 10:52:42 -080075
76 //--------------
robertphillips64612512016-04-08 12:10:42 -070077 // Test getROPixels - this should always succeed regardless of backing store
78 SkBitmap bitmap;
79 REPORTER_ASSERT(reporter, img->getROPixels(&bitmap));
robertphillipsed086ca2016-04-26 15:02:25 -070080 if (context) {
81 REPORTER_ASSERT(reporter, kSmallerSize == bitmap.width());
82 REPORTER_ASSERT(reporter, kSmallerSize == bitmap.height());
83 } else {
84 REPORTER_ASSERT(reporter, size == bitmap.width());
85 REPORTER_ASSERT(reporter, size == bitmap.height());
86 }
robertphillipsb6c65e92016-02-04 10:52:42 -080087
88 //--------------
robertphillipsb4bd11e2016-03-21 13:44:18 -070089 // Test that draw restricts itself to the subset
Brian Osmana50205f2018-07-06 13:57:01 -040090 SkImageFilter::OutputProperties outProps(kN32_SkColorType, img->getColorSpace());
brianosmaneed6b0e2016-09-23 13:04:05 -070091 sk_sp<SkSpecialSurface> surf(img->makeSurface(outProps, SkISize::Make(kFullSize, kFullSize),
Matt Sarettcb6266b2017-01-17 10:48:53 -050092 kPremul_SkAlphaType));
robertphillipsb6c65e92016-02-04 10:52:42 -080093
94 SkCanvas* canvas = surf->getCanvas();
95
96 canvas->clear(SK_ColorBLUE);
robertphillipse8c34972016-02-16 12:09:36 -080097 img->draw(canvas, SkIntToScalar(kPad), SkIntToScalar(kPad), nullptr);
robertphillipsb6c65e92016-02-04 10:52:42 -080098
99 SkBitmap bm;
Matt Sarettcb6266b2017-01-17 10:48:53 -0500100 bm.allocN32Pixels(kFullSize, kFullSize, false);
robertphillipsb6c65e92016-02-04 10:52:42 -0800101
102 bool result = canvas->readPixels(bm.info(), bm.getPixels(), bm.rowBytes(), 0, 0);
103 SkASSERT_RELEASE(result);
104
105 // Only the center (red) portion should've been drawn into the canvas
106 REPORTER_ASSERT(reporter, SK_ColorBLUE == bm.getColor(kPad-1, kPad-1));
107 REPORTER_ASSERT(reporter, SK_ColorRED == bm.getColor(kPad, kPad));
108 REPORTER_ASSERT(reporter, SK_ColorRED == bm.getColor(kSmallerSize+kPad-1,
109 kSmallerSize+kPad-1));
110 REPORTER_ASSERT(reporter, SK_ColorBLUE == bm.getColor(kSmallerSize+kPad,
111 kSmallerSize+kPad));
robertphillipsb4bd11e2016-03-21 13:44:18 -0700112
113 //--------------
Robert Phillipsa5fdc972017-02-18 16:58:09 -0500114 // Test that asImage & makeTightSurface return appropriately sized objects
robertphillipsb4bd11e2016-03-21 13:44:18 -0700115 // of the correct backing type
116 SkIRect newSubset = SkIRect::MakeWH(subset.width(), subset.height());
117 {
Robert Phillipsa5fdc972017-02-18 16:58:09 -0500118 sk_sp<SkImage> tightImg(img->asImage(&newSubset));
robertphillipsb4bd11e2016-03-21 13:44:18 -0700119
120 REPORTER_ASSERT(reporter, tightImg->width() == subset.width());
121 REPORTER_ASSERT(reporter, tightImg->height() == subset.height());
Robert Phillips0ae6faa2017-03-21 16:22:00 -0400122 REPORTER_ASSERT(reporter, isGPUBacked == tightImg->isTextureBacked());
robertphillipsb4bd11e2016-03-21 13:44:18 -0700123 SkPixmap tmpPixmap;
Robert Phillips6de99042017-01-31 11:31:39 -0500124 REPORTER_ASSERT(reporter, isGPUBacked != !!tightImg->peekPixels(&tmpPixmap));
robertphillipsb4bd11e2016-03-21 13:44:18 -0700125 }
126 {
Brian Osmana50205f2018-07-06 13:57:01 -0400127 SkImageFilter::OutputProperties outProps(kN32_SkColorType, img->getColorSpace());
brianosmaneed6b0e2016-09-23 13:04:05 -0700128 sk_sp<SkSurface> tightSurf(img->makeTightSurface(outProps, subset.size()));
robertphillipsb4bd11e2016-03-21 13:44:18 -0700129
130 REPORTER_ASSERT(reporter, tightSurf->width() == subset.width());
131 REPORTER_ASSERT(reporter, tightSurf->height() == subset.height());
Robert Phillips8caf85f2018-04-05 09:30:38 -0400132 GrBackendTexture backendTex = tightSurf->getBackendTexture(
133 SkSurface::kDiscardWrite_BackendHandleAccess);
134 REPORTER_ASSERT(reporter, isGPUBacked == backendTex.isValid());
robertphillipsb4bd11e2016-03-21 13:44:18 -0700135 SkPixmap tmpPixmap;
Robert Phillips6de99042017-01-31 11:31:39 -0500136 REPORTER_ASSERT(reporter, isGPUBacked != !!tightSurf->peekPixels(&tmpPixmap));
robertphillipsb4bd11e2016-03-21 13:44:18 -0700137 }
robertphillipsb6c65e92016-02-04 10:52:42 -0800138}
139
140DEF_TEST(SpecialImage_Raster, reporter) {
141 SkBitmap bm = create_bm();
142
robertphillips37bd7c32016-03-17 14:31:39 -0700143 sk_sp<SkSpecialImage> fullSImage(SkSpecialImage::MakeFromRaster(
robertphillipsc5035e72016-03-17 06:58:39 -0700144 SkIRect::MakeWH(kFullSize, kFullSize),
145 bm));
146
robertphillipsb6c65e92016-02-04 10:52:42 -0800147 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
148
robertphillipsc5035e72016-03-17 06:58:39 -0700149 {
robertphillips3e302272016-04-20 11:48:36 -0700150 sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromRaster(subset, bm));
robertphillips64612512016-04-08 12:10:42 -0700151 test_image(subSImg1, reporter, nullptr, false, kPad, kFullSize);
robertphillipsc5035e72016-03-17 06:58:39 -0700152 }
153
154 {
robertphillips37bd7c32016-03-17 14:31:39 -0700155 sk_sp<SkSpecialImage> subSImg2(fullSImage->makeSubset(subset));
robertphillips64612512016-04-08 12:10:42 -0700156 test_image(subSImg2, reporter, nullptr, false, 0, kSmallerSize);
robertphillipsc5035e72016-03-17 06:58:39 -0700157 }
robertphillipsb6c65e92016-02-04 10:52:42 -0800158}
159
Brian Osman61624f02016-12-09 14:51:59 -0500160static void test_specialimage_image(skiatest::Reporter* reporter, SkColorSpace* dstColorSpace) {
robertphillipsb6c65e92016-02-04 10:52:42 -0800161 SkBitmap bm = create_bm();
162
reed9ce9d672016-03-17 10:51:11 -0700163 sk_sp<SkImage> fullImage(SkImage::MakeFromBitmap(bm));
robertphillipsb6c65e92016-02-04 10:52:42 -0800164
robertphillips37bd7c32016-03-17 14:31:39 -0700165 sk_sp<SkSpecialImage> fullSImage(SkSpecialImage::MakeFromImage(
robertphillipsc5035e72016-03-17 06:58:39 -0700166 SkIRect::MakeWH(kFullSize, kFullSize),
Brian Osman61624f02016-12-09 14:51:59 -0500167 fullImage, dstColorSpace));
robertphillipsc5035e72016-03-17 06:58:39 -0700168
robertphillipsb6c65e92016-02-04 10:52:42 -0800169 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
170
robertphillipsc5035e72016-03-17 06:58:39 -0700171 {
Brian Osman61624f02016-12-09 14:51:59 -0500172 sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromImage(subset, fullImage,
173 dstColorSpace));
robertphillipsed086ca2016-04-26 15:02:25 -0700174 test_image(subSImg1, reporter, nullptr, false, kPad, kFullSize);
robertphillipsc5035e72016-03-17 06:58:39 -0700175 }
176
177 {
robertphillips37bd7c32016-03-17 14:31:39 -0700178 sk_sp<SkSpecialImage> subSImg2(fullSImage->makeSubset(subset));
robertphillipsed086ca2016-04-26 15:02:25 -0700179 test_image(subSImg2, reporter, nullptr, false, 0, kSmallerSize);
robertphillipsc5035e72016-03-17 06:58:39 -0700180 }
robertphillipsb6c65e92016-02-04 10:52:42 -0800181}
182
Brian Osman7992da32016-11-18 11:28:24 -0500183DEF_TEST(SpecialImage_Image_Legacy, reporter) {
Brian Osman61624f02016-12-09 14:51:59 -0500184 SkColorSpace* legacyColorSpace = nullptr;
185 test_specialimage_image(reporter, legacyColorSpace);
Brian Osman7992da32016-11-18 11:28:24 -0500186}
187
188DEF_TEST(SpecialImage_Image_ColorSpaceAware, reporter) {
Matt Sarett77a7a1b2017-02-07 13:56:11 -0500189 sk_sp<SkColorSpace> srgbColorSpace = SkColorSpace::MakeSRGB();
Brian Osman61624f02016-12-09 14:51:59 -0500190 test_specialimage_image(reporter, srgbColorSpace.get());
Brian Osman7992da32016-11-18 11:28:24 -0500191}
192
robertphillips83c17fa2016-03-18 08:14:27 -0700193static void test_texture_backed(skiatest::Reporter* reporter,
194 const sk_sp<SkSpecialImage>& orig,
195 const sk_sp<SkSpecialImage>& gpuBacked) {
196 REPORTER_ASSERT(reporter, gpuBacked);
robertphillips64612512016-04-08 12:10:42 -0700197 REPORTER_ASSERT(reporter, gpuBacked->isTextureBacked());
robertphillips83c17fa2016-03-18 08:14:27 -0700198 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID());
199 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().width() &&
200 gpuBacked->subset().height() == orig->subset().height());
brianosmanafbf71d2016-07-21 07:15:37 -0700201 REPORTER_ASSERT(reporter, gpuBacked->getColorSpace() == orig->getColorSpace());
robertphillips83c17fa2016-03-18 08:14:27 -0700202}
203
204// Test out the SkSpecialImage::makeTextureImage entry point
bsalomon68d91342016-04-12 09:59:58 -0700205DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) {
bsalomon8b7451a2016-05-11 06:33:06 -0700206 GrContext* context = ctxInfo.grContext();
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500207 GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
robertphillips83c17fa2016-03-18 08:14:27 -0700208 SkBitmap bm = create_bm();
209
210 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
211
212 {
213 // raster
214 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster(
robertphillips83c17fa2016-03-18 08:14:27 -0700215 SkIRect::MakeWH(kFullSize,
216 kFullSize),
217 bm));
218
219 {
robertphillips3e302272016-04-20 11:48:36 -0700220 sk_sp<SkSpecialImage> fromRaster(rasterImage->makeTextureImage(context));
robertphillips83c17fa2016-03-18 08:14:27 -0700221 test_texture_backed(reporter, rasterImage, fromRaster);
222 }
223
224 {
225 sk_sp<SkSpecialImage> subRasterImage(rasterImage->makeSubset(subset));
226
robertphillips3e302272016-04-20 11:48:36 -0700227 sk_sp<SkSpecialImage> fromSubRaster(subRasterImage->makeTextureImage(context));
robertphillips83c17fa2016-03-18 08:14:27 -0700228 test_texture_backed(reporter, subRasterImage, fromSubRaster);
229 }
230 }
231
232 {
233 // gpu
Brian Osman2b23c4b2018-06-01 12:25:08 -0400234 const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info());
robertphillips83c17fa2016-03-18 08:14:27 -0700235
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500236 sk_sp<GrTextureProxy> proxy = proxyProvider->createTextureProxy(
Brian Salomon58389b92018-03-07 13:01:25 -0500237 desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
Robert Phillips2f493142017-03-02 18:18:38 -0500238 if (!proxy) {
robertphillips83c17fa2016-03-18 08:14:27 -0700239 return;
240 }
241
Robert Phillips2c6d2bf2017-02-21 10:19:29 -0500242 sk_sp<SkSpecialImage> gpuImage(SkSpecialImage::MakeDeferredFromGpu(
Robert Phillips2f493142017-03-02 18:18:38 -0500243 context,
244 SkIRect::MakeWH(kFullSize, kFullSize),
245 kNeedNewImageUniqueID_SpecialImage,
246 std::move(proxy), nullptr));
robertphillips83c17fa2016-03-18 08:14:27 -0700247
248 {
robertphillips3e302272016-04-20 11:48:36 -0700249 sk_sp<SkSpecialImage> fromGPU(gpuImage->makeTextureImage(context));
robertphillips83c17fa2016-03-18 08:14:27 -0700250 test_texture_backed(reporter, gpuImage, fromGPU);
251 }
252
253 {
254 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset));
255
robertphillips3e302272016-04-20 11:48:36 -0700256 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(context));
robertphillips83c17fa2016-03-18 08:14:27 -0700257 test_texture_backed(reporter, subGPUImage, fromSubGPU);
258 }
259 }
260}
261
bsalomon68d91342016-04-12 09:59:58 -0700262DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
bsalomon8b7451a2016-05-11 06:33:06 -0700263 GrContext* context = ctxInfo.grContext();
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500264 GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
robertphillipsb6c65e92016-02-04 10:52:42 -0800265 SkBitmap bm = create_bm();
266
Brian Osman2b23c4b2018-06-01 12:25:08 -0400267 const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(bm.info());
robertphillipsb6c65e92016-02-04 10:52:42 -0800268
Brian Salomon58389b92018-03-07 13:01:25 -0500269 sk_sp<GrTextureProxy> proxy =
270 proxyProvider->createTextureProxy(desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
Robert Phillips2f493142017-03-02 18:18:38 -0500271 if (!proxy) {
robertphillipsb6c65e92016-02-04 10:52:42 -0800272 return;
273 }
274
Robert Phillips2c6d2bf2017-02-21 10:19:29 -0500275 sk_sp<SkSpecialImage> fullSImg(SkSpecialImage::MakeDeferredFromGpu(
276 context,
robertphillipsc5035e72016-03-17 06:58:39 -0700277 SkIRect::MakeWH(kFullSize, kFullSize),
278 kNeedNewImageUniqueID_SpecialImage,
Robert Phillips2f493142017-03-02 18:18:38 -0500279 proxy, nullptr));
robertphillipsc5035e72016-03-17 06:58:39 -0700280
robertphillipsb6c65e92016-02-04 10:52:42 -0800281 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
282
robertphillipsc5035e72016-03-17 06:58:39 -0700283 {
Robert Phillips2c6d2bf2017-02-21 10:19:29 -0500284 sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeDeferredFromGpu(
Robert Phillips2f493142017-03-02 18:18:38 -0500285 context, subset,
robertphillipsc5035e72016-03-17 06:58:39 -0700286 kNeedNewImageUniqueID_SpecialImage,
Robert Phillips2f493142017-03-02 18:18:38 -0500287 std::move(proxy), nullptr));
robertphillipsed086ca2016-04-26 15:02:25 -0700288 test_image(subSImg1, reporter, context, true, kPad, kFullSize);
robertphillipsc5035e72016-03-17 06:58:39 -0700289 }
290
291 {
robertphillips37bd7c32016-03-17 14:31:39 -0700292 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset));
robertphillipsed086ca2016-04-26 15:02:25 -0700293 test_image(subSImg2, reporter, context, true, kPad, kFullSize);
robertphillipsc5035e72016-03-17 06:58:39 -0700294 }
robertphillipsb6c65e92016-02-04 10:52:42 -0800295}
296
Robert Phillips8bc06d02016-11-01 17:28:40 -0400297DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_DeferredGpu, reporter, ctxInfo) {
298 GrContext* context = ctxInfo.grContext();
Robert Phillips0bd24dc2018-01-16 08:06:32 -0500299 GrProxyProvider* proxyProvider = context->contextPriv().proxyProvider();
Robert Phillips8bc06d02016-11-01 17:28:40 -0400300 SkBitmap bm = create_bm();
301
302 GrSurfaceDesc desc;
Robert Phillips96be9df2017-07-21 14:17:45 +0000303 desc.fFlags = kNone_GrSurfaceFlags;
Robert Phillips8bc06d02016-11-01 17:28:40 -0400304 desc.fWidth = kFullSize;
305 desc.fHeight = kFullSize;
Robert Phillips16d8ec62017-07-27 16:16:25 -0400306 desc.fConfig = kSkia8888_GrPixelConfig;
Robert Phillips8bc06d02016-11-01 17:28:40 -0400307
Brian Salomon58389b92018-03-07 13:01:25 -0500308 sk_sp<GrTextureProxy> proxy =
309 proxyProvider->createTextureProxy(desc, SkBudgeted::kNo, bm.getPixels(), bm.rowBytes());
Robert Phillips8bc06d02016-11-01 17:28:40 -0400310 if (!proxy) {
311 return;
312 }
313
314 sk_sp<SkSpecialImage> fullSImg(SkSpecialImage::MakeDeferredFromGpu(
315 context,
316 SkIRect::MakeWH(kFullSize, kFullSize),
317 kNeedNewImageUniqueID_SpecialImage,
Robert Phillips2f493142017-03-02 18:18:38 -0500318 proxy, nullptr));
Robert Phillips8bc06d02016-11-01 17:28:40 -0400319
320 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize);
321
322 {
323 sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeDeferredFromGpu(
Robert Phillips2f493142017-03-02 18:18:38 -0500324 context, subset,
Robert Phillips8bc06d02016-11-01 17:28:40 -0400325 kNeedNewImageUniqueID_SpecialImage,
Robert Phillips2f493142017-03-02 18:18:38 -0500326 std::move(proxy), nullptr));
Robert Phillips8bc06d02016-11-01 17:28:40 -0400327 test_image(subSImg1, reporter, context, true, kPad, kFullSize);
328 }
329
330 {
331 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset));
332 test_image(subSImg2, reporter, context, true, kPad, kFullSize);
333 }
334}