robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 8 | #include "SkAutoPixmapStorage.h" |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 9 | #include "SkBitmap.h" |
| 10 | #include "SkCanvas.h" |
| 11 | #include "SkImage.h" |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 12 | #include "SkPixmap.h" |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 13 | #include "SkSpecialImage.h" |
| 14 | #include "SkSpecialSurface.h" |
robertphillips | b4bd11e | 2016-03-21 13:44:18 -0700 | [diff] [blame] | 15 | #include "SkSurface.h" |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 16 | #include "Test.h" |
robertphillips | 4418dba | 2016-03-07 12:45:14 -0800 | [diff] [blame] | 17 | #include "TestingSpecialImageAccess.h" |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 18 | |
| 19 | #if SK_SUPPORT_GPU |
| 20 | #include "GrContext.h" |
| 21 | #endif |
| 22 | |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 23 | |
| 24 | // This test creates backing resources exactly sized to [kFullSize x kFullSize]. |
| 25 | // It then wraps them in an SkSpecialImage with only the center (red) region being active. |
| 26 | // It then draws the SkSpecialImage to a full sized (all blue) canvas and checks that none |
| 27 | // of the inactive (green) region leaked out. |
| 28 | |
| 29 | static const int kSmallerSize = 10; |
| 30 | static const int kPad = 3; |
| 31 | static const int kFullSize = kSmallerSize + 2 * kPad; |
| 32 | |
| 33 | // Create a bitmap with red in the center and green around it |
| 34 | static SkBitmap create_bm() { |
| 35 | SkBitmap bm; |
| 36 | bm.allocN32Pixels(kFullSize, kFullSize, true); |
| 37 | |
| 38 | SkCanvas temp(bm); |
| 39 | |
| 40 | temp.clear(SK_ColorGREEN); |
| 41 | SkPaint p; |
| 42 | p.setColor(SK_ColorRED); |
| 43 | p.setAntiAlias(false); |
| 44 | |
| 45 | temp.drawRect(SkRect::MakeXYWH(SkIntToScalar(kPad), SkIntToScalar(kPad), |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 46 | SkIntToScalar(kSmallerSize), SkIntToScalar(kSmallerSize)), |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 47 | p); |
| 48 | |
| 49 | return bm; |
| 50 | } |
| 51 | |
| 52 | // Basic test of the SkSpecialImage public API (e.g., peekTexture, peekPixels & draw) |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 53 | static void test_image(const sk_sp<SkSpecialImage>& img, skiatest::Reporter* reporter, |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 54 | GrContext* context, bool peekTextureSucceeds, |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 55 | int offset, int size) { |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 56 | const SkIRect subset = TestingSpecialImageAccess::Subset(img.get()); |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 57 | REPORTER_ASSERT(reporter, offset == subset.left()); |
| 58 | REPORTER_ASSERT(reporter, offset == subset.top()); |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 59 | REPORTER_ASSERT(reporter, kSmallerSize == subset.width()); |
| 60 | REPORTER_ASSERT(reporter, kSmallerSize == subset.height()); |
| 61 | |
| 62 | //-------------- |
robertphillips | b4bd11e | 2016-03-21 13:44:18 -0700 | [diff] [blame] | 63 | // Test that peekTexture reports the correct backing type |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 64 | REPORTER_ASSERT(reporter, peekTextureSucceeds == img->isTextureBacked()); |
| 65 | |
| 66 | #if SK_SUPPORT_GPU |
| 67 | //-------------- |
| 68 | // Test getTextureAsRef - as long as there is a context this should succeed |
| 69 | if (context) { |
| 70 | sk_sp<GrTexture> texture(img->asTextureRef(context)); |
| 71 | REPORTER_ASSERT(reporter, texture); |
| 72 | } |
| 73 | #endif |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 74 | |
| 75 | //-------------- |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 76 | // Test getROPixels - this should always succeed regardless of backing store |
| 77 | SkBitmap bitmap; |
| 78 | REPORTER_ASSERT(reporter, img->getROPixels(&bitmap)); |
| 79 | if (context) { |
| 80 | REPORTER_ASSERT(reporter, kSmallerSize == bitmap.width()); |
| 81 | REPORTER_ASSERT(reporter, kSmallerSize == bitmap.height()); |
| 82 | } else { |
| 83 | REPORTER_ASSERT(reporter, size == bitmap.width()); |
| 84 | REPORTER_ASSERT(reporter, size == bitmap.height()); |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 85 | } |
| 86 | |
| 87 | //-------------- |
robertphillips | b4bd11e | 2016-03-21 13:44:18 -0700 | [diff] [blame] | 88 | // Test that draw restricts itself to the subset |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 89 | SkImageInfo info = SkImageInfo::MakeN32(kFullSize, kFullSize, kOpaque_SkAlphaType); |
| 90 | |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 91 | sk_sp<SkSpecialSurface> surf(img->makeSurface(info)); |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 92 | |
| 93 | SkCanvas* canvas = surf->getCanvas(); |
| 94 | |
| 95 | canvas->clear(SK_ColorBLUE); |
robertphillips | e8c3497 | 2016-02-16 12:09:36 -0800 | [diff] [blame] | 96 | img->draw(canvas, SkIntToScalar(kPad), SkIntToScalar(kPad), nullptr); |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 97 | |
| 98 | SkBitmap bm; |
| 99 | bm.allocN32Pixels(kFullSize, kFullSize, true); |
| 100 | |
| 101 | bool result = canvas->readPixels(bm.info(), bm.getPixels(), bm.rowBytes(), 0, 0); |
| 102 | SkASSERT_RELEASE(result); |
| 103 | |
| 104 | // Only the center (red) portion should've been drawn into the canvas |
| 105 | REPORTER_ASSERT(reporter, SK_ColorBLUE == bm.getColor(kPad-1, kPad-1)); |
| 106 | REPORTER_ASSERT(reporter, SK_ColorRED == bm.getColor(kPad, kPad)); |
| 107 | REPORTER_ASSERT(reporter, SK_ColorRED == bm.getColor(kSmallerSize+kPad-1, |
| 108 | kSmallerSize+kPad-1)); |
| 109 | REPORTER_ASSERT(reporter, SK_ColorBLUE == bm.getColor(kSmallerSize+kPad, |
| 110 | kSmallerSize+kPad)); |
robertphillips | b4bd11e | 2016-03-21 13:44:18 -0700 | [diff] [blame] | 111 | |
| 112 | //-------------- |
| 113 | // Test that makeTightSubset & makeTightSurface return appropriately sized objects |
| 114 | // of the correct backing type |
| 115 | SkIRect newSubset = SkIRect::MakeWH(subset.width(), subset.height()); |
| 116 | { |
| 117 | sk_sp<SkImage> tightImg(img->makeTightSubset(newSubset)); |
| 118 | |
| 119 | REPORTER_ASSERT(reporter, tightImg->width() == subset.width()); |
| 120 | REPORTER_ASSERT(reporter, tightImg->height() == subset.height()); |
| 121 | REPORTER_ASSERT(reporter, peekTextureSucceeds == !!tightImg->getTexture()); |
| 122 | SkPixmap tmpPixmap; |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 123 | REPORTER_ASSERT(reporter, peekTextureSucceeds != !!tightImg->peekPixels(&tmpPixmap)); |
robertphillips | b4bd11e | 2016-03-21 13:44:18 -0700 | [diff] [blame] | 124 | } |
| 125 | { |
| 126 | SkImageInfo info = SkImageInfo::MakeN32(subset.width(), subset.height(), |
| 127 | kPremul_SkAlphaType); |
| 128 | sk_sp<SkSurface> tightSurf(img->makeTightSurface(info)); |
| 129 | |
| 130 | REPORTER_ASSERT(reporter, tightSurf->width() == subset.width()); |
| 131 | REPORTER_ASSERT(reporter, tightSurf->height() == subset.height()); |
| 132 | REPORTER_ASSERT(reporter, peekTextureSucceeds == |
| 133 | !!tightSurf->getTextureHandle(SkSurface::kDiscardWrite_BackendHandleAccess)); |
| 134 | SkPixmap tmpPixmap; |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 135 | REPORTER_ASSERT(reporter, peekTextureSucceeds != !!tightSurf->peekPixels(&tmpPixmap)); |
robertphillips | b4bd11e | 2016-03-21 13:44:18 -0700 | [diff] [blame] | 136 | } |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | DEF_TEST(SpecialImage_Raster, reporter) { |
| 140 | SkBitmap bm = create_bm(); |
| 141 | |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 142 | sk_sp<SkSpecialImage> fullSImage(SkSpecialImage::MakeFromRaster( |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 143 | nullptr, |
| 144 | SkIRect::MakeWH(kFullSize, kFullSize), |
| 145 | bm)); |
| 146 | |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 147 | const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); |
| 148 | |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 149 | { |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 150 | sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromRaster(nullptr, subset, bm)); |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 151 | test_image(subSImg1, reporter, nullptr, false, kPad, kFullSize); |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 152 | } |
| 153 | |
| 154 | { |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 155 | sk_sp<SkSpecialImage> subSImg2(fullSImage->makeSubset(subset)); |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 156 | test_image(subSImg2, reporter, nullptr, false, 0, kSmallerSize); |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 157 | } |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 158 | } |
| 159 | |
| 160 | DEF_TEST(SpecialImage_Image, reporter) { |
| 161 | SkBitmap bm = create_bm(); |
| 162 | |
reed | 9ce9d67 | 2016-03-17 10:51:11 -0700 | [diff] [blame] | 163 | sk_sp<SkImage> fullImage(SkImage::MakeFromBitmap(bm)); |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 164 | |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 165 | sk_sp<SkSpecialImage> fullSImage(SkSpecialImage::MakeFromImage( |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 166 | nullptr, |
| 167 | SkIRect::MakeWH(kFullSize, kFullSize), |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 168 | fullImage)); |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 169 | |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 170 | const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); |
| 171 | |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 172 | { |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 173 | sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromImage(nullptr, subset, |
| 174 | fullImage)); |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 175 | test_image(subSImg1, reporter, nullptr, false, kPad, kFullSize); |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | { |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 179 | sk_sp<SkSpecialImage> subSImg2(fullSImage->makeSubset(subset)); |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 180 | test_image(subSImg2, reporter, nullptr, false, 0, kSmallerSize); |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 181 | } |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 182 | } |
| 183 | |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 184 | DEF_TEST(SpecialImage_Pixmap, reporter) { |
| 185 | SkAutoPixmapStorage pixmap; |
| 186 | |
| 187 | const SkImageInfo info = SkImageInfo::MakeN32(kFullSize, kFullSize, kOpaque_SkAlphaType); |
| 188 | pixmap.alloc(info); |
| 189 | pixmap.erase(SK_ColorGREEN); |
| 190 | |
| 191 | const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); |
| 192 | |
| 193 | pixmap.erase(SK_ColorRED, subset); |
| 194 | |
| 195 | { |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 196 | sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromPixmap(nullptr, subset, pixmap, |
| 197 | nullptr, nullptr)); |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 198 | test_image(img, reporter, nullptr, false, kPad, kFullSize); |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 199 | } |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 200 | } |
| 201 | |
| 202 | |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 203 | #if SK_SUPPORT_GPU |
robertphillips | 83c17fa | 2016-03-18 08:14:27 -0700 | [diff] [blame] | 204 | |
| 205 | static void test_texture_backed(skiatest::Reporter* reporter, |
| 206 | const sk_sp<SkSpecialImage>& orig, |
| 207 | const sk_sp<SkSpecialImage>& gpuBacked) { |
| 208 | REPORTER_ASSERT(reporter, gpuBacked); |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 209 | REPORTER_ASSERT(reporter, gpuBacked->isTextureBacked()); |
robertphillips | 83c17fa | 2016-03-18 08:14:27 -0700 | [diff] [blame] | 210 | REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID()); |
| 211 | REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().width() && |
| 212 | gpuBacked->subset().height() == orig->subset().height()); |
| 213 | } |
| 214 | |
| 215 | // Test out the SkSpecialImage::makeTextureImage entry point |
bsalomon | 68d9134 | 2016-04-12 09:59:58 -0700 | [diff] [blame^] | 216 | DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) { |
bsalomon | f2f1c17 | 2016-04-05 12:59:06 -0700 | [diff] [blame] | 217 | GrContext* context = ctxInfo.fGrContext; |
robertphillips | 83c17fa | 2016-03-18 08:14:27 -0700 | [diff] [blame] | 218 | SkBitmap bm = create_bm(); |
| 219 | |
| 220 | const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); |
| 221 | |
| 222 | { |
| 223 | // raster |
| 224 | sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( |
| 225 | nullptr, |
| 226 | SkIRect::MakeWH(kFullSize, |
| 227 | kFullSize), |
| 228 | bm)); |
| 229 | |
| 230 | { |
| 231 | sk_sp<SkSpecialImage> fromRaster(rasterImage->makeTextureImage(nullptr, context)); |
| 232 | test_texture_backed(reporter, rasterImage, fromRaster); |
| 233 | } |
| 234 | |
| 235 | { |
| 236 | sk_sp<SkSpecialImage> subRasterImage(rasterImage->makeSubset(subset)); |
| 237 | |
| 238 | sk_sp<SkSpecialImage> fromSubRaster(subRasterImage->makeTextureImage(nullptr, context)); |
| 239 | test_texture_backed(reporter, subRasterImage, fromSubRaster); |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | { |
| 244 | // gpu |
| 245 | GrSurfaceDesc desc; |
| 246 | desc.fConfig = kSkia8888_GrPixelConfig; |
| 247 | desc.fFlags = kNone_GrSurfaceFlags; |
| 248 | desc.fWidth = kFullSize; |
| 249 | desc.fHeight = kFullSize; |
| 250 | |
| 251 | SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc, |
| 252 | SkBudgeted::kNo, |
| 253 | bm.getPixels(), |
| 254 | 0)); |
| 255 | if (!texture) { |
| 256 | return; |
| 257 | } |
| 258 | |
| 259 | sk_sp<SkSpecialImage> gpuImage(SkSpecialImage::MakeFromGpu( |
| 260 | nullptr, |
| 261 | SkIRect::MakeWH(kFullSize, |
| 262 | kFullSize), |
| 263 | kNeedNewImageUniqueID_SpecialImage, |
| 264 | texture)); |
| 265 | |
| 266 | { |
| 267 | sk_sp<SkSpecialImage> fromGPU(gpuImage->makeTextureImage(nullptr, context)); |
| 268 | test_texture_backed(reporter, gpuImage, fromGPU); |
| 269 | } |
| 270 | |
| 271 | { |
| 272 | sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); |
| 273 | |
| 274 | sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullptr, context)); |
| 275 | test_texture_backed(reporter, subGPUImage, fromSubGPU); |
| 276 | } |
| 277 | } |
| 278 | } |
| 279 | |
bsalomon | 68d9134 | 2016-04-12 09:59:58 -0700 | [diff] [blame^] | 280 | DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { |
bsalomon | f2f1c17 | 2016-04-05 12:59:06 -0700 | [diff] [blame] | 281 | GrContext* context = ctxInfo.fGrContext; |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 282 | SkBitmap bm = create_bm(); |
| 283 | |
| 284 | GrSurfaceDesc desc; |
| 285 | desc.fConfig = kSkia8888_GrPixelConfig; |
| 286 | desc.fFlags = kNone_GrSurfaceFlags; |
| 287 | desc.fWidth = kFullSize; |
| 288 | desc.fHeight = kFullSize; |
| 289 | |
robertphillips | 83c17fa | 2016-03-18 08:14:27 -0700 | [diff] [blame] | 290 | SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc, |
| 291 | SkBudgeted::kNo, |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 292 | bm.getPixels(), 0)); |
| 293 | if (!texture) { |
| 294 | return; |
| 295 | } |
| 296 | |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 297 | sk_sp<SkSpecialImage> fullSImg(SkSpecialImage::MakeFromGpu( |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 298 | nullptr, |
| 299 | SkIRect::MakeWH(kFullSize, kFullSize), |
| 300 | kNeedNewImageUniqueID_SpecialImage, |
| 301 | texture)); |
| 302 | |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 303 | const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmallerSize); |
| 304 | |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 305 | { |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 306 | sk_sp<SkSpecialImage> subSImg1(SkSpecialImage::MakeFromGpu( |
halcanary | 9d524f2 | 2016-03-29 09:03:52 -0700 | [diff] [blame] | 307 | nullptr, subset, |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 308 | kNeedNewImageUniqueID_SpecialImage, |
| 309 | texture)); |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 310 | test_image(subSImg1, reporter, context, true, kPad, kFullSize); |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | { |
robertphillips | 37bd7c3 | 2016-03-17 14:31:39 -0700 | [diff] [blame] | 314 | sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); |
robertphillips | 6461251 | 2016-04-08 12:10:42 -0700 | [diff] [blame] | 315 | test_image(subSImg2, reporter, context, true, kPad, kFullSize); |
robertphillips | c5035e7 | 2016-03-17 06:58:39 -0700 | [diff] [blame] | 316 | } |
robertphillips | b6c65e9 | 2016-02-04 10:52:42 -0800 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | #endif |