Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "include/private/GrImageContext.h" |
Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame] | 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "src/gpu/GrCaps.h" |
| 11 | #include "src/gpu/GrImageContextPriv.h" |
| 12 | #include "src/gpu/GrProxyProvider.h" |
Robert Phillips | 7f11fb5 | 2019-12-03 13:35:19 -0500 | [diff] [blame] | 13 | #include "src/gpu/effects/GrSkSLFP.h" |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame] | 14 | |
Robert Phillips | a9162df | 2019-02-11 14:12:03 -0500 | [diff] [blame] | 15 | #define ASSERT_SINGLE_OWNER \ |
| 16 | SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());) |
| 17 | |
| 18 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
Robert Phillips | c1541ae | 2019-02-04 12:05:37 -0500 | [diff] [blame] | 19 | GrImageContext::GrImageContext(GrBackendApi backend, |
| 20 | const GrContextOptions& options, |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame] | 21 | uint32_t contextID) |
| 22 | : INHERITED(backend, options, contextID) { |
| 23 | fProxyProvider.reset(new GrProxyProvider(this)); |
Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | GrImageContext::~GrImageContext() {} |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame] | 27 | |
Robert Phillips | a9162df | 2019-02-11 14:12:03 -0500 | [diff] [blame] | 28 | void GrImageContext::abandonContext() { |
| 29 | ASSERT_SINGLE_OWNER |
| 30 | |
| 31 | fAbandoned = true; |
| 32 | } |
| 33 | |
| 34 | bool GrImageContext::abandoned() const { |
| 35 | ASSERT_SINGLE_OWNER |
| 36 | |
| 37 | return fAbandoned; |
| 38 | } |
| 39 | |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame] | 40 | /////////////////////////////////////////////////////////////////////////////////////////////////// |
| 41 | sk_sp<const GrCaps> GrImageContextPriv::refCaps() const { |
| 42 | return fContext->refCaps(); |
| 43 | } |