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

Side by Side Diff: tests/GLProgramsTest.cpp

Issue 2164363002: Add SkColorSpace to GrDrawContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove ':' from comment Created 4 years, 5 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/DFPathRendererTest.cpp ('k') | tests/ImageFilterTest.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 2011 Google Inc. 2 * Copyright 2011 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 // This is a GPU-backend specific test. It relies on static intializers to work 8 // This is a GPU-backend specific test. It relies on static intializers to work
9 9
10 #include "SkTypes.h" 10 #include "SkTypes.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 SkRandom* random, 151 SkRandom* random,
152 const GrCaps* caps) { 152 const GrCaps* caps) {
153 GrSurfaceOrigin origin = random->nextBool() ? kTopLeft_GrSurfaceOrigin 153 GrSurfaceOrigin origin = random->nextBool() ? kTopLeft_GrSurfaceOrigin
154 : kBottomLeft_GrSurfaceOrigin; 154 : kBottomLeft_GrSurfaceOrigin;
155 int sampleCnt = random->nextBool() ? SkTMin(4, caps->maxSampleCount()) : 0; 155 int sampleCnt = random->nextBool() ? SkTMin(4, caps->maxSampleCount()) : 0;
156 156
157 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kExac t, 157 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kExac t,
158 kRenderTargetWidth, 158 kRenderTargetWidth,
159 kRenderTargetHeight , 159 kRenderTargetHeight ,
160 kRGBA_8888_GrPixelC onfig, 160 kRGBA_8888_GrPixelC onfig,
161 nullptr,
161 sampleCnt, 162 sampleCnt,
162 origin)); 163 origin));
163 return drawContext; 164 return drawContext;
164 } 165 }
165 166
166 static void set_random_xpf(GrPaint* paint, GrProcessorTestData* d) { 167 static void set_random_xpf(GrPaint* paint, GrProcessorTestData* d) {
167 sk_sp<GrXPFactory> xpf(GrProcessorTestFactory<GrXPFactory>::Make(d)); 168 sk_sp<GrXPFactory> xpf(GrProcessorTestFactory<GrXPFactory>::Make(d));
168 SkASSERT(xpf); 169 SkASSERT(xpf);
169 paint->setXPFactory(std::move(xpf)); 170 paint->setXPFactory(std::move(xpf));
170 } 171 }
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 339
339 drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch, uss , snapToCenters); 340 drawContext->drawContextPriv().testingOnly_drawBatch(grPaint, batch, uss , snapToCenters);
340 } 341 }
341 // Flush everything, test passes if flush is successful(ie, no asserts are h it, no crashes) 342 // Flush everything, test passes if flush is successful(ie, no asserts are h it, no crashes)
342 drawingManager->flush(); 343 drawingManager->flush();
343 344
344 // Validate that GrFPs work correctly without an input. 345 // Validate that GrFPs work correctly without an input.
345 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kExac t, 346 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::kExac t,
346 kRenderTargetWidth, 347 kRenderTargetWidth,
347 kRenderTargetHeight , 348 kRenderTargetHeight ,
348 kRGBA_8888_GrPixelC onfig)); 349 kRGBA_8888_GrPixelC onfig,
350 nullptr));
349 if (!drawContext) { 351 if (!drawContext) {
350 SkDebugf("Could not allocate a drawContext"); 352 SkDebugf("Could not allocate a drawContext");
351 return false; 353 return false;
352 } 354 }
353 355
354 int fpFactoryCnt = GrProcessorTestFactory<GrFragmentProcessor>::Count(); 356 int fpFactoryCnt = GrProcessorTestFactory<GrFragmentProcessor>::Count();
355 for (int i = 0; i < fpFactoryCnt; ++i) { 357 for (int i = 0; i < fpFactoryCnt; ++i) {
356 // Since FP factories internally randomize, call each 10 times. 358 // Since FP factories internally randomize, call each 10 times.
357 for (int j = 0; j < 10; ++j) { 359 for (int j = 0; j < 10; ++j) {
358 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)) ; 360 SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context)) ;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 GrContextOptions opts; 442 GrContextOptions opts;
441 opts.fSuppressPrints = true; 443 opts.fSuppressPrints = true;
442 sk_gpu_test::GrContextFactory debugFactory(opts); 444 sk_gpu_test::GrContextFactory debugFactory(opts);
443 skiatest::RunWithGPUTestContexts(test_glprograms_native, &is_native_gl_conte xt_type, 445 skiatest::RunWithGPUTestContexts(test_glprograms_native, &is_native_gl_conte xt_type,
444 reporter, &debugFactory); 446 reporter, &debugFactory);
445 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts, 447 skiatest::RunWithGPUTestContexts(test_glprograms_other_contexts,
446 &is_other_rendering_gl_context_type, report er, &debugFactory); 448 &is_other_rendering_gl_context_type, report er, &debugFactory);
447 } 449 }
448 450
449 #endif 451 #endif
OLDNEW
« no previous file with comments | « tests/DFPathRendererTest.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698