| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #ifndef GrGLTexture_DEFINED | 9 #ifndef GrGLTexture_DEFINED |
| 10 #define GrGLTexture_DEFINED | 10 #define GrGLTexture_DEFINED |
| 11 | 11 |
| 12 #include "GrGpu.h" | 12 #include "GrGpu.h" |
| 13 #include "GrGLRenderTarget.h" | 13 #include "GrGLRenderTarget.h" |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * A ref counted tex id that deletes the texture in its destructor. | 16 * A ref counted tex id that deletes the texture in its destructor. |
| 17 */ | 17 */ |
| 18 class GrGLTexID : public GrRefCnt { | 18 class GrGLTexID : public SkRefCnt { |
| 19 public: | 19 public: |
| 20 SK_DECLARE_INST_COUNT(GrGLTexID) | 20 SK_DECLARE_INST_COUNT(GrGLTexID) |
| 21 | 21 |
| 22 GrGLTexID(const GrGLInterface* gl, GrGLuint texID, bool isWrapped) | 22 GrGLTexID(const GrGLInterface* gl, GrGLuint texID, bool isWrapped) |
| 23 : fGL(gl) | 23 : fGL(gl) |
| 24 , fTexID(texID) | 24 , fTexID(texID) |
| 25 , fIsWrapped(isWrapped) { | 25 , fIsWrapped(isWrapped) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual ~GrGLTexID() { | 28 virtual ~GrGLTexID() { |
| 29 if (0 != fTexID && !fIsWrapped) { | 29 if (0 != fTexID && !fIsWrapped) { |
| 30 GR_GL_CALL(fGL, DeleteTextures(1, &fTexID)); | 30 GR_GL_CALL(fGL, DeleteTextures(1, &fTexID)); |
| 31 } | 31 } |
| 32 } | 32 } |
| 33 | 33 |
| 34 void abandon() { fTexID = 0; } | 34 void abandon() { fTexID = 0; } |
| 35 GrGLuint id() const { return fTexID; } | 35 GrGLuint id() const { return fTexID; } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 const GrGLInterface* fGL; | 38 const GrGLInterface* fGL; |
| 39 GrGLuint fTexID; | 39 GrGLuint fTexID; |
| 40 bool fIsWrapped; | 40 bool fIsWrapped; |
| 41 | 41 |
| 42 typedef GrRefCnt INHERITED; | 42 typedef SkRefCnt INHERITED; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 //////////////////////////////////////////////////////////////////////////////// | 45 //////////////////////////////////////////////////////////////////////////////// |
| 46 | 46 |
| 47 | 47 |
| 48 class GrGLTexture : public GrTexture { | 48 class GrGLTexture : public GrTexture { |
| 49 | 49 |
| 50 public: | 50 public: |
| 51 struct TexParams { | 51 struct TexParams { |
| 52 GrGLenum fMinFilter; | 52 GrGLenum fMinFilter; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 SkAutoTUnref<GrGLTexID> fTexIDObj; | 102 SkAutoTUnref<GrGLTexID> fTexIDObj; |
| 103 | 103 |
| 104 void init(GrGpuGL* gpu, | 104 void init(GrGpuGL* gpu, |
| 105 const Desc& textureDesc, | 105 const Desc& textureDesc, |
| 106 const GrGLRenderTarget::Desc* rtDesc); | 106 const GrGLRenderTarget::Desc* rtDesc); |
| 107 | 107 |
| 108 typedef GrTexture INHERITED; | 108 typedef GrTexture INHERITED; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 #endif | 111 #endif |
| OLD | NEW |