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 | |
John Stiles | fbd050b | 2020-08-03 13:21:46 -0400 | [diff] [blame] | 8 | #include <memory> |
| 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "include/private/GrImageContext.h" |
Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame] | 11 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "src/gpu/GrCaps.h" |
Adlai Holler | 43b1579 | 2020-06-01 10:11:49 -0400 | [diff] [blame] | 13 | #include "src/gpu/GrContextThreadSafeProxyPriv.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 14 | #include "src/gpu/GrImageContextPriv.h" |
| 15 | #include "src/gpu/GrProxyProvider.h" |
Robert Phillips | 7f11fb5 | 2019-12-03 13:35:19 -0500 | [diff] [blame] | 16 | #include "src/gpu/effects/GrSkSLFP.h" |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame] | 17 | |
Adlai Holler | e219d1c | 2020-06-02 11:23:16 -0400 | [diff] [blame] | 18 | GrImageContext::GrImageContext(sk_sp<GrContextThreadSafeProxy> proxy) |
| 19 | : INHERITED(std::move(proxy)) { |
Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | GrImageContext::~GrImageContext() {} |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame] | 23 | |
Robert Phillips | a9162df | 2019-02-11 14:12:03 -0500 | [diff] [blame] | 24 | void GrImageContext::abandonContext() { |
Adlai Holler | 43b1579 | 2020-06-01 10:11:49 -0400 | [diff] [blame] | 25 | fThreadSafeProxy->priv().abandonContext(); |
Robert Phillips | a9162df | 2019-02-11 14:12:03 -0500 | [diff] [blame] | 26 | } |
| 27 | |
Greg Daniel | 6e35a00 | 2020-04-01 13:29:59 -0400 | [diff] [blame] | 28 | bool GrImageContext::abandoned() { |
Adlai Holler | 43b1579 | 2020-06-01 10:11:49 -0400 | [diff] [blame] | 29 | return fThreadSafeProxy->priv().abandoned(); |
Robert Phillips | a9162df | 2019-02-11 14:12:03 -0500 | [diff] [blame] | 30 | } |
| 31 | |
Adlai Holler | dced31f | 2021-02-19 12:33:46 -0500 | [diff] [blame] | 32 | sk_sp<GrImageContext> GrImageContext::MakeForPromiseImage(sk_sp<GrContextThreadSafeProxy> tsp) { |
| 33 | return sk_sp<GrImageContext>(new GrImageContext(std::move(tsp))); |
| 34 | } |