| 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.grContext()) { | 78 if (!info1.grContext()) { |
| 79 continue; | 79 continue; |
| 80 } | 80 } |
| 81 if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend)
{ | 81 REPORTER_ASSERT(reporter, info1.testContext()); |
| 82 REPORTER_ASSERT(reporter, info1.glContext()); | |
| 83 } | |
| 84 // Ref for comparison. The API does not explicitly say that this stays
alive. | 82 // Ref for comparison. The API does not explicitly say that this stays
alive. |
| 85 info1.grContext()->ref(); | 83 info1.grContext()->ref(); |
| 86 testFactory.abandonContexts(); | 84 testFactory.abandonContexts(); |
| 87 | 85 |
| 88 // Test that we get different context after abandon. | 86 // Test that we get different context after abandon. |
| 89 ContextInfo info2 = testFactory.getContextInfo(ctxType); | 87 ContextInfo info2 = testFactory.getContextInfo(ctxType); |
| 90 REPORTER_ASSERT(reporter, info2.grContext()); | 88 REPORTER_ASSERT(reporter, info2.grContext()); |
| 91 if (GrContextFactory::ContextTypeBackend(ctxType) == kOpenGL_GrBackend)
{ | 89 REPORTER_ASSERT(reporter, info2.testContext()); |
| 92 REPORTER_ASSERT(reporter, info2.glContext()); | 90 |
| 93 } | |
| 94 REPORTER_ASSERT(reporter, info1.grContext() != info2.grContext()); | 91 REPORTER_ASSERT(reporter, info1.grContext() != info2.grContext()); |
| 95 // The GL context should also change, but it also could get the same add
ress. | 92 // The GL context should also change, but it also could get the same add
ress. |
| 96 | 93 |
| 97 info1.grContext()->unref(); | 94 info1.grContext()->unref(); |
| 98 } | 95 } |
| 99 } | 96 } |
| 100 | 97 |
| 101 #endif | 98 #endif |
| OLD | NEW |