Remove GrGLTexID
BUG=skia:2889 Review URL: https://codereview.chromium.org/695133003
This commit is contained in:
parent
882ee19a26
commit
bcaefb0622
@ -29,22 +29,21 @@ void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) {
|
|||||||
SkASSERT(0 != idDesc.fTextureID);
|
SkASSERT(0 != idDesc.fTextureID);
|
||||||
fTexParams.invalidate();
|
fTexParams.invalidate();
|
||||||
fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
|
fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
|
||||||
fTexIDObj.reset(SkNEW_ARGS(GrGLTexID, (GPUGL->glInterface(),
|
fTextureID = idDesc.fTextureID;
|
||||||
idDesc.fTextureID,
|
|
||||||
idDesc.fIsWrapped)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLTexture::onRelease() {
|
void GrGLTexture::onRelease() {
|
||||||
fTexIDObj.reset(NULL);
|
if (fTextureID) {
|
||||||
|
if (!this->isWrapped()) {
|
||||||
|
GL_CALL(DeleteTextures(1, &fTextureID));
|
||||||
|
}
|
||||||
|
fTextureID = 0;
|
||||||
|
}
|
||||||
INHERITED::onRelease();
|
INHERITED::onRelease();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGLTexture::onAbandon() {
|
void GrGLTexture::onAbandon() {
|
||||||
if (fTexIDObj.get()) {
|
fTextureID = 0;
|
||||||
fTexIDObj->abandon();
|
|
||||||
fTexIDObj.reset(NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
INHERITED::onAbandon();
|
INHERITED::onAbandon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,38 +13,6 @@
|
|||||||
#include "GrTexture.h"
|
#include "GrTexture.h"
|
||||||
#include "GrGLUtil.h"
|
#include "GrGLUtil.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* A ref counted tex id that deletes the texture in its destructor.
|
|
||||||
*/
|
|
||||||
class GrGLTexID : public SkRefCnt {
|
|
||||||
public:
|
|
||||||
SK_DECLARE_INST_COUNT(GrGLTexID)
|
|
||||||
|
|
||||||
GrGLTexID(const GrGLInterface* gl, GrGLuint texID, bool isWrapped)
|
|
||||||
: fGL(gl)
|
|
||||||
, fTexID(texID)
|
|
||||||
, fIsWrapped(isWrapped) {
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~GrGLTexID() {
|
|
||||||
if (0 != fTexID && !fIsWrapped) {
|
|
||||||
GR_GL_CALL(fGL, DeleteTextures(1, &fTexID));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void abandon() { fTexID = 0; }
|
|
||||||
GrGLuint id() const { return fTexID; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
const GrGLInterface* fGL;
|
|
||||||
GrGLuint fTexID;
|
|
||||||
bool fIsWrapped;
|
|
||||||
|
|
||||||
typedef SkRefCnt INHERITED;
|
|
||||||
};
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
class GrGLTexture : public GrTexture {
|
class GrGLTexture : public GrTexture {
|
||||||
|
|
||||||
@ -83,7 +51,7 @@ public:
|
|||||||
fTexParamsTimestamp = timestamp;
|
fTexParamsTimestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
GrGLuint textureID() const { return (fTexIDObj.get()) ? fTexIDObj->id() : 0; }
|
GrGLuint textureID() const { return fTextureID; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// The public constructor registers this object with the cache. However, only the most derived
|
// The public constructor registers this object with the cache. However, only the most derived
|
||||||
@ -100,7 +68,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
TexParams fTexParams;
|
TexParams fTexParams;
|
||||||
GrGpu::ResetTimestamp fTexParamsTimestamp;
|
GrGpu::ResetTimestamp fTexParamsTimestamp;
|
||||||
SkAutoTUnref<GrGLTexID> fTexIDObj;
|
GrGLuint fTextureID;
|
||||||
|
|
||||||
typedef GrTexture INHERITED;
|
typedef GrTexture INHERITED;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user