skia2/include/private/GrContext_Base.h
Mike Klein c0bd9f9fe5 rewrite includes to not need so much -Ifoo
Current strategy: everything from the top

Things to look at first are the manual changes:

   - added tools/rewrite_includes.py
   - removed -Idirectives from BUILD.gn
   - various compile.sh simplifications
   - tweak tools/embed_resources.py
   - update gn/find_headers.py to write paths from the top
   - update gn/gn_to_bp.py SkUserConfig.h layout
     so that #include "include/config/SkUserConfig.h" always
     gets the header we want.

No-Presubmit: true
Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
2019-04-24 16:27:11 +00:00

80 lines
2.4 KiB
C++

/*
* 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 GrContext_Base_DEFINED
#define GrContext_Base_DEFINED
#include "include/core/SkRefCnt.h"
#include "include/gpu/GrContextOptions.h"
#include "include/gpu/GrTypes.h"
class GrBaseContextPriv;
class GrCaps;
class GrContext;
class GrImageContext;
class GrRecordingContext;
class GrSkSLFPFactoryCache;
class SK_API GrContext_Base : public SkRefCnt {
public:
virtual ~GrContext_Base();
/*
* The 3D API backing this context
*/
GrBackendApi backend() const { return fBackend; }
// Provides access to functions that aren't part of the public API.
GrBaseContextPriv priv();
const GrBaseContextPriv priv() const;
protected:
friend class GrBaseContextPriv; // for hidden functions
GrContext_Base(GrBackendApi backend, const GrContextOptions& options, uint32_t contextID);
virtual bool init(sk_sp<const GrCaps>, sk_sp<GrSkSLFPFactoryCache>);
/**
* An identifier for this context. The id is used by all compatible contexts. For example,
* if SkImages are created on one thread using an image creation context, then fed into a
* DDL Recorder on second thread (which has a recording context) and finally replayed on
* a third thread with a direct context, then all three contexts will report the same id.
* It is an error for an image to be used with contexts that report different ids.
*/
uint32_t contextID() const { return fContextID; }
bool matches(GrContext_Base* candidate) const {
return candidate->contextID() == this->contextID();
}
/*
* The options in effect for this context
*/
const GrContextOptions& options() const { return fOptions; }
const GrCaps* caps() const;
sk_sp<const GrCaps> refCaps() const;
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache();
virtual GrImageContext* asImageContext() { return nullptr; }
virtual GrRecordingContext* asRecordingContext() { return nullptr; }
virtual GrContext* asDirectContext() { return nullptr; }
private:
const GrBackendApi fBackend;
const GrContextOptions fOptions;
const uint32_t fContextID;
sk_sp<const GrCaps> fCaps;
sk_sp<GrSkSLFPFactoryCache> fFPFactoryCache;
typedef SkRefCnt INHERITED;
};
#endif