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

Side by Side Diff: tests/ImageIsOpaqueTest.cpp

Issue 1448873002: Generate list of GPU contexts outside tests (Closed) Base URL: https://skia.googlesource.com/skia.git@commandbuffer-as-api-01-gpu-test-context-support
Patch Set: make blurtest for all rendering contexts Created 5 years 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/ImageFilterTest.cpp ('k') | tests/ImageNewShaderTest.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 2014 Google Inc. 2 * Copyright 2014 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 "SkTypes.h" 8 #include "SkTypes.h"
9 #include "Test.h" 9 #include "Test.h"
10 10
11 #if SK_SUPPORT_GPU 11 #if SK_SUPPORT_GPU
12 #include "GrContextFactory.h" 12 #include "GrContext.h"
13 #endif 13 #endif
14 #include "SkImage.h" 14 #include "SkImage.h"
15 #include "SkSurface.h" 15 #include "SkSurface.h"
16 #include "SkReadBuffer.h" 16 #include "SkReadBuffer.h"
17 #include "SkWriteBuffer.h" 17 #include "SkWriteBuffer.h"
18 18
19 static void test_flatten(skiatest::Reporter* reporter, const SkImageInfo& info) { 19 static void test_flatten(skiatest::Reporter* reporter, const SkImageInfo& info) {
20 // just need a safe amount of storage, but ensure that it is 4-byte aligned. 20 // just need a safe amount of storage, but ensure that it is 4-byte aligned.
21 int32_t storage[(sizeof(SkImageInfo)*2) / sizeof(int32_t)]; 21 int32_t storage[(sizeof(SkImageInfo)*2) / sizeof(int32_t)];
22 SkWriteBuffer wb(storage, sizeof(storage)); 22 SkWriteBuffer wb(storage, sizeof(storage));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 SkAutoTUnref<SkSurface> surfaceTransparent(SkSurface::NewRaster(infoTranspar ent)); 58 SkAutoTUnref<SkSurface> surfaceTransparent(SkSurface::NewRaster(infoTranspar ent));
59 check_isopaque(reporter, surfaceTransparent, false); 59 check_isopaque(reporter, surfaceTransparent, false);
60 60
61 SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType); 61 SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType);
62 SkAutoTUnref<SkSurface> surfaceOpaque(SkSurface::NewRaster(infoOpaque)); 62 SkAutoTUnref<SkSurface> surfaceOpaque(SkSurface::NewRaster(infoOpaque));
63 check_isopaque(reporter, surfaceOpaque, true); 63 check_isopaque(reporter, surfaceOpaque, true);
64 } 64 }
65 65
66 #if SK_SUPPORT_GPU 66 #if SK_SUPPORT_GPU
67 67
68 DEF_GPUTEST(ImageIsOpaqueTest_GPU, reporter, factory) { 68 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, context) {
69 for (int i = 0; i < GrContextFactory::kGLContextTypeCnt; ++i) { 69 SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5);
70 GrContextFactory::GLContextType glCtxType = (GrContextFactory::GLContext Type) i; 70 SkAutoTUnref<SkSurface> surfaceTransparent(
71 SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, infoTranspa rent));
72 check_isopaque(reporter, surfaceTransparent, false);
71 73
72 if (!GrContextFactory::IsRenderingGLContext(glCtxType)) { 74 SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType);
73 continue; 75 SkAutoTUnref<SkSurface> surfaceOpaque(
74 } 76 SkSurface::NewRenderTarget(context,SkSurface::kNo_Budgeted, infoOpaque)) ;
75 77
76 GrContext* context = factory->get(glCtxType); 78 check_isopaque(reporter, surfaceOpaque, true);
77
78 if (nullptr == context) {
79 continue;
80 }
81
82 SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5);
83 SkAutoTUnref<SkSurface> surfaceTransparent(
84 SkSurface::NewRenderTarget(context,SkSurface::kNo_Budgeted, infoTran sparent));
85 check_isopaque(reporter, surfaceTransparent, false);
86
87 SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType) ;
88 SkAutoTUnref<SkSurface> surfaceOpaque(
89 SkSurface::NewRenderTarget(context,SkSurface::kNo_Budgeted, infoOpaq ue));
90
91 check_isopaque(reporter, surfaceOpaque, true);
92 }
93 } 79 }
94 80
95 #endif 81 #endif
OLDNEW
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | tests/ImageNewShaderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698