Hide GrDrawTarget::Caps's member vars
Review URL: https://codereview.appspot.com/6499044
git-svn-id: http://skia.googlecode.com/svn/trunk@5328 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 5f241a6..862ace0 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -26,20 +26,11 @@
class GrVertexBuffer;
class GrDrawTarget : public GrRefCnt {
-public:
- SK_DECLARE_INST_COUNT(GrDrawTarget)
-
- /**
- * Represents the draw target capabilities.
- */
- struct Caps {
- Caps() { memset(this, 0, sizeof(Caps)); }
- Caps(const Caps& c) { *this = c; }
- Caps& operator= (const Caps& c) {
- memcpy(this, &c, sizeof(Caps));
- return *this;
- }
- void print() const;
+protected:
+ /** This helper class allows GrDrawTarget subclasses to set the caps values without having to be
+ made a friend of GrDrawTarget::Caps. */
+ class CapsInternals {
+ public:
bool f8BitPaletteSupport : 1;
bool fNPOTTextureTileSupport : 1;
bool fTwoSidedStencilSupport : 1;
@@ -55,6 +46,41 @@
int fMaxTextureSize;
};
+public:
+ SK_DECLARE_INST_COUNT(GrDrawTarget)
+
+ /**
+ * Represents the draw target capabilities.
+ */
+ class Caps {
+ public:
+ Caps() { memset(this, 0, sizeof(Caps)); }
+ Caps(const Caps& c) { *this = c; }
+ Caps& operator= (const Caps& c) {
+ memcpy(this, &c, sizeof(Caps));
+ return *this;
+ }
+ void print() const;
+
+ bool eightBitPaletteSupport() const { return fInternals.f8BitPaletteSupport; }
+ bool npotTextureTileSupport() const { return fInternals.fNPOTTextureTileSupport; }
+ bool twoSidedStencilSupport() const { return fInternals.fTwoSidedStencilSupport; }
+ bool stencilWrapOpsSupport() const { return fInternals.fStencilWrapOpsSupport; }
+ bool hwAALineSupport() const { return fInternals.fHWAALineSupport; }
+ bool shaderDerivativeSupport() const { return fInternals.fShaderDerivativeSupport; }
+ bool geometryShaderSupport() const { return fInternals.fGeometryShaderSupport; }
+ bool fsaaSupport() const { return fInternals.fFSAASupport; }
+ bool dualSourceBlendingSupport() const { return fInternals.fDualSourceBlendingSupport; }
+ bool bufferLockSupport() const { return fInternals.fBufferLockSupport; }
+ bool pathStencilingSupport() const { return fInternals.fPathStencilingSupport; }
+
+ int maxRenderTargetSize() const { return fInternals.fMaxRenderTargetSize; }
+ int maxTextureSize() const { return fInternals.fMaxTextureSize; }
+ private:
+ CapsInternals fInternals;
+ friend GrDrawTarget; // to set values of fInternals
+ };
+
///////////////////////////////////////////////////////////////////////////
GrDrawTarget();
@@ -1013,6 +1039,9 @@
return this->getGeomSrc().fVertexLayout;
}
+ // allows derived class to set the caps
+ CapsInternals* capsInternals() { return &fCaps.fInternals; }
+
const GrClipData* fClip;
GrDrawState* fDrawState;