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

Side by Side Diff: tests/GpuDrawPathTest.cpp

Issue 585493002: use surface instead of explicitly making gpudevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | tests/ResourceCacheTest.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 2013 Google Inc. 2 * Copyright 2013 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 #if SK_SUPPORT_GPU 8 #if SK_SUPPORT_GPU
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
11 #include "GrContextFactory.h" 11 #include "GrContextFactory.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkCanvas.h" 13 #include "SkCanvas.h"
14 #include "SkColor.h" 14 #include "SkColor.h"
15 #include "SkGpuDevice.h"
16 #include "SkPaint.h" 15 #include "SkPaint.h"
17 #include "SkRRect.h" 16 #include "SkRRect.h"
18 #include "SkRect.h" 17 #include "SkRect.h"
18 #include "SkSurface.h"
19 #include "Test.h" 19 #include "Test.h"
20 20
21 static void test_drawPathEmpty(skiatest::Reporter*, SkCanvas* canvas) { 21 static void test_drawPathEmpty(skiatest::Reporter*, SkCanvas* canvas) {
22 // Filling an empty path should not crash. 22 // Filling an empty path should not crash.
23 SkPaint paint; 23 SkPaint paint;
24 canvas->drawRect(SkRect(), paint); 24 canvas->drawRect(SkRect(), paint);
25 canvas->drawPath(SkPath(), paint); 25 canvas->drawPath(SkPath(), paint);
26 canvas->drawOval(SkRect(), paint); 26 canvas->drawOval(SkRect(), paint);
27 canvas->drawRect(SkRect(), paint); 27 canvas->drawRect(SkRect(), paint);
28 canvas->drawRRect(SkRRect(), paint); 28 canvas->drawRRect(SkRRect(), paint);
(...skipping 18 matching lines...) Expand all
47 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) { 47 for (int type = 0; type < GrContextFactory::kLastGLContextType; ++type) {
48 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G LContextType>(type); 48 GrContextFactory::GLContextType glType = static_cast<GrContextFactory::G LContextType>(type);
49 49
50 GrContext* grContext = factory->get(glType); 50 GrContext* grContext = factory->get(glType);
51 if (NULL == grContext) { 51 if (NULL == grContext) {
52 continue; 52 continue;
53 } 53 }
54 static const int sampleCounts[] = { 0, 4, 16 }; 54 static const int sampleCounts[] = { 0, 4, 16 };
55 55
56 for (size_t i = 0; i < SK_ARRAY_COUNT(sampleCounts); ++i) { 56 for (size_t i = 0; i < SK_ARRAY_COUNT(sampleCounts); ++i) {
57 const int W = 255; 57 SkImageInfo info = SkImageInfo::MakeN32Premul(255, 255);
58 const int H = 255; 58
59 59 SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(grContext , info, sampleCounts[i]));
60 GrTextureDesc desc; 60 test_drawPathEmpty(reporter, surface->getCanvas());
61 desc.fConfig = kSkia8888_GrPixelConfig;
62 desc.fFlags = kRenderTarget_GrTextureFlagBit;
63 desc.fWidth = W;
64 desc.fHeight = H;
65 desc.fSampleCnt = sampleCounts[i];
66 SkAutoTUnref<GrTexture> texture(grContext->createUncachedTexture(des c, NULL, 0));
67 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(texture.get())) ;
68 SkCanvas drawingCanvas(device.get());
69
70 test_drawPathEmpty(reporter, &drawingCanvas);
71 } 61 }
72 } 62 }
73 } 63 }
74 64
75 #endif 65 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/ResourceCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698