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 | |
| 8 | #ifndef GrImageContext_DEFINED |
| 9 | #define GrImageContext_DEFINED |
| 10 | |
| 11 | #include "GrContext_Base.h" |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame^] | 12 | #include "../private/GrSingleOwner.h" |
Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame] | 13 | |
| 14 | class GrImageContextPriv; |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame^] | 15 | class GrProxyProvider; |
Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame] | 16 | |
| 17 | class SK_API GrImageContext : public GrContext_Base { |
| 18 | public: |
| 19 | ~GrImageContext() override; |
| 20 | |
| 21 | // Provides access to functions that aren't part of the public API. |
| 22 | GrImageContextPriv priv(); |
| 23 | const GrImageContextPriv priv() const; |
| 24 | |
| 25 | protected: |
| 26 | friend class GrImageContextPriv; // for hidden functions |
| 27 | |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame^] | 28 | GrImageContext(GrBackendApi, const GrContextOptions&, uint32_t contextID); |
| 29 | |
| 30 | GrProxyProvider* proxyProvider() { return fProxyProvider.get(); } |
| 31 | const GrProxyProvider* proxyProvider() const { return fProxyProvider.get(); } |
| 32 | |
| 33 | /** This is only useful for debug purposes */ |
| 34 | GrSingleOwner* singleOwner() const { return &fSingleOwner; } |
Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame] | 35 | |
| 36 | GrImageContext* asImageContext() override { return this; } |
| 37 | |
| 38 | private: |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame^] | 39 | std::unique_ptr<GrProxyProvider> fProxyProvider; |
| 40 | |
| 41 | // In debug builds we guard against improper thread handling |
| 42 | // This guard is passed to the GrDrawingManager and, from there to all the |
| 43 | // GrRenderTargetContexts. It is also passed to the GrResourceProvider and SkGpuDevice. |
| 44 | mutable GrSingleOwner fSingleOwner; |
| 45 | |
Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame] | 46 | typedef GrContext_Base INHERITED; |
| 47 | }; |
| 48 | |
| 49 | #endif |