Index: src/gpu/GrPathRendering.h |
diff --git a/src/gpu/GrPathRendering.h b/src/gpu/GrPathRendering.h |
index e198d694dbb94ace09182484036390b3c9507587..ea276f31798095706f7be415b30d18a90c65d5a9 100644 |
--- a/src/gpu/GrPathRendering.h |
+++ b/src/gpu/GrPathRendering.h |
@@ -9,12 +9,12 @@ |
#define GrPathRendering_DEFINED |
#include "SkPath.h" |
+#include "GrGpu.h" |
#include "GrPathRange.h" |
class SkDescriptor; |
class SkTypeface; |
class GrPath; |
-class GrGpu; |
class GrStencilSettings; |
class GrStrokeInfo; |
@@ -127,14 +127,67 @@ public: |
virtual GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, |
const GrStrokeInfo&) = 0; |
- virtual void stencilPath(const GrPath*, const GrStencilSettings&) = 0; |
- virtual void drawPath(const GrPath*, const GrStencilSettings&) = 0; |
- virtual void drawPaths(const GrPathRange*, const void* indices, PathIndexType, |
- const float transformValues[], PathTransformType, int count, |
- const GrStencilSettings&) = 0; |
+ /** None of these params are optional, pointers used just to avoid making copies. */ |
+ struct StencilPathArgs { |
+ StencilPathArgs(bool useHWAA, |
+ GrRenderTarget* renderTarget, |
+ const SkMatrix* viewMatrix, |
+ const GrScissorState* scissor, |
+ const GrStencilSettings* stencil) |
+ : fUseHWAA(useHWAA) |
+ , fRenderTarget(renderTarget) |
+ , fViewMatrix(viewMatrix) |
+ , fScissor(scissor) |
+ , fStencil(stencil) { |
+ } |
+ bool fUseHWAA; |
+ GrRenderTarget* fRenderTarget; |
+ const SkMatrix* fViewMatrix; |
+ const GrScissorState* fScissor; |
+ const GrStencilSettings* fStencil; |
+ }; |
+ |
+ void stencilPath(const StencilPathArgs& args, const GrPath* path) { |
+ fGpu->handleDirtyContext(); |
+ this->onStencilPath(args, path); |
+ } |
+ |
+ struct DrawPathArgs : public GrGpu::DrawArgs { |
+ DrawPathArgs(const GrPrimitiveProcessor* primProc, |
+ const GrPipeline* pipeline, |
+ const GrProgramDesc* desc, |
+ const GrBatchTracker* batchTracker, |
+ const GrStencilSettings* stencil) |
+ : DrawArgs(primProc, pipeline, desc, batchTracker) |
+ , fStencil(stencil) { |
+ } |
+ |
+ const GrStencilSettings* fStencil; |
+ }; |
+ |
+ void drawPath(const DrawPathArgs& args, const GrPath* path) { |
+ fGpu->handleDirtyContext(); |
+ this->onDrawPath(args, path); |
+ } |
+ |
+ void drawPaths(const DrawPathArgs& args, const GrPathRange* pathRange, const void* indices, |
+ PathIndexType indexType, const float transformValues[], |
+ PathTransformType transformType, int count) { |
+ fGpu->handleDirtyContext(); |
+ pathRange->willDrawPaths(indices, indexType, count); |
+ this->onDrawPaths(args, pathRange, indices, indexType, transformValues, transformType, |
+ count); |
+ } |
protected: |
- GrPathRendering() { } |
+ GrPathRendering(GrGpu* gpu) |
+ : fGpu(gpu) { |
+ } |
+ virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0; |
+ virtual void onDrawPath(const DrawPathArgs&, const GrPath*) = 0; |
+ virtual void onDrawPaths(const DrawPathArgs&, const GrPathRange*, const void*, PathIndexType, |
+ const float[], PathTransformType, int) = 0; |
+ GrGpu* fGpu; |
private: |
GrPathRendering& operator=(const GrPathRendering&); |
}; |