blob: dbbf1e66e8cf1125dd4c9d00567857bcd38b81d6 [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
John Stilesfbd050b2020-08-03 13:21:46 -04008#include <memory>
9
Mike Kleinc0bd9f92019-04-23 12:05:21 -050010#include "include/private/GrImageContext.h"
Robert Phillips4217ea72019-01-30 13:08:28 -050011
Mike Kleinc0bd9f92019-04-23 12:05:21 -050012#include "src/gpu/GrCaps.h"
Adlai Holler43b15792020-06-01 10:11:49 -040013#include "src/gpu/GrContextThreadSafeProxyPriv.h"
Mike Kleinc0bd9f92019-04-23 12:05:21 -050014#include "src/gpu/GrImageContextPriv.h"
15#include "src/gpu/GrProxyProvider.h"
Robert Phillips7f11fb52019-12-03 13:35:19 -050016#include "src/gpu/effects/GrSkSLFP.h"
Robert Phillipsa41c6852019-02-07 10:44:10 -050017
Adlai Hollere219d1c2020-06-02 11:23:16 -040018GrImageContext::GrImageContext(sk_sp<GrContextThreadSafeProxy> proxy)
19 : INHERITED(std::move(proxy)) {
Robert Phillips4217ea72019-01-30 13:08:28 -050020}
21
22GrImageContext::~GrImageContext() {}
Robert Phillipsa41c6852019-02-07 10:44:10 -050023
Robert Phillipsa9162df2019-02-11 14:12:03 -050024void GrImageContext::abandonContext() {
Adlai Holler43b15792020-06-01 10:11:49 -040025 fThreadSafeProxy->priv().abandonContext();
Robert Phillipsa9162df2019-02-11 14:12:03 -050026}
27
Greg Daniel6e35a002020-04-01 13:29:59 -040028bool GrImageContext::abandoned() {
Adlai Holler43b15792020-06-01 10:11:49 -040029 return fThreadSafeProxy->priv().abandoned();
Robert Phillipsa9162df2019-02-11 14:12:03 -050030}
31
Adlai Hollerdced31f2021-02-19 12:33:46 -050032sk_sp<GrImageContext> GrImageContext::MakeForPromiseImage(sk_sp<GrContextThreadSafeProxy> tsp) {
33 return sk_sp<GrImageContext>(new GrImageContext(std::move(tsp)));
34}