Index: src/gpu/GrDrawTarget.h |
=================================================================== |
--- src/gpu/GrDrawTarget.h (revision 8359) |
+++ src/gpu/GrDrawTarget.h (working copy) |
@@ -30,10 +30,40 @@ |
class GrDrawTarget : public GrRefCnt { |
protected: |
- /** This helper class allows GrDrawTarget subclasses to set the caps values without having to be |
- made a friend of GrDrawTarget::Caps. */ |
- class CapsInternals { |
+ class DrawInfo; |
+ |
+public: |
+ SK_DECLARE_INST_COUNT(GrDrawTarget) |
+ |
+ /** |
+ * Represents the draw target capabilities. |
+ */ |
+ class Caps : public SkRefCnt { |
public: |
+ Caps() { this->reset(); } |
+ Caps(const Caps& c) { *this = c; } |
+ Caps& operator= (const Caps& c); |
+ |
+ virtual void reset(); |
+ virtual void print() const; |
+ |
+ bool eightBitPaletteSupport() const { return f8BitPaletteSupport; } |
+ bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; } |
+ bool twoSidedStencilSupport() const { return fTwoSidedStencilSupport; } |
+ bool stencilWrapOpsSupport() const { return fStencilWrapOpsSupport; } |
+ bool hwAALineSupport() const { return fHWAALineSupport; } |
+ bool shaderDerivativeSupport() const { return fShaderDerivativeSupport; } |
+ bool geometryShaderSupport() const { return fGeometryShaderSupport; } |
+ bool dualSourceBlendingSupport() const { return fDualSourceBlendingSupport; } |
+ bool bufferLockSupport() const { return fBufferLockSupport; } |
+ bool pathStencilingSupport() const { return fPathStencilingSupport; } |
+ |
+ int maxRenderTargetSize() const { return fMaxRenderTargetSize; } |
+ int maxTextureSize() const { return fMaxTextureSize; } |
+ // Will be 0 if MSAA is not supported |
+ int maxSampleCount() const { return fMaxSampleCount; } |
+ protected: |
+ |
bool f8BitPaletteSupport : 1; |
bool fNPOTTextureTileSupport : 1; |
bool fTwoSidedStencilSupport : 1; |
@@ -41,7 +71,6 @@ |
bool fHWAALineSupport : 1; |
bool fShaderDerivativeSupport : 1; |
bool fGeometryShaderSupport : 1; |
- bool fFSAASupport : 1; |
bool fDualSourceBlendingSupport : 1; |
bool fBufferLockSupport : 1; |
bool fPathStencilingSupport : 1; |
@@ -51,45 +80,6 @@ |
int fMaxSampleCount; |
}; |
- class DrawInfo; |
- |
-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; } |
- // Will be 0 if MSAA is not supported |
- int maxSampleCount() const { return fInternals.fMaxSampleCount; } |
- private: |
- CapsInternals fInternals; |
- friend class GrDrawTarget; // to set values of fInternals |
- }; |
- |
/////////////////////////////////////////////////////////////////////////// |
// The context may not be fully constructed and should not be used during GrDrawTarget |
@@ -100,7 +90,7 @@ |
/** |
* Gets the capabilities of the draw target. |
*/ |
- const Caps& getCaps() const { return fCaps; } |
+ const Caps* caps() const { return fCaps.get(); } |
/** |
* Sets the current clip to the region specified by clip. All draws will be |
@@ -652,9 +642,6 @@ |
GrContext* getContext() { return fContext; } |
const GrContext* getContext() const { return fContext; } |
- // allows derived class to set the caps |
- CapsInternals* capsInternals() { return &fCaps.fInternals; } |
- |
// A subclass may override this function if it wishes to be notified when the clip is changed. |
// The override should call INHERITED::clipWillBeSet(). |
virtual void clipWillBeSet(const GrClipData* clipData); |
@@ -673,7 +660,8 @@ |
return this->getGeomSrc().fVertexSize; |
} |
- Caps fCaps; |
+ // Subclass must initialize this in its constructor. |
+ SkAutoTUnref<const Caps> fCaps; |
/** |
* Used to communicate draws to subclass's onDraw function. |