Line data Source code
1 : /*
2 : * Copyright 2015 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 GrRenderTargetPriv_DEFINED
9 : #define GrRenderTargetPriv_DEFINED
10 :
11 : #include "GrRenderTarget.h"
12 : #include "GrGpu.h"
13 :
14 : class GrStencilSettings;
15 :
16 : /** Class that adds methods to GrRenderTarget that are only intended for use internal to Skia.
17 : This class is purely a privileged window into GrRenderTarget. It should never have additional
18 : data members or virtual methods. */
19 : class GrRenderTargetPriv {
20 : public:
21 : /**
22 : * GrStencilAttachment is not part of the public API.
23 : */
24 0 : GrStencilAttachment* getStencilAttachment() const { return fRenderTarget->fStencilAttachment; }
25 :
26 : /**
27 : * Attaches the GrStencilAttachment onto the render target. If stencil is a nullptr then the
28 : * currently attached GrStencilAttachment will be removed if one was previously attached. This
29 : * function returns false if there were any failure in attaching the GrStencilAttachment.
30 : */
31 : bool attachStencilAttachment(GrStencilAttachment* stencil);
32 :
33 : int numStencilBits() const;
34 :
35 : // Finds a render target's multisample specs. The pipeline is only needed in case the info isn't
36 : // cached and we need to flush the draw state in order to query it. The pipeline is not expected
37 : // to affect the multisample information itself.
38 : const GrGpu::MultisampleSpecs& getMultisampleSpecs(const GrPipeline&) const;
39 :
40 : typedef GrRenderTarget::Flags Flags;
41 :
42 0 : Flags flags() const { return fRenderTarget->fFlags; }
43 :
44 : private:
45 0 : explicit GrRenderTargetPriv(GrRenderTarget* renderTarget) : fRenderTarget(renderTarget) {}
46 : GrRenderTargetPriv(const GrRenderTargetPriv&) {} // unimpl
47 : GrRenderTargetPriv& operator=(const GrRenderTargetPriv&); // unimpl
48 :
49 : // No taking addresses of this type.
50 : const GrRenderTargetPriv* operator&() const;
51 : GrRenderTargetPriv* operator&();
52 :
53 : GrRenderTarget* fRenderTarget;
54 :
55 : friend class GrRenderTarget; // to construct/copy this type.
56 : };
57 :
58 0 : inline GrRenderTargetPriv GrRenderTarget::renderTargetPriv() { return GrRenderTargetPriv(this); }
59 :
60 : inline const GrRenderTargetPriv GrRenderTarget::renderTargetPriv () const {
61 : return GrRenderTargetPriv(const_cast<GrRenderTarget*>(this));
62 : }
63 :
64 : #endif
|