blob: 5e37c7226729491468298e08a8f94de66520bd27 [file] [log] [blame]
Robert Phillips4217ea72019-01-30 13:08:28 -05001/*
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 Kleinc0bd9f92019-04-23 12:05:21 -05008#include "include/private/GrImageContext.h"
Robert Phillips4217ea72019-01-30 13:08:28 -05009
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "src/gpu/GrCaps.h"
11#include "src/gpu/GrImageContextPriv.h"
12#include "src/gpu/GrProxyProvider.h"
Robert Phillips7f11fb52019-12-03 13:35:19 -050013#include "src/gpu/effects/GrSkSLFP.h"
Robert Phillipsa41c6852019-02-07 10:44:10 -050014
Robert Phillipsa9162df2019-02-11 14:12:03 -050015#define ASSERT_SINGLE_OWNER \
16 SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(this->singleOwner());)
17
18///////////////////////////////////////////////////////////////////////////////////////////////////
Robert Phillipsc1541ae2019-02-04 12:05:37 -050019GrImageContext::GrImageContext(GrBackendApi backend,
20 const GrContextOptions& options,
Robert Phillipsa41c6852019-02-07 10:44:10 -050021 uint32_t contextID)
22 : INHERITED(backend, options, contextID) {
23 fProxyProvider.reset(new GrProxyProvider(this));
Robert Phillips4217ea72019-01-30 13:08:28 -050024}
25
26GrImageContext::~GrImageContext() {}
Robert Phillipsa41c6852019-02-07 10:44:10 -050027
Robert Phillipsa9162df2019-02-11 14:12:03 -050028void GrImageContext::abandonContext() {
29 ASSERT_SINGLE_OWNER
30
31 fAbandoned = true;
32}
33
34bool GrImageContext::abandoned() const {
35 ASSERT_SINGLE_OWNER
36
37 return fAbandoned;
38}
39
Robert Phillipsa41c6852019-02-07 10:44:10 -050040///////////////////////////////////////////////////////////////////////////////////////////////////
41sk_sp<const GrCaps> GrImageContextPriv::refCaps() const {
42 return fContext->refCaps();
43}