• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef GrImageContextPriv_DEFINED
9 #define GrImageContextPriv_DEFINED
10 
11 #include "GrImageContext.h"
12 
13 /** Class that exposes methods on GrImageContext that are only intended for use internal to Skia.
14     This class is purely a privileged window into GrImageContext. It should never have
15     additional data members or virtual methods. */
16 class GrImageContextPriv {
17 public:
18     // from GrContext_Base
contextID()19     uint32_t contextID() const { return fContext->contextID(); }
20 
21     // from GrImageContext
22 
23 private:
GrImageContextPriv(GrImageContext * context)24     explicit GrImageContextPriv(GrImageContext* context) : fContext(context) {}
25     GrImageContextPriv(const GrImageContextPriv&); // unimpl
26     GrImageContextPriv& operator=(const GrImageContextPriv&); // unimpl
27 
28     // No taking addresses of this type.
29     const GrImageContextPriv* operator&() const;
30     GrImageContextPriv* operator&();
31 
32     GrImageContext* fContext;
33 
34     friend class GrImageContext; // to construct/copy this type.
35 };
36 
priv()37 inline GrImageContextPriv GrImageContext::priv() { return GrImageContextPriv(this); }
38 
priv()39 inline const GrImageContextPriv GrImageContext::priv () const {
40     return GrImageContextPriv(const_cast<GrImageContext*>(this));
41 }
42 
43 #endif
44