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

Unified Diff: src/gpu/gl/GrGpuGL.cpp

Issue 304403003: Generate path names on the client side (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 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
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,

Powered by Google App Engine
This is Rietveld 408576698