aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-21 21:09:06 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-21 21:09:06 +0000
commit7d501ab502e861f2b2367b10a701b8449241558e (patch)
tree8a21465d5107924c4ddf6754afab93ac069e3cd8 /src/gpu/gl
parent15e9d3e66e161ce23df30bc13f8a0c87d196b463 (diff)
Add GrSurface parent class above GrTexture & GrRenderTarget
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLRenderTarget.cpp33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index cce3def89a..4193519357 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -25,6 +25,23 @@ void GrGLRenderTarget::init(const Desc& desc,
GrSafeRef(fTexIDObj);
}
+namespace {
+GrTextureDesc MakeDesc(GrTextureFlags flags,
+ int width, int height,
+ GrPixelConfig config, int sampleCnt,
+ uint64_t clientCacheID) {
+ GrTextureDesc temp;
+ temp.fFlags = flags;
+ temp.fWidth = width;
+ temp.fHeight = height;
+ temp.fConfig = config;
+ temp.fSampleCnt = sampleCnt;
+ temp.fClientCacheID = clientCacheID;
+ return temp;
+}
+
+};
+
GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu,
const Desc& desc,
const GrGLIRect& viewport,
@@ -32,10 +49,10 @@ GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu,
GrGLTexture* texture)
: INHERITED(gpu,
texture,
- viewport.fWidth,
- viewport.fHeight,
- desc.fConfig,
- desc.fSampleCnt) {
+ MakeDesc(kNone_GrTextureFlags,
+ viewport.fWidth, viewport.fHeight,
+ desc.fConfig, desc.fSampleCnt,
+ kDefault_CacheID)) {
GrAssert(NULL != texID);
GrAssert(NULL != texture);
// FBO 0 can't also be a texture, right?
@@ -54,10 +71,10 @@ GrGLRenderTarget::GrGLRenderTarget(GrGpuGL* gpu,
const GrGLIRect& viewport)
: INHERITED(gpu,
NULL,
- viewport.fWidth,
- viewport.fHeight,
- desc.fConfig,
- desc.fSampleCnt) {
+ MakeDesc(kNone_GrTextureFlags,
+ viewport.fWidth, viewport.fHeight,
+ desc.fConfig, desc.fSampleCnt,
+ kDefault_CacheID)) {
this->init(desc, viewport, NULL);
}