Flutter Engine
The Flutter Engine
GrSurfaceProxyPriv.h
Go to the documentation of this file.
1/*
2 * Copyright 2017 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 GrSurfaceProxyPriv_DEFINED
9#define GrSurfaceProxyPriv_DEFINED
10
12
14
16
17/** Class that adds methods to GrSurfaceProxy that are only intended for use internal to Skia.
18 This class is purely a privileged window into GrSurfaceProxy. It should never have additional
19 data members or virtual methods. */
21public:
22 void computeScratchKey(const GrCaps& caps, skgpu::ScratchKey* key) const {
23 return fProxy->computeScratchKey(caps, key);
24 }
25
26 // Create a GrSurface-derived class that meets the requirements (i.e, desc, renderability)
27 // of the GrSurfaceProxy.
29 return fProxy->createSurface(resourceProvider);
30 }
31
32 // Assign this proxy the provided GrSurface as its backing surface
33 void assign(sk_sp<GrSurface> surface) { fProxy->assign(std::move(surface)); }
34
35 // Don't abuse this call!!!!!!!
36 bool isExact() const { return SkBackingFit::kExact == fProxy->fFit; }
37
38 // Don't. Just don't.
39 void exactify();
40
41 void setLazyDimensions(SkISize dimensions) { fProxy->setLazyDimensions(dimensions); }
42
44
45 void setIsDDLTarget() { fProxy->fIsDDLTarget = true; }
46
47 void setIsPromiseProxy() { fProxy->fIsPromiseProxy = true; }
48
49private:
50 explicit GrSurfaceProxyPriv(GrSurfaceProxy* proxy) : fProxy(proxy) {}
51 GrSurfaceProxyPriv& operator=(const GrSurfaceProxyPriv&) = delete;
52
53 // No taking addresses of this type.
54 const GrSurfaceProxyPriv* operator&() const;
55 GrSurfaceProxyPriv* operator&();
56
57 GrSurfaceProxy* fProxy;
58
59 friend class GrSurfaceProxy; // to construct/copy this type.
60};
61
63
64inline const GrSurfaceProxyPriv GrSurfaceProxy::priv () const { // NOLINT(readability-const-return-type)
65 return GrSurfaceProxyPriv(const_cast<GrSurfaceProxy*>(this));
66}
67
68#endif
Definition: GrCaps.h:57
void computeScratchKey(const GrCaps &caps, skgpu::ScratchKey *key) const
bool doLazyInstantiation(GrResourceProvider *)
void setLazyDimensions(SkISize dimensions)
sk_sp< GrSurface > createSurface(GrResourceProvider *resourceProvider) const
void assign(sk_sp< GrSurface > surface)
GrSurfaceProxyPriv priv()
void computeScratchKey(const GrCaps &, skgpu::ScratchKey *) const
virtual sk_sp< GrSurface > createSurface(GrResourceProvider *) const =0
friend class GrSurfaceProxyPriv
void setLazyDimensions(SkISize dimensions)
void assign(sk_sp< GrSurface > surface)
VkSurfaceKHR surface
Definition: main.cc:49
Definition: SkSize.h:16