Adds a GrGLPathRendering class that wraps the NV_path_rendering
extension and manages its various API versions. It also provides
backup implementations when certain NVpr methods from later API
versions are not present on the current system.
R=bsalomon@google.com, kkinnunen@nvidia.com, markkilgard@gmail.com
Author: cdalton@nvidia.com
Review URL: https://codereview.chromium.org/437473002
diff --git a/src/gpu/gl/GrGLPathRange.cpp b/src/gpu/gl/GrGLPathRange.cpp
index 2df04e3..5e89cb5 100644
--- a/src/gpu/gl/GrGLPathRange.cpp
+++ b/src/gpu/gl/GrGLPathRange.cpp
@@ -8,17 +8,13 @@
#include "GrGLPathRange.h"
#include "GrGLPath.h"
+#include "GrGLPathRendering.h"
#include "GrGpuGL.h"
-#define GPUGL static_cast<GrGpuGL*>(this->getGpu())
-
-#define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
-#define GL_CALL_RET(R, X) GR_GL_CALL_RET(GPUGL->glInterface(), R, X)
-
-GrGLPathRange::GrGLPathRange(GrGpu* gpu, size_t size, const SkStrokeRec& stroke)
+GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, size_t size, const SkStrokeRec& stroke)
: INHERITED(gpu, size, stroke),
+ fBasePathID(gpu->pathRendering()->genPaths(fSize)),
fNumDefinedPaths(0) {
- GL_CALL_RET(fBasePathID, GenPaths(fSize));
}
GrGLPathRange::~GrGLPathRange() {
@@ -31,15 +27,10 @@
return;
}
-#ifdef SK_DEBUG
// Make sure the path at this index hasn't been initted already.
- GrGLboolean hasPathAtIndex;
- GL_CALL_RET(hasPathAtIndex, IsPath(fBasePathID + index));
- SkASSERT(GR_GL_FALSE == hasPathAtIndex);
-#endif
+ SkASSERT(GR_GL_FALSE == gpu->pathRendering()->isPath(fBasePathID + index));
- GrGLPath::InitPathObject(gpu->glInterface(), fBasePathID + index, skPath, fStroke);
-
+ GrGLPath::InitPathObject(gpu, fBasePathID + index, skPath, fStroke);
++fNumDefinedPaths;
this->didChangeGpuMemorySize();
}
@@ -48,7 +39,7 @@
SkASSERT(NULL != this->getGpu());
if (0 != fBasePathID && !this->isWrapped()) {
- GL_CALL(DeletePaths(fBasePathID, fSize));
+ static_cast<GrGpuGL*>(this->getGpu())->pathRendering()->deletePaths(fBasePathID, fSize);
fBasePathID = 0;
}