| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "GrGLPathRange.h" | 9 #include "GrGLPathRange.h" |
| 10 #include "GrGLPath.h" | 10 #include "GrGLPath.h" |
| 11 #include "GrGLPathRendering.h" | 11 #include "GrGLPathRendering.h" |
| 12 #include "GrGpuGL.h" | 12 #include "GrGpuGL.h" |
| 13 | 13 |
| 14 GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, size_t size, const SkStrokeRec& strok
e) | 14 GrGLPathRange::GrGLPathRange(GrGpuGL* gpu, size_t size, const SkStrokeRec& strok
e) |
| 15 : INHERITED(gpu, size, stroke), | 15 : INHERITED(gpu, size, stroke), |
| 16 fBasePathID(gpu->pathRendering()->genPaths(fSize)), | 16 fBasePathID(gpu->pathRendering()->genPaths(fSize)), |
| 17 fNumDefinedPaths(0) { | 17 fGpuMemorySize(0) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 GrGLPathRange::~GrGLPathRange() { | 20 GrGLPathRange::~GrGLPathRange() { |
| 21 this->release(); | 21 this->release(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void GrGLPathRange::initAt(size_t index, const SkPath& skPath) { | 24 void GrGLPathRange::initAt(size_t index, const SkPath& skPath) { |
| 25 GrGpuGL* gpu = static_cast<GrGpuGL*>(this->getGpu()); | 25 GrGpuGL* gpu = static_cast<GrGpuGL*>(this->getGpu()); |
| 26 if (NULL == gpu) { | 26 if (NULL == gpu) { |
| 27 return; | 27 return; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // Make sure the path at this index hasn't been initted already. | 30 // Make sure the path at this index hasn't been initted already. |
| 31 SkASSERT(GR_GL_FALSE == gpu->pathRendering()->isPath(fBasePathID + index)); | 31 SkASSERT(GR_GL_FALSE == gpu->pathRendering()->isPath(fBasePathID + index)); |
| 32 | 32 |
| 33 GrGLPath::InitPathObject(gpu, fBasePathID + index, skPath, fStroke); | 33 fGpuMemorySize += GrGLPath::InitPathObject(gpu, fBasePathID + index, skPath,
fStroke); |
| 34 ++fNumDefinedPaths; | |
| 35 this->didChangeGpuMemorySize(); | 34 this->didChangeGpuMemorySize(); |
| 36 } | 35 } |
| 37 | 36 |
| 38 void GrGLPathRange::onRelease() { | 37 void GrGLPathRange::onRelease() { |
| 39 SkASSERT(NULL != this->getGpu()); | 38 SkASSERT(NULL != this->getGpu()); |
| 40 | 39 |
| 41 if (0 != fBasePathID && !this->isWrapped()) { | 40 if (0 != fBasePathID && !this->isWrapped()) { |
| 42 static_cast<GrGpuGL*>(this->getGpu())->pathRendering()->deletePaths(fBas
ePathID, fSize); | 41 static_cast<GrGpuGL*>(this->getGpu())->pathRendering()->deletePaths(fBas
ePathID, fSize); |
| 43 fBasePathID = 0; | 42 fBasePathID = 0; |
| 44 } | 43 } |
| 45 | 44 |
| 46 INHERITED::onRelease(); | 45 INHERITED::onRelease(); |
| 47 } | 46 } |
| 48 | 47 |
| 49 void GrGLPathRange::onAbandon() { | 48 void GrGLPathRange::onAbandon() { |
| 50 fBasePathID = 0; | 49 fBasePathID = 0; |
| 51 | 50 |
| 52 INHERITED::onAbandon(); | 51 INHERITED::onAbandon(); |
| 53 } | 52 } |
| OLD | NEW |