Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrImageContext.h
Go to the documentation of this file.
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
8#ifndef GrImageContext_DEFINED
9#define GrImageContext_DEFINED
10
15
18
19// This is now just a view on a ThreadSafeProxy, that SkImages can attempt to
20// downcast to a GrDirectContext as a backdoor to some operations. Once we remove the backdoors,
21// this goes away and SkImages just hold ThreadSafeProxies.
23public:
24 ~GrImageContext() override;
25
26 // Provides access to functions that aren't part of the public API.
28 const GrImageContextPriv priv() const; // NOLINT(readability-const-return-type)
29
30protected:
31 friend class GrImageContextPriv; // for hidden functions
32
34
35 SK_API virtual void abandonContext();
36 SK_API virtual bool abandoned();
37
38 /** This is only useful for debug purposes */
39 skgpu::SingleOwner* singleOwner() const { return &fSingleOwner; }
40
41 GrImageContext* asImageContext() override { return this; }
42
43private:
44 // When making promise images, we currently need a placeholder GrImageContext instance to give
45 // to the SkImage that has no real power, just a wrapper around the ThreadSafeProxy.
46 // TODO: De-power SkImage to ThreadSafeProxy or at least figure out a way to share one instance.
48
49 // In debug builds we guard against improper thread handling
50 // This guard is passed to the GrDrawingManager and, from there to all the
51 // GrSurfaceDrawContexts. It is also passed to the GrResourceProvider and SkGpuDevice.
52 // TODO: Move this down to GrRecordingContext.
53 mutable skgpu::SingleOwner fSingleOwner;
54};
55
56#endif
#define SK_API
Definition SkAPI.h:35
GrImageContextPriv priv()
skgpu::SingleOwner * singleOwner() const
~GrImageContext() override
virtual SK_API void abandonContext()
virtual SK_API bool abandoned()
GrImageContext * asImageContext() override