xref: /aosp_15_r20/external/skia/src/gpu/ganesh/GrImageContext.cpp (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
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 #include "include/private/gpu/ganesh/GrImageContext.h"
8 
9 #include "include/core/SkRefCnt.h"
10 #include "include/gpu/ganesh/GrContextThreadSafeProxy.h"
11 #include "src/gpu/ganesh/GrContextThreadSafeProxyPriv.h"
12 
13 #include <utility>
14 
GrImageContext(sk_sp<GrContextThreadSafeProxy> proxy)15 GrImageContext::GrImageContext(sk_sp<GrContextThreadSafeProxy> proxy)
16             : GrContext_Base(std::move(proxy)) {
17 }
18 
~GrImageContext()19 GrImageContext::~GrImageContext() {}
20 
abandonContext()21 void GrImageContext::abandonContext() {
22     fThreadSafeProxy->priv().abandonContext();
23 }
24 
abandoned()25 bool GrImageContext::abandoned() {
26     return fThreadSafeProxy->priv().abandoned();
27 }
28 
MakeForPromiseImage(sk_sp<GrContextThreadSafeProxy> tsp)29 sk_sp<GrImageContext> GrImageContext::MakeForPromiseImage(sk_sp<GrContextThreadSafeProxy> tsp) {
30     return sk_sp<GrImageContext>(new GrImageContext(std::move(tsp)));
31 }
32