blob: e4cd3c4490184430a0f9ab1a05b921ba3f8b84ff [file] [log] [blame]
/*
* 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 GrRecordingContextPriv_DEFINED
#define GrRecordingContextPriv_DEFINED
#include "GrRecordingContext.h"
/** Class that exposes methods to GrRecordingContext that are only intended for use internal to
Skia. This class is purely a privileged window into GrRecordingContext. It should never have
additional data members or virtual methods. */
class GrRecordingContextPriv {
public:
// from GrContext_Base
uint32_t contextID() const { return fContext->contextID(); }
const GrContextOptions& options() const { return fContext->options(); }
const GrCaps* caps() const { return fContext->caps(); }
sk_sp<const GrCaps> refCaps() const { return fContext->refCaps(); }
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache(); // { return fContext->getFPFactoryCache(); }
// from GrImageContext
// from GrRecordingContext
private:
explicit GrRecordingContextPriv(GrRecordingContext* context) : fContext(context) {}
GrRecordingContextPriv(const GrRecordingContextPriv&); // unimpl
GrRecordingContextPriv& operator=(const GrRecordingContextPriv&); // unimpl
// No taking addresses of this type.
const GrRecordingContextPriv* operator&() const;
GrRecordingContextPriv* operator&();
GrRecordingContext* fContext;
friend class GrRecordingContext; // to construct/copy this type.
};
inline GrRecordingContextPriv GrRecordingContext::priv() { return GrRecordingContextPriv(this); }
inline const GrRecordingContextPriv GrRecordingContext::priv () const {
return GrRecordingContextPriv(const_cast<GrRecordingContext*>(this));
}
#endif