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

Side by Side Diff: tests/GrContextFactoryTest.cpp

Issue 1966013002: Turn ContextInfos returned by GrContextFactory into structs. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Address comment Created 4 years, 7 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/GrContextAbandonTest.cpp ('k') | tests/GrDrawTargetTest.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 #include "SkTypes.h" 8 #include "SkTypes.h"
9 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 } 68 }
69 } 69 }
70 } 70 }
71 } 71 }
72 72
73 DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) { 73 DEF_GPUTEST(GrContextFactory_abandon, reporter, /*factory*/) {
74 GrContextFactory testFactory; 74 GrContextFactory testFactory;
75 for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) { 75 for (int i = 0; i < GrContextFactory::kContextTypeCnt; ++i) {
76 GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i; 76 GrContextFactory::ContextType ctxType = (GrContextFactory::ContextType) i;
77 ContextInfo info1 = testFactory.getContextInfo(ctxType); 77 ContextInfo info1 = testFactory.getContextInfo(ctxType);
78 if (!info1.fGrContext) { 78 if (!info1.grContext()) {
79 continue; 79 continue;
80 } 80 }
81 if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend) { 81 if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend) {
82 REPORTER_ASSERT(reporter, info1.fGLContext); 82 REPORTER_ASSERT(reporter, info1.glContext());
83 } 83 }
84 // Ref for comparison. The API does not explicitly say that this stays alive. 84 // Ref for comparison. The API does not explicitly say that this stays alive.
85 info1.fGrContext->ref(); 85 info1.grContext()->ref();
86 testFactory.abandonContexts(); 86 testFactory.abandonContexts();
87 87
88 // Test that we get different context after abandon. 88 // Test that we get different context after abandon.
89 ContextInfo info2 = testFactory.getContextInfo(ctxType); 89 ContextInfo info2 = testFactory.getContextInfo(ctxType);
90 REPORTER_ASSERT(reporter, info2.fGrContext); 90 REPORTER_ASSERT(reporter, info2.grContext());
91 if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend) { 91 if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend) {
92 REPORTER_ASSERT(reporter, info2.fGLContext); 92 REPORTER_ASSERT(reporter, info2.glContext());
93 } 93 }
94 REPORTER_ASSERT(reporter, info1.fGrContext != info2.fGrContext); 94 REPORTER_ASSERT(reporter, info1.grContext() != info2.grContext());
95 // fGLContext should also change, but it also could get the same address . 95 // The GL context should also change, but it also could get the same add ress.
96 96
97 info1.fGrContext->unref(); 97 info1.grContext()->unref();
98 } 98 }
99 } 99 }
100 100
101 #endif 101 #endif
OLDNEW
« no previous file with comments | « tests/GrContextAbandonTest.cpp ('k') | tests/GrDrawTargetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698