Index: src/gpu/gl/GrGpuGL.cpp |
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp |
index ff53b9c14cdeb5e8e141899249399ed58bff55f7..c097aa0c1c9d56b1c9aa00a0ba285b741fa4ccf4 100644 |
--- a/src/gpu/gl/GrGpuGL.cpp |
+++ b/src/gpu/gl/GrGpuGL.cpp |
@@ -7,6 +7,7 @@ |
#include "GrGpuGL.h" |
+#include "GrGLNameAllocator.h" |
#include "GrGLStencilBuffer.h" |
#include "GrGLPath.h" |
#include "GrGLShaderBuilder.h" |
@@ -2379,6 +2380,38 @@ void GrGpuGL::notifyTextureDelete(GrGLTexture* texture) { |
} |
} |
+ |
+GrGLuint GrGpuGL::createGLPathObject() { |
+ if (NULL == fPathNameAllocator.get()) { |
+ static const int range = 65536; |
+ GrGLuint names; |
+ GL_CALL_RET(names, GenPaths(range)); |
+ fPathNameAllocator.reset(SkNEW_ARGS(GrGLNameAllocator, (names, range))); |
+ } |
+ |
+ GrGLuint name = fPathNameAllocator->allocateName(); |
+ if (0 == name) { |
+ GL_CALL_RET(name, GenPaths(1)); |
+ } |
+ |
+ return name; |
+} |
+ |
+void GrGpuGL::deleteGLPathObject(GrGLuint name) { |
+ SkASSERT(fPathNameAllocator.get()); |
+ if (name < fPathNameAllocator->names() |
+ || name >= fPathNameAllocator->names() + fPathNameAllocator->range()) { |
+ // If we aren't inside fPathNameAllocator's range then this name was |
+ // generated by the GenPaths fallback. |
+ GL_CALL(DeletePaths(name, 1)); |
+ return; |
+ } |
+ |
+ // Make the path empty to save memory, but don't free the name in the driver. |
+ GL_CALL(PathCommands(name, 0, NULL, 0, GR_GL_FLOAT, NULL)); |
+ fPathNameAllocator->freeName(name); |
+} |
+ |
bool GrGpuGL::configToGLFormats(GrPixelConfig config, |
bool getSizedInternalFormat, |
GrGLenum* internalFormat, |