OLD | NEW |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.fGrContext) { |
79 continue; | 79 continue; |
80 } | 80 } |
81 REPORTER_ASSERT(reporter, info1.fGLContext); | 81 if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend)
{ |
| 82 REPORTER_ASSERT(reporter, info1.fGLContext); |
| 83 } |
82 // 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. |
83 info1.fGrContext->ref(); | 85 info1.fGrContext->ref(); |
84 testFactory.abandonContexts(); | 86 testFactory.abandonContexts(); |
85 | 87 |
86 // Test that we get different context after abandon. | 88 // Test that we get different context after abandon. |
87 ContextInfo info2 = testFactory.getContextInfo(ctxType); | 89 ContextInfo info2 = testFactory.getContextInfo(ctxType); |
88 REPORTER_ASSERT(reporter, info2.fGrContext); | 90 REPORTER_ASSERT(reporter, info2.fGrContext); |
89 REPORTER_ASSERT(reporter, info2.fGLContext); | 91 if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend)
{ |
| 92 REPORTER_ASSERT(reporter, info2.fGLContext); |
| 93 } |
90 REPORTER_ASSERT(reporter, info1.fGrContext != info2.fGrContext); | 94 REPORTER_ASSERT(reporter, info1.fGrContext != info2.fGrContext); |
91 // fGLContext should also change, but it also could get the same address
. | 95 // fGLContext should also change, but it also could get the same address
. |
92 | 96 |
93 info1.fGrContext->unref(); | 97 info1.fGrContext->unref(); |
94 } | 98 } |
95 } | 99 } |
96 | 100 |
97 #endif | 101 #endif |
OLD | NEW |