Migrate GrContextPriv & ivars to GrDirectContext
After this, GrContextPriv gets renamed and GrContext gets removed. Change-Id: I49b034e4669876becb50b93c5fe3af887481e1ba Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326158 Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com> Auto-Submit: Adlai Holler <adlai@google.com>
This commit is contained in:
parent
9a6efa6be2
commit
53cf44cfaf
@ -15,14 +15,22 @@
|
||||
// We shouldn't need this but currently Android is relying on this being include transitively.
|
||||
#include "include/core/SkUnPreMultiply.h"
|
||||
|
||||
class GrAtlasManager;
|
||||
class GrBackendSemaphore;
|
||||
class GrClientMappedBufferManager;
|
||||
class GrContextPriv;
|
||||
class GrContextThreadSafeProxy;
|
||||
struct GrD3DBackendContext;
|
||||
class GrFragmentProcessor;
|
||||
class GrGpu;
|
||||
struct GrGLInterface;
|
||||
struct GrMockOptions;
|
||||
class GrPath;
|
||||
class GrResourceCache;
|
||||
class GrSmallPathAtlasMgr;
|
||||
class GrRenderTargetContext;
|
||||
class GrResourceProvider;
|
||||
class GrStrikeCache;
|
||||
class GrSurfaceProxy;
|
||||
class GrSwizzle;
|
||||
class GrTextureProxy;
|
||||
@ -32,6 +40,7 @@ class SkImage;
|
||||
class SkString;
|
||||
class SkSurfaceCharacterization;
|
||||
class SkSurfaceProps;
|
||||
class SkTaskGroup;
|
||||
class SkTraceMemoryDump;
|
||||
|
||||
class SK_API GrDirectContext : public GrContext {
|
||||
@ -708,21 +717,45 @@ public:
|
||||
SkString dump() const;
|
||||
#endif
|
||||
|
||||
// Provides access to functions that aren't part of the public API.
|
||||
GrContextPriv priv();
|
||||
const GrContextPriv priv() const; // NOLINT(readability-const-return-type)
|
||||
|
||||
protected:
|
||||
GrDirectContext(GrBackendApi backend, const GrContextOptions& options);
|
||||
|
||||
bool init() override;
|
||||
|
||||
GrAtlasManager* onGetAtlasManager() override { return fAtlasManager.get(); }
|
||||
GrSmallPathAtlasMgr* onGetSmallPathAtlasMgr() override;
|
||||
GrAtlasManager* onGetAtlasManager() { return fAtlasManager.get(); }
|
||||
GrSmallPathAtlasMgr* onGetSmallPathAtlasMgr();
|
||||
|
||||
GrDirectContext* asDirectContext() override { return this; }
|
||||
|
||||
private:
|
||||
// fTaskGroup must appear before anything that uses it (e.g. fGpu), so that it is destroyed
|
||||
// after all of its users. Clients of fTaskGroup will generally want to ensure that they call
|
||||
// wait() on it as they are being destroyed, to avoid the possibility of pending tasks being
|
||||
// invoked after objects they depend upon have already been destroyed.
|
||||
std::unique_ptr<SkTaskGroup> fTaskGroup;
|
||||
std::unique_ptr<GrStrikeCache> fStrikeCache;
|
||||
sk_sp<GrGpu> fGpu;
|
||||
std::unique_ptr<GrResourceCache> fResourceCache;
|
||||
std::unique_ptr<GrResourceProvider> fResourceProvider;
|
||||
|
||||
bool fDidTestPMConversions;
|
||||
// true if the PM/UPM conversion succeeded; false otherwise
|
||||
bool fPMUPMConversionsRoundTrip;
|
||||
|
||||
GrContextOptions::PersistentCache* fPersistentCache;
|
||||
GrContextOptions::ShaderErrorHandler* fShaderErrorHandler;
|
||||
|
||||
std::unique_ptr<GrClientMappedBufferManager> fMappedBufferManager;
|
||||
std::unique_ptr<GrAtlasManager> fAtlasManager;
|
||||
|
||||
std::unique_ptr<GrSmallPathAtlasMgr> fSmallPathAtlasMgr;
|
||||
|
||||
friend class GrContextPriv;
|
||||
|
||||
using INHERITED = GrContext;
|
||||
};
|
||||
|
||||
|
@ -9,19 +9,8 @@
|
||||
#define GrContext_DEFINED
|
||||
|
||||
#include "include/core/SkTypes.h"
|
||||
#include "include/gpu/GrContextOptions.h"
|
||||
#include "include/gpu/GrRecordingContext.h"
|
||||
|
||||
class GrAtlasManager;
|
||||
class GrClientMappedBufferManager;
|
||||
class GrContextPriv;
|
||||
class GrGpu;
|
||||
class GrResourceCache;
|
||||
class GrResourceProvider;
|
||||
class GrSmallPathAtlasMgr;
|
||||
class GrStrikeCache;
|
||||
class SkTaskGroup;
|
||||
|
||||
/**
|
||||
* This deprecated class is being merged into GrDirectContext and removed.
|
||||
* Do not add new subclasses, new API, or attempt to instantiate one.
|
||||
@ -32,40 +21,10 @@ class SK_API GrContext : public GrRecordingContext {
|
||||
public:
|
||||
~GrContext() override;
|
||||
|
||||
// Provides access to functions that aren't part of the public API.
|
||||
GrContextPriv priv();
|
||||
const GrContextPriv priv() const; // NOLINT(readability-const-return-type)
|
||||
protected:
|
||||
GrContext(sk_sp<GrContextThreadSafeProxy>);
|
||||
|
||||
virtual GrAtlasManager* onGetAtlasManager() = 0;
|
||||
virtual GrSmallPathAtlasMgr* onGetSmallPathAtlasMgr() = 0;
|
||||
|
||||
private:
|
||||
friend class GrDirectContext; // for access to fGpu
|
||||
|
||||
// fTaskGroup must appear before anything that uses it (e.g. fGpu), so that it is destroyed
|
||||
// after all of its users. Clients of fTaskGroup will generally want to ensure that they call
|
||||
// wait() on it as they are being destroyed, to avoid the possibility of pending tasks being
|
||||
// invoked after objects they depend upon have already been destroyed.
|
||||
std::unique_ptr<SkTaskGroup> fTaskGroup;
|
||||
std::unique_ptr<GrStrikeCache> fStrikeCache;
|
||||
sk_sp<GrGpu> fGpu;
|
||||
std::unique_ptr<GrResourceCache> fResourceCache;
|
||||
std::unique_ptr<GrResourceProvider> fResourceProvider;
|
||||
|
||||
bool fDidTestPMConversions;
|
||||
// true if the PM/UPM conversion succeeded; false otherwise
|
||||
bool fPMUPMConversionsRoundTrip;
|
||||
|
||||
GrContextOptions::PersistentCache* fPersistentCache;
|
||||
GrContextOptions::ShaderErrorHandler* fShaderErrorHandler;
|
||||
|
||||
std::unique_ptr<GrClientMappedBufferManager> fMappedBufferManager;
|
||||
|
||||
// TODO: have the GrClipStackClip use renderTargetContexts and rm this friending
|
||||
friend class GrContextPriv;
|
||||
|
||||
using INHERITED = GrRecordingContext;
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,8 @@ class GrSurfaceProxy;
|
||||
class SkDeferredDisplayList;
|
||||
class SkTaskGroup;
|
||||
|
||||
/** Class that adds methods to GrContext that are only intended for use internal to Skia.
|
||||
/** TODO: Rename to GrDirectContextPriv.
|
||||
Class that adds methods to GrDirectContext that are only intended for use internal to Skia.
|
||||
This class is purely a privileged window into GrContext. It should never have additional
|
||||
data members or virtual methods. */
|
||||
class GrContextPriv {
|
||||
@ -168,7 +169,7 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
explicit GrContextPriv(GrContext* context) : fContext(context) {}
|
||||
explicit GrContextPriv(GrDirectContext* context) : fContext(context) {}
|
||||
GrContextPriv(const GrContextPriv&) = delete;
|
||||
GrContextPriv& operator=(const GrContextPriv&) = delete;
|
||||
|
||||
@ -176,15 +177,15 @@ private:
|
||||
const GrContextPriv* operator&() const;
|
||||
GrContextPriv* operator&();
|
||||
|
||||
GrContext* fContext;
|
||||
GrDirectContext* fContext;
|
||||
|
||||
friend class GrContext; // to construct/copy this type.
|
||||
friend class GrDirectContext; // to construct/copy this type.
|
||||
};
|
||||
|
||||
inline GrContextPriv GrContext::priv() { return GrContextPriv(this); }
|
||||
inline GrContextPriv GrDirectContext::priv() { return GrContextPriv(this); }
|
||||
|
||||
inline const GrContextPriv GrContext::priv() const { // NOLINT(readability-const-return-type)
|
||||
return GrContextPriv(const_cast<GrContext*>(this));
|
||||
inline const GrContextPriv GrDirectContext::priv() const { // NOLINT(readability-const-return-type)
|
||||
return GrContextPriv(const_cast<GrDirectContext*>(this));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -119,7 +119,7 @@ static SkCanvas* prepare_canvas(SkCanvas * canvas) {
|
||||
}
|
||||
|
||||
#ifdef SK_GL
|
||||
static bool setup_backend_objects(GrContext* context,
|
||||
static bool setup_backend_objects(GrDirectContext* context,
|
||||
const SkBitmap& bm,
|
||||
const DrawOptions& options) {
|
||||
if (!context) {
|
||||
|
Loading…
Reference in New Issue
Block a user