| Index: src/gpu/gl/GrGLPathRange.cpp
|
| diff --git a/src/gpu/gl/GrGLPathRange.cpp b/src/gpu/gl/GrGLPathRange.cpp
|
| index 48a073c096dae2c0904d23dd30bcea9e3c443864..bc1659c9c378370d27a0eb0904db7a70aae79eaf 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,
|
| + uint32_t 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(uint32_t 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;
|
| }
|
|
|
|
|