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

Side by Side Diff: tests/SpecialImageTest.cpp

Issue 1869503002: Make existing unit tests only run on GL contexts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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, ctxInfo) { 206 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialImage_MakeTexture, reporter, ctxInf o) {
207 GrContext* context = ctxInfo.fGrContext; 207 GrContext* context = ctxInfo.fGrContext;
208 SkBitmap bm = create_bm(); 208 SkBitmap bm = create_bm();
209 209
210 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller Size); 210 const SkIRect& subset = SkIRect::MakeXYWH(kPad, kPad, kSmallerSize, kSmaller Size);
211 211
212 { 212 {
213 // raster 213 // raster
214 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster( 214 sk_sp<SkSpecialImage> rasterImage(SkSpecialImage::MakeFromRaster(
215 nullptr, 215 nullptr,
216 SkIRect: :MakeWH(kFullSize, 216 SkIRect: :MakeWH(kFullSize,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 260
261 { 261 {
262 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset)); 262 sk_sp<SkSpecialImage> subGPUImage(gpuImage->makeSubset(subset));
263 263
264 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullp tr, context)); 264 sk_sp<SkSpecialImage> fromSubGPU(subGPUImage->makeTextureImage(nullp tr, context));
265 test_texture_backed(reporter, subGPUImage, fromSubGPU); 265 test_texture_backed(reporter, subGPUImage, fromSubGPU);
266 } 266 }
267 } 267 }
268 } 268 }
269 269
270 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) { 270 DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(SpecialImage_Gpu, reporter, ctxInfo) {
271 GrContext* context = ctxInfo.fGrContext; 271 GrContext* context = ctxInfo.fGrContext;
272 SkBitmap bm = create_bm(); 272 SkBitmap bm = create_bm();
273 273
274 GrSurfaceDesc desc; 274 GrSurfaceDesc desc;
275 desc.fConfig = kSkia8888_GrPixelConfig; 275 desc.fConfig = kSkia8888_GrPixelConfig;
276 desc.fFlags = kNone_GrSurfaceFlags; 276 desc.fFlags = kNone_GrSurfaceFlags;
277 desc.fWidth = kFullSize; 277 desc.fWidth = kFullSize;
278 desc.fHeight = kFullSize; 278 desc.fHeight = kFullSize;
279 279
280 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de sc, 280 SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(de sc,
(...skipping 19 matching lines...) Expand all
300 test_image(subSImg1, reporter, false, true, kPad, kFullSize); 300 test_image(subSImg1, reporter, false, true, kPad, kFullSize);
301 } 301 }
302 302
303 { 303 {
304 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset)); 304 sk_sp<SkSpecialImage> subSImg2(fullSImg->makeSubset(subset));
305 test_image(subSImg2, reporter, false, true, kPad, kFullSize); 305 test_image(subSImg2, reporter, false, true, kPad, kFullSize);
306 } 306 }
307 } 307 }
308 308
309 #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