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
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/private/GrContext_Base.h"
|
|
|
|
#include "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
|
|
|
|
2019-08-21 19:21:09 +00:00
|
|
|
class GrImageContext : public GrContext_Base {
|
2019-01-30 18:08:28 +00:00
|
|
|
public:
|
|
|
|
~GrImageContext() override;
|
|
|
|
|
2020-01-29 13:37:01 +00:00
|
|
|
SK_API GrBackendFormat defaultBackendFormat(SkColorType ct, GrRenderable renderable) const {
|
2019-08-13 20:16:42 +00:00
|
|
|
return INHERITED::defaultBackendFormat(ct, renderable);
|
|
|
|
}
|
|
|
|
|
2019-01-30 18:08:28 +00:00
|
|
|
// 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-08-21 19:21:09 +00:00
|
|
|
SK_API virtual void abandonContext();
|
2020-04-01 17:29:59 +00:00
|
|
|
SK_API virtual bool abandoned();
|
2019-02-11 19:12:03 +00:00
|
|
|
|
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
|