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

Side by Side Diff: tests/GpuDrawPathTest.cpp

Issue 132293005: Add a DEF_GPUTEST() macro. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fatory -> factory Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « tests/GpuColorFilterTest.cpp ('k') | tests/GrContextFactoryTest.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
2 /* 1 /*
3 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9 #if SK_SUPPORT_GPU 8 #if SK_SUPPORT_GPU
10 9
11 #include "GrContext.h" 10 #include "GrContext.h"
12 #include "GrContextFactory.h" 11 #include "GrContextFactory.h"
13 #include "SkBitmap.h" 12 #include "SkBitmap.h"
14 #include "SkCanvas.h" 13 #include "SkCanvas.h"
15 #include "SkColor.h" 14 #include "SkColor.h"
16 #include "SkGpuDevice.h" 15 #include "SkGpuDevice.h"
17 #include "SkPaint.h" 16 #include "SkPaint.h"
18 #include "SkRect.h" 17 #include "SkRect.h"
19 #include "SkRRect.h" 18 #include "SkRRect.h"
20 #include "Test.h" 19 #include "Test.h"
20 #include "TestClassDef.h"
21 21
22 static void test_drawPathEmpty(skiatest::Reporter*, SkCanvas* canvas) 22 static void test_drawPathEmpty(skiatest::Reporter*, SkCanvas* canvas) {
23 {
24 // Filling an empty path should not crash. 23 // Filling an empty path should not crash.
25 SkPaint paint; 24 SkPaint paint;
26 canvas->drawRect(SkRect(), paint); 25 canvas->drawRect(SkRect(), paint);
27 canvas->drawPath(SkPath(), paint); 26 canvas->drawPath(SkPath(), paint);
28 canvas->drawOval(SkRect(), paint); 27 canvas->drawOval(SkRect(), paint);
29 canvas->drawRect(SkRect(), paint); 28 canvas->drawRect(SkRect(), paint);
30 canvas->drawRRect(SkRRect(), paint); 29 canvas->drawRRect(SkRRect(), paint);
31 30
32 // Stroking an empty path should not crash. 31 // Stroking an empty path should not crash.
33 paint.setAntiAlias(true); 32 paint.setAntiAlias(true);
34 paint.setStyle(SkPaint::kStroke_Style); 33 paint.setStyle(SkPaint::kStroke_Style);
35 paint.setColor(SK_ColorGRAY); 34 paint.setColor(SK_ColorGRAY);
36 paint.setStrokeWidth(SkIntToScalar(20)); 35 paint.setStrokeWidth(SkIntToScalar(20));
37 paint.setStrokeJoin(SkPaint::kRound_Join); 36 paint.setStrokeJoin(SkPaint::kRound_Join);
38 canvas->drawRect(SkRect(), paint); 37 canvas->drawRect(SkRect(), paint);
39 canvas->drawPath(SkPath(), paint); 38 canvas->drawPath(SkPath(), paint);
40 canvas->drawOval(SkRect(), paint); 39 canvas->drawOval(SkRect(), paint);
41 canvas->drawRect(SkRect(), paint); 40 canvas->drawRect(SkRect(), paint);
42 canvas->drawRRect(SkRRect(), paint); 41 canvas->drawRRect(SkRRect(), paint);
43 } 42 }
44 43
45 44
46 static void TestGpuDrawPath(skiatest::Reporter* reporter, GrContextFactory* fact ory) { 45 DEF_GPUTEST(GpuDrawPath, reporter, factory) {
47 return; 46 return;
48 47
49 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { 48 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
50 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G LContextType>(type); 49 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G LContextType>(type);
51 50
52 GrContext* grContext = factory->get(glType); 51 GrContext* grContext = factory->get(glType);
53 if (NULL == grContext) { 52 if (NULL == grContext) {
54 continue; 53 continue;
55 } 54 }
56 static const int sampleCounts[] = { 0, 4, 16 }; 55 static const int sampleCounts[] = { 0, 4, 16 };
(...skipping 10 matching lines...) Expand all
67 desc.fSampleCnt = sampleCounts[i]; 66 desc.fSampleCnt = sampleCounts[i];
68 SkAutoTUnref<GrTexture> texture(grContext->createUncachedTexture(des c, NULL, 0)); 67 SkAutoTUnref<GrTexture> texture(grContext->createUncachedTexture(des c, NULL, 0));
69 SkAutoTUnref<SkGpuDevice> device(SkNEW_ARGS(SkGpuDevice, (grContext, texture.get()))); 68 SkAutoTUnref<SkGpuDevice> device(SkNEW_ARGS(SkGpuDevice, (grContext, texture.get())));
70 SkCanvas drawingCanvas(device.get()); 69 SkCanvas drawingCanvas(device.get());
71 70
72 test_drawPathEmpty(reporter, &drawingCanvas); 71 test_drawPathEmpty(reporter, &drawingCanvas);
73 } 72 }
74 } 73 }
75 } 74 }
76 75
77 #include "TestClassDef.h"
78 DEFINE_GPUTESTCLASS("GpuDrawPath", TestGpuDrawPathClass, TestGpuDrawPath)
79
80 #endif 76 #endif
OLDNEW
« no previous file with comments | « tests/GpuColorFilterTest.cpp ('k') | tests/GrContextFactoryTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698