| Index: src/gpu/GrDrawTarget.h
|
| diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
|
| index 552314bca352f634879991bcfa3247c5340383b3..0581f303fd9b94db5b1d6963ca66731e6531910d 100644
|
| --- a/src/gpu/GrDrawTarget.h
|
| +++ b/src/gpu/GrDrawTarget.h
|
| @@ -31,9 +31,6 @@ class GrPathRange;
|
| class GrVertexBuffer;
|
|
|
| class GrDrawTarget : public SkRefCnt {
|
| -protected:
|
| - class DrawInfo;
|
| -
|
| public:
|
| SK_DECLARE_INST_COUNT(GrDrawTarget)
|
|
|
| @@ -482,6 +479,8 @@ public:
|
| */
|
| virtual void purgeResources() {};
|
|
|
| + class DrawInfo;
|
| +
|
| /**
|
| * For subclass internal use to invoke a call to onDraw(). See DrawInfo below.
|
| */
|
| @@ -693,6 +692,101 @@ public:
|
|
|
| virtual DrawToken getCurrentDrawToken() { return DrawToken(this, 0); }
|
|
|
| + /**
|
| + * Used to communicate draws to subclass's onDraw function.
|
| + * TODO move to its own .h file
|
| + */
|
| + class DrawInfo {
|
| + public:
|
| + DrawInfo(const DrawInfo& di) { (*this) = di; }
|
| + DrawInfo& operator =(const DrawInfo& di);
|
| +
|
| + GrPrimitiveType primitiveType() const { return fPrimitiveType; }
|
| + int startVertex() const { return fStartVertex; }
|
| + int startIndex() const { return fStartIndex; }
|
| + int vertexCount() const { return fVertexCount; }
|
| + int indexCount() const { return fIndexCount; }
|
| + int verticesPerInstance() const { return fVerticesPerInstance; }
|
| + int indicesPerInstance() const { return fIndicesPerInstance; }
|
| + int instanceCount() const { return fInstanceCount; }
|
| +
|
| + bool isIndexed() const { return fIndexCount > 0; }
|
| +#ifdef SK_DEBUG
|
| + bool isInstanced() const; // this version is longer because of asserts
|
| +#else
|
| + bool isInstanced() const { return fInstanceCount > 0; }
|
| +#endif
|
| +
|
| + // adds or remove instances
|
| + void adjustInstanceCount(int instanceOffset);
|
| + // shifts the start vertex
|
| + void adjustStartVertex(int vertexOffset);
|
| + // shifts the start index
|
| + void adjustStartIndex(int indexOffset);
|
| +
|
| + void setDevBounds(const SkRect& bounds) {
|
| + fDevBoundsStorage = bounds;
|
| + fDevBounds = &fDevBoundsStorage;
|
| + }
|
| + const SkRect* getDevBounds() const { return fDevBounds; }
|
| +
|
| + // NULL if no copy of the dst is needed for the draw.
|
| + const GrDeviceCoordTexture* getDstCopy() const {
|
| + if (fDstCopy.texture()) {
|
| + return &fDstCopy;
|
| + } else {
|
| + return NULL;
|
| + }
|
| + }
|
| +
|
| + // The state of the scissor is controlled by the clip manager, no one else should set
|
| + // Scissor state
|
| + struct ScissorState {
|
| + ScissorState() : fEnabled(false) {}
|
| + bool fEnabled;
|
| + SkIRect fRect;
|
| + };
|
| +
|
| + /**
|
| + * These methods are called by the clip manager's setupClipping function
|
| + * which (called as part of GrGpu's implementation of onDraw and
|
| + * onStencilPath member functions.) The GrGpu subclass should flush the
|
| + * stencil state to the 3D API in its implementation of flushGraphicsState.
|
| + */
|
| + void enableScissor(const SkIRect& rect) {
|
| + fScissorState.fEnabled = true;
|
| + fScissorState.fRect = rect;
|
| + }
|
| + void disableScissor() { fScissorState.fEnabled = false; }
|
| +
|
| + const ScissorState& getScissor() const { return fScissorState; }
|
| +
|
| + private:
|
| + DrawInfo() { fDevBounds = NULL; }
|
| +
|
| + friend class GrDrawTarget;
|
| + // TODO make this its own class with setters and getters
|
| + friend class GrGpu;
|
| +
|
| + GrPrimitiveType fPrimitiveType;
|
| +
|
| + int fStartVertex;
|
| + int fStartIndex;
|
| + int fVertexCount;
|
| + int fIndexCount;
|
| +
|
| + int fInstanceCount;
|
| + int fVerticesPerInstance;
|
| + int fIndicesPerInstance;
|
| +
|
| + SkRect fDevBoundsStorage;
|
| + SkRect* fDevBounds;
|
| +
|
| + GrDeviceCoordTexture fDstCopy;
|
| +
|
| + ScissorState fScissorState;
|
| + };
|
| +
|
| protected:
|
| // Extend access to GrDrawState::convertToPEndeingExec to subclasses.
|
| void convertDrawStateToPendingExec(GrDrawState* ds) {
|
| @@ -787,74 +881,6 @@ protected:
|
|
|
| const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers; }
|
|
|
| - /**
|
| - * Used to communicate draws to subclass's onDraw function.
|
| - */
|
| - class DrawInfo {
|
| - public:
|
| - DrawInfo(const DrawInfo& di) { (*this) = di; }
|
| - DrawInfo& operator =(const DrawInfo& di);
|
| -
|
| - GrPrimitiveType primitiveType() const { return fPrimitiveType; }
|
| - int startVertex() const { return fStartVertex; }
|
| - int startIndex() const { return fStartIndex; }
|
| - int vertexCount() const { return fVertexCount; }
|
| - int indexCount() const { return fIndexCount; }
|
| - int verticesPerInstance() const { return fVerticesPerInstance; }
|
| - int indicesPerInstance() const { return fIndicesPerInstance; }
|
| - int instanceCount() const { return fInstanceCount; }
|
| -
|
| - bool isIndexed() const { return fIndexCount > 0; }
|
| -#ifdef SK_DEBUG
|
| - bool isInstanced() const; // this version is longer because of asserts
|
| -#else
|
| - bool isInstanced() const { return fInstanceCount > 0; }
|
| -#endif
|
| -
|
| - // adds or remove instances
|
| - void adjustInstanceCount(int instanceOffset);
|
| - // shifts the start vertex
|
| - void adjustStartVertex(int vertexOffset);
|
| - // shifts the start index
|
| - void adjustStartIndex(int indexOffset);
|
| -
|
| - void setDevBounds(const SkRect& bounds) {
|
| - fDevBoundsStorage = bounds;
|
| - fDevBounds = &fDevBoundsStorage;
|
| - }
|
| - const SkRect* getDevBounds() const { return fDevBounds; }
|
| -
|
| - // NULL if no copy of the dst is needed for the draw.
|
| - const GrDeviceCoordTexture* getDstCopy() const {
|
| - if (fDstCopy.texture()) {
|
| - return &fDstCopy;
|
| - } else {
|
| - return NULL;
|
| - }
|
| - }
|
| -
|
| - private:
|
| - DrawInfo() { fDevBounds = NULL; }
|
| -
|
| - friend class GrDrawTarget;
|
| -
|
| - GrPrimitiveType fPrimitiveType;
|
| -
|
| - int fStartVertex;
|
| - int fStartIndex;
|
| - int fVertexCount;
|
| - int fIndexCount;
|
| -
|
| - int fInstanceCount;
|
| - int fVerticesPerInstance;
|
| - int fIndicesPerInstance;
|
| -
|
| - SkRect fDevBoundsStorage;
|
| - SkRect* fDevBounds;
|
| -
|
| - GrDeviceCoordTexture fDstCopy;
|
| - };
|
| -
|
| // Makes a copy of the dst if it is necessary for the draw. Returns false if a copy is required
|
| // but couldn't be made. Otherwise, returns true. This method needs to be protected because it
|
| // needs to be accessed by GLPrograms to setup a correct drawstate
|
|
|