Index: src/gpu/gl/GrGLPathRange.cpp |
diff --git a/src/gpu/gl/GrGLPathRange.cpp b/src/gpu/gl/GrGLPathRange.cpp |
index 48a073c096dae2c0904d23dd30bcea9e3c443864..12c96c6a3fbbf81658e96a082316f1300a57ac04 100644 |
--- a/src/gpu/gl/GrGLPathRange.cpp |
+++ b/src/gpu/gl/GrGLPathRange.cpp |
@@ -11,17 +11,29 @@ |
#include "GrGLPathRendering.h" |
#include "GrGpuGL.h" |
-GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, size_t size, const SkStrokeRec& stroke) |
- : INHERITED(gpu, size, stroke), |
- fBasePathID(gpu->glPathRendering()->genPaths(fSize)), |
- fNumDefinedPaths(0) { |
+GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, PathGenerator* pathGenerator, const SkStrokeRec& stroke) |
+ : INHERITED(gpu, pathGenerator, stroke), |
+ fBasePathID(gpu->glPathRendering()->genPaths(this->getNumPaths())), |
+ fGpuMemorySize(0) { |
+ this->registerWithCache(); |
+} |
+ |
+GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, |
+ GrGLuint basePathID, |
+ int numPaths, |
+ size_t gpuMemorySize, |
+ const SkStrokeRec& stroke) |
+ : INHERITED(gpu, numPaths, stroke), |
+ fBasePathID(basePathID), |
+ fGpuMemorySize(gpuMemorySize) { |
+ this->registerWithCache(); |
} |
GrGLPathRange::~GrGLPathRange() { |
this->release(); |
} |
-void GrGLPathRange::initAt(size_t index, const SkPath& skPath) { |
+void GrGLPathRange::onInitPath(int index, const SkPath& skPath) const { |
GrGpuGL* gpu = static_cast<GrGpuGL*>(this->getGpu()); |
if (NULL == gpu) { |
return; |
@@ -33,16 +45,18 @@ void GrGLPathRange::initAt(size_t index, const SkPath& skPath) { |
GR_GL_CALL_RET(gpu->glInterface(), isPath, IsPath(fBasePathID + index))); |
SkASSERT(GR_GL_FALSE == isPath); |
- GrGLPath::InitPathObject(gpu, fBasePathID + index, skPath, fStroke); |
- ++fNumDefinedPaths; |
- this->didChangeGpuMemorySize(); |
+ GrGLPath::InitPathObject(gpu, fBasePathID + index, skPath, this->getStroke()); |
+ |
+ // TODO: Use a better approximation for the individual path sizes. |
+ fGpuMemorySize += 100; |
} |
void GrGLPathRange::onRelease() { |
SkASSERT(this->getGpu()); |
if (0 != fBasePathID && !this->isWrapped()) { |
- static_cast<GrGpuGL*>(this->getGpu())->glPathRendering()->deletePaths(fBasePathID, fSize); |
+ static_cast<GrGpuGL*>(this->getGpu())->glPathRendering()->deletePaths(fBasePathID, |
+ this->getNumPaths()); |
fBasePathID = 0; |
} |