Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1273)

Side by Side Diff: tests/SpecialImageTest.cpp

Issue 1860593002: One signature for creating unit tests that run on premade GrContexts (Closed) Base URL: https://skia.googlesource.com/skia.git@try_no_native
Patch Set: another guess to fix windows Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/SRGBReadWritePixelsTest.cpp ('k') | tests/SpecialSurfaceTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file 5 * found in the LICENSE file
6 */ 6 */
7 7
8 #include "SkAutoPixmapStorage.h" 8 #include "SkAutoPixmapStorage.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 const sk_sp<SkSpecialImage>& orig, 196 const sk_sp<SkSpecialImage>& orig,
197 const sk_sp<SkSpecialImage>& gpuBacked) { 197 const sk_sp<SkSpecialImage>& gpuBacked) {
198 REPORTER_ASSERT(reporter, gpuBacked); 198 REPORTER_ASSERT(reporter, gpuBacked);
199 REPORTER_ASSERT(reporter, gpuBacked->peekTexture()); 199 REPORTER_ASSERT(reporter, gpuBacked->peekTexture());
200 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID()); 200 REPORTER_ASSERT(reporter, gpuBacked->uniqueID() == orig->uniqueID());
201 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().widt h() && 201 REPORTER_ASSERT(reporter, gpuBacked->subset().width() == orig->subset().widt h() &&
202 gpuBacked->subset().height() == orig->subset().hei ght()); 202 gpuBacked->subset().height() == orig->subset().hei ght());
203 } 203 }
204 204
205 // Test out the SkSpecialImage::makeTextureImage entry point 205 // Test out the SkSpecialImage::makeTextureImage entry point
206 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, context) { 206 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInfo) {
207 GrContext* context = ctxInfo.fGrContext;
207 SkBitmap bm = create_bm(); 208 SkBitmap bm = create_bm();
208 209
209 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller Size); 210 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller Size);
210 211
211 { 212 {
212 // raster 213 // raster
213 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( 214 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster(
214 nullptr, 215 nullptr,
215 SkIRect: :MakeWH(kFullSize, 216 SkIRect: :MakeWH(kFullSize,
216 kFullSize), 217 kFullSize),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 260
260 { 261 {
261 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); 262 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset));
262 263
263 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullp tr, context)); 264 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullp tr, context));
264 test_texture_backed(reporter, subGPUImage, fromSubGPU); 265 test_texture_backed(reporter, subGPUImage, fromSubGPU);
265 } 266 }
266 } 267 }
267 } 268 }
268 269
269 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, context) { 270 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
271 GrContext* context = ctxInfo.fGrContext;
270 SkBitmap bm = create_bm(); 272 SkBitmap bm = create_bm();
271 273
272 GrSurfaceDesc desc; 274 GrSurfaceDesc desc;
273 desc.fConfig = kSkia8888_GrPixelConfig; 275 desc.fConfig = kSkia8888_GrPixelConfig;
274 desc.fFlags = kNone_GrSurfaceFlags; 276 desc.fFlags = kNone_GrSurfaceFlags;
275 desc.fWidth = kFullSize; 277 desc.fWidth = kFullSize;
276 desc.fHeight = kFullSize; 278 desc.fHeight = kFullSize;
277 279
278 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de sc, 280 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de sc,
279 Sk Budgeted::kNo, 281 Sk Budgeted::kNo,
(...skipping 18 matching lines...) Expand all
298 test_image(subSImg1, reporter, false, true, kPad, kFullSize); 300 test_image(subSImg1, reporter, false, true, kPad, kFullSize);
299 } 301 }
300 302
301 { 303 {
302 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); 304 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset));
303 test_image(subSImg2, reporter, false, true, kPad, kFullSize); 305 test_image(subSImg2, reporter, false, true, kPad, kFullSize);
304 } 306 }
305 } 307 }
306 308
307 #endif 309 #endif
OLDNEW
« no previous file with comments | « tests/SRGBReadWritePixelsTest.cpp ('k') | tests/SpecialSurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698