diff options
Diffstat (limited to 'gpu/include')
-rw-r--r-- | gpu/include/GrContext.h | 27 | ||||
-rw-r--r-- | gpu/include/GrContext_impl.h | 8 | ||||
-rw-r--r-- | gpu/include/GrDrawTarget.h | 50 | ||||
-rw-r--r-- | gpu/include/GrGpu.h | 12 | ||||
-rw-r--r-- | gpu/include/GrInOrderDrawBuffer.h | 6 | ||||
-rw-r--r-- | gpu/include/GrPaint.h | 10 | ||||
-rw-r--r-- | gpu/include/GrTextContext.h | 1 | ||||
-rw-r--r-- | gpu/include/GrTypes.h | 41 |
8 files changed, 82 insertions, 73 deletions
diff --git a/gpu/include/GrContext.h b/gpu/include/GrContext.h index 93c012c33b..9df7105451 100644 --- a/gpu/include/GrContext.h +++ b/gpu/include/GrContext.h @@ -27,6 +27,7 @@ class GrPathIter; class GrVertexBufferAllocPool;
class GrIndexBufferAllocPool;
class GrInOrderDrawBuffer;
+class GrPathRenderer;
class GrContext : public GrRefCnt {
public:
@@ -277,19 +278,6 @@ public: const GrMatrix* srcMatrix = NULL);
/**
- * Path filling rules
- */
- enum PathFills {
- kWinding_PathFill,
- kEvenOdd_PathFill,
- kInverseWinding_PathFill,
- kInverseEvenOdd_PathFill,
- kHairLine_PathFill,
-
- kPathFillCount
- };
-
- /**
* Tessellates and draws a path.
*
* @param paint describes how to color pixels.
@@ -300,7 +288,7 @@ public: */
void drawPath(const GrPaint& paint,
GrPathIter* path,
- PathFills fill,
+ GrPathFill fill,
const GrPoint* translate = NULL);
/**
* Draws vertices with a paint.
@@ -319,7 +307,7 @@ public: * number of indices.
*/
void drawVertices(const GrPaint& paint,
- GrDrawTarget::PrimitiveType primitiveType,
+ GrPrimitiveType primitiveType,
int vertexCount,
const GrPoint positions[],
const GrPoint texs[],
@@ -358,7 +346,7 @@ public: typename COL_SRC,
typename IDX_SRC>
void drawCustomVertices(const GrPaint& paint,
- GrDrawTarget::PrimitiveType primitiveType,
+ GrPrimitiveType primitiveType,
const POS_SRC& posSrc,
const TEX_SRC* texCoordSrc,
const COL_SRC* colorSrc,
@@ -369,16 +357,16 @@ public: */
template <typename POS_SRC>
void drawCustomVertices(const GrPaint& paint,
- GrDrawTarget::PrimitiveType primitiveType,
+ GrPrimitiveType primitiveType,
const POS_SRC& posSrc);
template <typename POS_SRC, typename TEX_SRC>
void drawCustomVertices(const GrPaint& paint,
- GrDrawTarget::PrimitiveType primitiveType,
+ GrPrimitiveType primitiveType,
const POS_SRC& posSrc,
const TEX_SRC* texCoordSrc);
template <typename POS_SRC, typename TEX_SRC, typename COL_SRC>
void drawCustomVertices(const GrPaint& paint,
- GrDrawTarget::PrimitiveType primitiveType,
+ GrPrimitiveType primitiveType,
const POS_SRC& posSrc,
const TEX_SRC* texCoordSrc,
const COL_SRC* colorSrc);
@@ -466,6 +454,7 @@ private: GrGpu* fGpu;
GrTextureCache* fTextureCache;
GrFontCache* fFontCache;
+ GrPathRenderer* fPathRenderer;
GrVertexBufferAllocPool* fDrawBufferVBAllocPool;
GrIndexBufferAllocPool* fDrawBufferIBAllocPool;
diff --git a/gpu/include/GrContext_impl.h b/gpu/include/GrContext_impl.h index 8af38e667a..c0a2107a87 100644 --- a/gpu/include/GrContext_impl.h +++ b/gpu/include/GrContext_impl.h @@ -20,7 +20,7 @@ template <typename POS_SRC, typename TEX_SRC,
typename COL_SRC, typename IDX_SRC>
inline void GrContext::drawCustomVertices(const GrPaint& paint,
- GrDrawTarget::PrimitiveType primitiveType,
+ GrPrimitiveType primitiveType,
const POS_SRC& posSrc,
const TEX_SRC* texCoordSrc,
const COL_SRC* colorSrc,
@@ -101,7 +101,7 @@ public: template <typename POS_SRC>
inline void GrContext::drawCustomVertices(const GrPaint& paint,
- GrDrawTarget::PrimitiveType primitiveType,
+ GrPrimitiveType primitiveType,
const POS_SRC& posSrc) {
this->drawCustomVertices<POS_SRC,
GrNullTexCoordSource,
@@ -112,7 +112,7 @@ inline void GrContext::drawCustomVertices(const GrPaint& paint, template <typename POS_SRC, typename TEX_SRC>
inline void GrContext::drawCustomVertices(const GrPaint& paint,
- GrDrawTarget::PrimitiveType primitiveType,
+ GrPrimitiveType primitiveType,
const POS_SRC& posSrc,
const TEX_SRC* texCoordSrc) {
this->drawCustomVertices<POS_SRC, TEX_SRC,
@@ -123,7 +123,7 @@ inline void GrContext::drawCustomVertices(const GrPaint& paint, template <typename POS_SRC, typename TEX_SRC, typename COL_SRC>
inline void GrContext::drawCustomVertices(const GrPaint& paint,
- GrDrawTarget::PrimitiveType primitiveType,
+ GrPrimitiveType primitiveType,
const POS_SRC& posSrc,
const TEX_SRC* texCoordSrc,
const COL_SRC* colorSrc) {
diff --git a/gpu/include/GrDrawTarget.h b/gpu/include/GrDrawTarget.h index 9c78902f79..929b9ff39b 100644 --- a/gpu/include/GrDrawTarget.h +++ b/gpu/include/GrDrawTarget.h @@ -52,16 +52,10 @@ public: }; /** - * Geometric primitives used for drawing. + * Bitfield used to indicate which stages are in use. */ - enum PrimitiveType { - kTriangles_PrimitiveType, - kTriangleStrip_PrimitiveType, - kTriangleFan_PrimitiveType, - kPoints_PrimitiveType, - kLines_PrimitiveType, - kLineStrip_PrimitiveType - }; + typedef int StageBitfield; + GR_STATIC_ASSERT(sizeof(StageBitfield)*8 >= kNumStages); /** * Flags that affect rendering. Controlled using enable/disableState(). All @@ -81,22 +75,6 @@ public: }; /** - * Coeffecients for alpha-blending. - */ - enum BlendCoeff { - kZero_BlendCoeff, //<! 0 - kOne_BlendCoeff, //<! 1 - kSC_BlendCoeff, //<! src color - kISC_BlendCoeff, //<! one minus src color - kDC_BlendCoeff, //<! dst color - kIDC_BlendCoeff, //<! one minus dst color - kSA_BlendCoeff, //<! src alpha - kISA_BlendCoeff, //<! one minus src alpha - kDA_BlendCoeff, //<! dst alpha - kIDA_BlendCoeff, //<! one minus dst alpha - }; - - /** * StencilPass * * Sets the stencil state for subsequent draw calls. Used to fill paths. @@ -145,8 +123,8 @@ protected: struct DrState { uint32_t fFlagBits; - BlendCoeff fSrcBlend; - BlendCoeff fDstBlend; + GrBlendCoeff fSrcBlend; + GrBlendCoeff fDstBlend; GrTexture* fTextures[kNumStages]; GrSamplerState fSamplerStates[kNumStages]; GrRenderTarget* fRenderTarget; @@ -362,7 +340,7 @@ public: * @param srcCoef coeffecient applied to the src color. * @param dstCoef coeffecient applied to the dst color. */ - void setBlendFunc(BlendCoeff srcCoef, BlendCoeff dstCoef); + void setBlendFunc(GrBlendCoeff srcCoef, GrBlendCoeff dstCoef); /** * Used to save and restore the GrGpu's drawing state @@ -645,7 +623,7 @@ public: * is effectively trimmed to the last completely * specified primitive. */ - virtual void drawIndexed(PrimitiveType type, + virtual void drawIndexed(GrPrimitiveType type, int startVertex, int startIndex, int vertexCount, @@ -660,7 +638,7 @@ public: * to index 0 * @param vertexCount one greater than the max index. */ - virtual void drawNonIndexed(PrimitiveType type, + virtual void drawNonIndexed(GrPrimitiveType type, int startVertex, int vertexCount) = 0; @@ -674,8 +652,8 @@ public: * drawNonIndexed. * @param rect the rect to draw * @param matrix optional matrix applied to rect (before viewMatrix) - * @param stageEnableMask bitmask indicating which stages are enabled. - * Bit i indicates whether stage i is enabled. + * @param stageEnableBitfield bitmask indicating which stages are enabled. + * Bit i indicates whether stage i is enabled. * @param srcRects specifies rects for stages enabled by stageEnableMask. * if stageEnableMask bit i is 1, srcRects is not NULL, * and srcRects[i] is not NULL, then srcRects[i] will be @@ -689,7 +667,7 @@ public: */ virtual void drawRect(const GrRect& rect, const GrMatrix* matrix, - int stageEnableMask, + StageBitfield stageEnableBitfield, const GrRect* srcRects[], const GrMatrix* srcMatrices[]); @@ -699,8 +677,8 @@ public: */ void drawSimpleRect(const GrRect& rect, const GrMatrix* matrix, - int stageEnableMask) { - drawRect(rect, matrix, stageEnableMask, NULL, NULL); + StageBitfield stageEnableBitfield) { + drawRect(rect, matrix, stageEnableBitfield, NULL, NULL); } /////////////////////////////////////////////////////////////////////////// @@ -1003,7 +981,7 @@ protected: // Helpers for drawRect, protected so subclasses that override drawRect // can use them. - static GrVertexLayout GetRectVertexLayout(int stageEnableMask, + static GrVertexLayout GetRectVertexLayout(StageBitfield stageEnableBitfield, const GrRect* srcRects[]); static void SetRectVertices(const GrRect& rect, diff --git a/gpu/include/GrGpu.h b/gpu/include/GrGpu.h index cfa1509211..661708b51a 100644 --- a/gpu/include/GrGpu.h +++ b/gpu/include/GrGpu.h @@ -284,13 +284,13 @@ public: int maxTextureDimension() const { return fMaxTextureDimension; } // GrDrawTarget overrides - virtual void drawIndexed(PrimitiveType type, + virtual void drawIndexed(GrPrimitiveType type, int startVertex, int startIndex, int vertexCount, int indexCount); - virtual void drawNonIndexed(PrimitiveType type, + virtual void drawNonIndexed(GrPrimitiveType type, int startVertex, int vertexCount); @@ -351,7 +351,7 @@ protected: virtual void clipWillBeSet(const GrClip& newClip); // prepares clip flushes gpu state before a draw - bool setupClipAndFlushState(PrimitiveType type); + bool setupClipAndFlushState(GrPrimitiveType type); // defaults to false, subclass can set true to support palleted textures bool f8bitPaletteSupport; @@ -398,13 +398,13 @@ protected: void finalizeReservedIndices(); // overridden by API specific GrGpu-derived class to perform the draw call. - virtual void drawIndexedHelper(PrimitiveType type, + virtual void drawIndexedHelper(GrPrimitiveType type, uint32_t startVertex, uint32_t startIndex, uint32_t vertexCount, uint32_t indexCount) = 0; - virtual void drawNonIndexedHelper(PrimitiveType type, + virtual void drawNonIndexedHelper(GrPrimitiveType type, uint32_t vertexCount, uint32_t numVertices) = 0; @@ -421,7 +421,7 @@ protected: // deltas from previous state at draw time. This function does the // API-specific flush of the state // returns false if current state is unsupported. - virtual bool flushGraphicsState(PrimitiveType type) = 0; + virtual bool flushGraphicsState(GrPrimitiveType type) = 0; // Sets the scissor rect, or disables if rect is NULL. virtual void flushScissor(const GrIRect* rect) = 0; diff --git a/gpu/include/GrInOrderDrawBuffer.h b/gpu/include/GrInOrderDrawBuffer.h index 0dba8e3e00..d59eb96b08 100644 --- a/gpu/include/GrInOrderDrawBuffer.h +++ b/gpu/include/GrInOrderDrawBuffer.h @@ -81,12 +81,12 @@ public: void playback(GrDrawTarget* target); // overrides from GrDrawTarget - virtual void drawIndexed(PrimitiveType primitiveType, + virtual void drawIndexed(GrPrimitiveType primitiveType, int startVertex, int startIndex, int vertexCount, int indexCount); - virtual void drawNonIndexed(PrimitiveType primitiveType, + virtual void drawNonIndexed(GrPrimitiveType primitiveType, int startVertex, int vertexCount); @@ -103,7 +103,7 @@ public: private: struct Draw { - PrimitiveType fPrimitiveType; + GrPrimitiveType fPrimitiveType; int fStartVertex; int fStartIndex; int fVertexCount; diff --git a/gpu/include/GrPaint.h b/gpu/include/GrPaint.h index 770647adc4..a34cbaf445 100644 --- a/gpu/include/GrPaint.h +++ b/gpu/include/GrPaint.h @@ -18,8 +18,8 @@ #define GrPaint_DEFINED
#include "GrTexture.h"
+#include "GrColor.h"
#include "GrSamplerState.h"
-#include "GrDrawTarget.h"
/**
* The paint describes how pixels are colored when the context draws to
@@ -29,8 +29,8 @@ class GrPaint { public:
// All the paint fields are public except texture (it's ref-counted)
- GrDrawTarget::BlendCoeff fSrcBlendCoeff;
- GrDrawTarget::BlendCoeff fDstBlendCoeff;
+ GrBlendCoeff fSrcBlendCoeff;
+ GrBlendCoeff fDstBlendCoeff;
bool fAntiAlias;
bool fDither;
@@ -80,8 +80,8 @@ private: GrTexture* fTexture;
void resetBlend() {
- fSrcBlendCoeff = GrDrawTarget::kOne_BlendCoeff;
- fDstBlendCoeff = GrDrawTarget::kZero_BlendCoeff;
+ fSrcBlendCoeff = kOne_BlendCoeff;
+ fDstBlendCoeff = kZero_BlendCoeff;
}
void resetOptions() {
diff --git a/gpu/include/GrTextContext.h b/gpu/include/GrTextContext.h index 3dc9c7a29b..a5982517d2 100644 --- a/gpu/include/GrTextContext.h +++ b/gpu/include/GrTextContext.h @@ -26,6 +26,7 @@ class GrMatrix; class GrContext; class GrTextStrike; class GrFontScaler; +class GrDrawTarget; class GrTextContext { public: diff --git a/gpu/include/GrTypes.h b/gpu/include/GrTypes.h index 83112397cc..02a652a4c1 100644 --- a/gpu/include/GrTypes.h +++ b/gpu/include/GrTypes.h @@ -160,6 +160,47 @@ template <typename Dst, typename Src> Dst GrTCast(Src src) { */ typedef uint16_t GrVertexLayout; +/** + * Path filling rules + */ +enum GrPathFill { + kWinding_PathFill, + kEvenOdd_PathFill, + kInverseWinding_PathFill, + kInverseEvenOdd_PathFill, + kHairLine_PathFill, + + kPathFillCount +}; + +/** +* Geometric primitives used for drawing. +*/ +enum GrPrimitiveType { + kTriangles_PrimitiveType, + kTriangleStrip_PrimitiveType, + kTriangleFan_PrimitiveType, + kPoints_PrimitiveType, + kLines_PrimitiveType, + kLineStrip_PrimitiveType +}; + +/** + * Coeffecients for alpha-blending. + */ +enum GrBlendCoeff { + kZero_BlendCoeff, //<! 0 + kOne_BlendCoeff, //<! 1 + kSC_BlendCoeff, //<! src color + kISC_BlendCoeff, //<! one minus src color + kDC_BlendCoeff, //<! dst color + kIDC_BlendCoeff, //<! one minus dst color + kSA_BlendCoeff, //<! src alpha + kISA_BlendCoeff, //<! one minus src alpha + kDA_BlendCoeff, //<! dst alpha + kIDA_BlendCoeff, //<! one minus dst alpha +}; + /////////////////////////////////////////////////////////////////////////////// // this is included only to make it easy to use this debugging facility |