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

Unified Diff: src/gpu/gl/GrGLPathRendering.h

Issue 452823002: Separate GL path rendering state from GrGpuGL to GrGLPathRendering (Closed) Base URL: https://skia.googlesource.com/skia.git@00xx-cherrypick-pathrendering-class
Patch Set: beautify Created 6 years, 4 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
Index: src/gpu/gl/GrGLPathRendering.h
diff --git a/src/gpu/gl/GrGLPathRendering.h b/src/gpu/gl/GrGLPathRendering.h
index 53b8750356bfd3caa347dba382fedca586f83b9c..f0602a70b4e2abf6026552734d2955a00e4d1e0a 100644
--- a/src/gpu/gl/GrGLPathRendering.h
+++ b/src/gpu/gl/GrGLPathRendering.h
@@ -9,9 +9,13 @@
#define GrGLPathRendering_DEFINED
#include "SkRefCnt.h"
+#include "GrPathRendering.h"
+#include "GrStencil.h"
#include "gl/GrGLFunctions.h"
+#include "gl/GrGLProgram.h"
class GrGLNameAllocator;
+class GrGpuGL;
struct GrGLInterface;
/**
@@ -21,16 +25,25 @@ struct GrGLInterface;
* a backup implementation is not practical, it marks the method as not
* supported.
*/
-class GrGLPathRendering {
+class GrGLPathRendering : public GrPathRendering {
public:
/**
* Create a new GrGLPathRendering object from a given GL interface. Unless
* otherwise specified in the caps, every method will work properly, even
* if it did not exist in the GL interface.
*/
- static GrGLPathRendering* Create(const GrGLInterface*);
+ static GrGLPathRendering* Create(GrGpuGL* gpu, const GrGLInterface*);
virtual ~GrGLPathRendering();
+ // GrPathRendering implementations.
+ virtual GrPath* createPath(const SkPath&, const SkStrokeRec&) SK_OVERRIDE;
+ virtual GrPathRange* createPathRange(size_t size, const SkStrokeRec&) SK_OVERRIDE;
+ virtual void stencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE;
+ virtual void drawPath(const GrPath*, SkPath::FillType) SK_OVERRIDE;
+ virtual void drawPaths(const GrPathRange*, const uint32_t indices[], int count,
+ const float transforms[], PathTransformType,
+ SkPath::FillType) SK_OVERRIDE;
+
/**
* Mark certain functionality as not supported if the driver version is too
* old and a backup implementation is not practical.
@@ -40,12 +53,29 @@ public:
};
const Caps& caps() const { return fCaps; }
+
+ /* Called when the 3D context state is unknown. */
+ void onResetContext();
+
/**
* Called when the GPU resources have been lost and need to be abandoned
* (for example after a context loss).
*/
void abandonGpuResources();
+ enum PathTexGenComponents {
+ kS_PathTexGenComponents = 1,
+ kST_PathTexGenComponents = 2,
+ kSTR_PathTexGenComponents = 3
+ };
+ void enablePathTexGen(int unitIdx, PathTexGenComponents, const GrGLfloat* coefficients);
+ void enablePathTexGen(int unitIdx, PathTexGenComponents, const SkMatrix& matrix);
+ void flushPathTexGenSettings(int numUsedTexCoordSets);
+ void setProjectionMatrix(const SkMatrix& matrix,
+ const SkISize& renderTargetSize,
+ GrSurfaceOrigin renderTargetOrigin);
+
+
// NV_path_rendering
GrGLuint genPaths(GrGLsizei range);
GrGLvoid deletePaths(GrGLuint path, GrGLsizei range);
@@ -98,11 +128,25 @@ public:
const GrGLfloat *coeffs);
protected:
- GrGLPathRendering(const GrGLInterface*);
+ GrGLPathRendering(GrGpuGL* gpu, const GrGLInterface*);
+ GrGpuGL* fGpu;
SkAutoTUnref<const GrGLInterface> fGLInterface;
Chris Dalton 2014/08/14 16:22:09 We might not need a GrGLInterface ref now that we
Kimmo Kinnunen 2014/08/15 06:19:26 Done.
SkAutoTDelete<GrGLNameAllocator> fPathNameAllocator;
Caps fCaps;
+ GrGLProgram::MatrixState fHWProjectionMatrixState;
+ GrStencilSettings fHWPathStencilSettings;
+ struct PathTexGenData {
+ GrGLenum fMode;
+ GrGLint fNumComponents;
+ GrGLfloat fCoefficients[3 * 3];
+ };
+ int fHWActivePathTexGenSets;
+ SkTArray<PathTexGenData, true> fHWPathTexGenSettings;
+
+private:
+ void flushPathStencilSettings(SkPath::FillType fill);
+
};
#endif

Powered by Google App Engine
This is Rietveld 408576698