Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Unified Diff: src/gpu/GrPathRendering.h

Issue 1157683006: Refactor GrGpu path rendering functions to GrPathRendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase, remove include ordering Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrPathRange.h ('k') | src/gpu/GrPipeline.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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&);
};
« no previous file with comments | « src/gpu/GrPathRange.h ('k') | src/gpu/GrPipeline.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698