2019-01-30 18:08:28 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2019 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef GrImageContext_DEFINED
|
|
|
|
#define GrImageContext_DEFINED
|
|
|
|
|
|
|
|
#include "GrContext_Base.h"
|
2019-02-07 15:44:10 +00:00
|
|
|
#include "../private/GrSingleOwner.h"
|
2019-01-30 18:08:28 +00:00
|
|
|
|
|
|
|
class GrImageContextPriv;
|
2019-02-07 15:44:10 +00:00
|
|
|
class GrProxyProvider;
|
2019-01-30 18:08:28 +00:00
|
|
|
|
|
|
|
class SK_API GrImageContext : public GrContext_Base {
|
|
|
|
public:
|
|
|
|
~GrImageContext() override;
|
|
|
|
|
|
|
|
// Provides access to functions that aren't part of the public API.
|
|
|
|
GrImageContextPriv priv();
|
|
|
|
const GrImageContextPriv priv() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
friend class GrImageContextPriv; // for hidden functions
|
|
|
|
|
2019-02-07 15:44:10 +00:00
|
|
|
GrImageContext(GrBackendApi, const GrContextOptions&, uint32_t contextID);
|
|
|
|
|
2019-02-11 19:12:03 +00:00
|
|
|
virtual void abandonContext();
|
|
|
|
bool abandoned() const;
|
|
|
|
|
2019-02-07 15:44:10 +00:00
|
|
|
GrProxyProvider* proxyProvider() { return fProxyProvider.get(); }
|
|
|
|
const GrProxyProvider* proxyProvider() const { return fProxyProvider.get(); }
|
|
|
|
|
|
|
|
/** This is only useful for debug purposes */
|
|
|
|
GrSingleOwner* singleOwner() const { return &fSingleOwner; }
|
2019-01-30 18:08:28 +00:00
|
|
|
|
|
|
|
GrImageContext* asImageContext() override { return this; }
|
|
|
|
|
|
|
|
private:
|
2019-02-07 15:44:10 +00:00
|
|
|
std::unique_ptr<GrProxyProvider> fProxyProvider;
|
2019-02-11 19:12:03 +00:00
|
|
|
bool fAbandoned = false;
|
2019-02-07 15:44:10 +00:00
|
|
|
|
|
|
|
// In debug builds we guard against improper thread handling
|
|
|
|
// This guard is passed to the GrDrawingManager and, from there to all the
|
|
|
|
// GrRenderTargetContexts. It is also passed to the GrResourceProvider and SkGpuDevice.
|
2019-02-11 19:12:03 +00:00
|
|
|
mutable GrSingleOwner fSingleOwner;
|
2019-02-07 15:44:10 +00:00
|
|
|
|
2019-01-30 18:08:28 +00:00
|
|
|
typedef GrContext_Base INHERITED;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|