Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Unified Diff: src/gpu/gl/GrGLTexture.cpp

Issue 695813003: Add class GrGLTextureRenderTarget for GL texture/rendertarget objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: forgot to save file Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/gl/GrGLTexture.cpp
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index 8cf574ba15bb2d15bce3ce5e49d7534e4bab892c..d9db6ea2a2c652d0bab1a7c3e88c1ad39cd4086b 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -8,46 +8,30 @@
#include "GrGLTexture.h"
#include "GrGpuGL.h"
-#define GPUGL static_cast<GrGpuGL*>(getGpu())
-
+#define GPUGL static_cast<GrGpuGL*>(this->getGpu())
#define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
-void GrGLTexture::init(GrGpuGL* gpu,
- const GrSurfaceDesc& desc,
- const IDDesc& idDesc,
- const GrGLRenderTarget::IDDesc* rtIDDesc) {
+// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
+GrGLTexture::GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc)
+ : GrSurface(gpu, idDesc.fIsWrapped, desc)
+ , INHERITED(gpu, idDesc.fIsWrapped, desc) {
+ this->init(desc, idDesc);
+ this->registerWithCache();
+}
+
+GrGLTexture::GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc, Derived)
+ : GrSurface(gpu, idDesc.fIsWrapped, desc)
+ , INHERITED(gpu, idDesc.fIsWrapped, desc) {
+ this->init(desc, idDesc);
+}
+void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) {
SkASSERT(0 != idDesc.fTextureID);
-
fTexParams.invalidate();
fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
fTexIDObj.reset(SkNEW_ARGS(GrGLTexID, (GPUGL->glInterface(),
idDesc.fTextureID,
idDesc.fIsWrapped)));
-
- if (rtIDDesc) {
- GrGLIRect vp;
- vp.fLeft = 0;
- vp.fWidth = desc.fWidth;
- vp.fBottom = 0;
- vp.fHeight = desc.fHeight;
-
- fRenderTarget.reset(SkNEW_ARGS(GrGLRenderTarget, (gpu, *rtIDDesc, vp, fTexIDObj, this)));
- }
- this->registerWithCache();
-}
-
-GrGLTexture::GrGLTexture(GrGpuGL* gpu, const GrSurfaceDesc& desc, const IDDesc& idDesc)
- : INHERITED(gpu, idDesc.fIsWrapped, desc) {
- this->init(gpu, desc, idDesc, NULL);
-}
-
-GrGLTexture::GrGLTexture(GrGpuGL* gpu,
- const GrSurfaceDesc& desc,
- const IDDesc& idDesc,
- const GrGLRenderTarget::IDDesc& rtIDDesc)
- : INHERITED(gpu, idDesc.fIsWrapped, desc) {
- this->init(gpu, desc, idDesc, &rtIDDesc);
}
void GrGLTexture::onRelease() {

Powered by Google App Engine
This is Rietveld 408576698