Fix pure virtual call from destructor and turn VertBench back on

git-svn-id: http://skia.googlecode.com/svn/trunk@2556 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2011-10-28 19:50:21 +00:00
parent 7b1ca8c66e
commit 4a018bb20b
5 changed files with 18 additions and 4 deletions

View File

@ -82,12 +82,11 @@ protected:
virtual void onDraw(SkCanvas* canvas) {
SkPaint paint;
this->setupPaint(&paint);
#if 0
for (int i = 0; i < N; i++) {
canvas->drawVertices(SkCanvas::kTriangles_VertexMode, PTS,
fPts, NULL, fColors, NULL, fIdx, IDX, paint);
}
#endif
}
private:
typedef SkBenchmark INHERITED;

View File

@ -430,13 +430,20 @@ GrDrawTarget::GrDrawTarget() {
}
GrDrawTarget::~GrDrawTarget() {
GrAssert(1 == fGeoSrcStateStack.count());
GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
GrAssert(kNone_GeometrySrcType == geoSrc.fIndexSrc);
GrAssert(kNone_GeometrySrcType == geoSrc.fVertexSrc);
}
void GrDrawTarget::releaseGeometry() {
int popCnt = fGeoSrcStateStack.count() - 1;
while (popCnt) {
this->popGeometrySource();
--popCnt;
}
this->releasePreviousVertexSource();
this->releasePreviousIndexSource();
this->resetVertexSource();
this->resetIndexSource();
}
void GrDrawTarget::setClip(const GrClip& clip) {

View File

@ -1366,6 +1366,10 @@ protected:
Caps fCaps;
// subclasses must call this in their destructors to ensure all vertex
// and index sources have been released (including those held by
// pushGeometrySource())
void releaseGeometry();
private:
// called when setting a new vert/idx source to unref prev vb/ib
void releasePreviousVertexSource();

View File

@ -309,6 +309,8 @@ GrGpuGL::GrGpuGL(const GrGLInterface* gl, GrGLBinding glBinding) {
}
GrGpuGL::~GrGpuGL() {
// This must be called by before the GrDrawTarget destructor
this->releaseGeometry();
// This subclass must do this before the base class destructor runs
// since we will unref the GrGLInterface.
this->releaseResources();

View File

@ -44,6 +44,8 @@ GrInOrderDrawBuffer::GrInOrderDrawBuffer(const GrGpu* gpu,
GrInOrderDrawBuffer::~GrInOrderDrawBuffer() {
this->reset();
// This must be called by before the GrDrawTarget destructor
this->releaseGeometry();
GrSafeUnref(fQuadIndexBuffer);
}