Add isMultisampled() to GrRenderTarget. Cleanup MSAA vs smooth lines logic in GrGpuGL.
Skia issue: 178
Review URL: http://codereview.appspot.com/4382041/
git-svn-id: http://skia.googlecode.com/svn/trunk@1067 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrContext.h b/gpu/include/GrContext.h
index c178ed6..6759654 100644
--- a/gpu/include/GrContext.h
+++ b/gpu/include/GrContext.h
@@ -164,11 +164,14 @@
* id.
* @param stencilBits the number of stencil bits that the render
* target has.
+ * @param isMultisampled specify whether the render target is
+ * multisampled.
* @param width width of the render target.
* @param height height of the render target.
*/
GrRenderTarget* createPlatformRenderTarget(intptr_t platformRenderTarget,
int stencilBits,
+ bool isMultisampled,
int width, int height);
/**
diff --git a/gpu/include/GrGLTexture.h b/gpu/include/GrGLTexture.h
index 7924cc3..94ae7b4 100644
--- a/gpu/include/GrGLTexture.h
+++ b/gpu/include/GrGLTexture.h
@@ -64,13 +64,14 @@
GrGLuint fTexFBOID;
GrGLuint fStencilRenderbufferID;
GrGLuint fMSColorRenderbufferID;
- bool fOwnIDs;
+ bool fOwnIDs;
};
GrGLRenderTarget(GrGpuGL* gpu,
const GLRenderTargetIDs& ids,
GrGLTexID* texID,
GrGLuint stencilBits,
+ bool isMultisampled,
const GrGLIRect& fViewport,
GrGLTexture* texture);
diff --git a/gpu/include/GrGpu.h b/gpu/include/GrGpu.h
index cbe3e95..ebf28b1 100644
--- a/gpu/include/GrGpu.h
+++ b/gpu/include/GrGpu.h
@@ -188,12 +188,14 @@
* underlying 3D API. Interpretation depends on
* GrGpu subclass in use.
* @param stencilBits number of stencil bits the target has
+ * @param isMultisampled specify whether the RT is multisampled
* @param width width of the render target
* @param height height of the render target
*/
virtual GrRenderTarget* createPlatformRenderTarget(
intptr_t platformRenderTarget,
int stencilBits,
+ bool isMultisampled,
int width, int height);
/**
@@ -486,6 +488,7 @@
virtual GrRenderTarget* createPlatformRenderTargetHelper(
intptr_t platformRenderTarget,
int stencilBits,
+ bool isMultisampled,
int width, int height) = 0;
virtual GrRenderTarget* createRenderTargetFrom3DApiStateHelper() = 0;
virtual GrVertexBuffer* createVertexBufferHelper(uint32_t size,
diff --git a/gpu/include/GrTexture.h b/gpu/include/GrTexture.h
index 8f9952a..493bb8d 100644
--- a/gpu/include/GrTexture.h
+++ b/gpu/include/GrTexture.h
@@ -54,6 +54,11 @@
GrTexture* asTexture() {return fTexture;}
/**
+ * @return true if the render target is multisampled, false otherwise
+ */
+ bool isMultisampled() { return fIsMultisampled; }
+
+ /**
* Reads a rectangle of pixels from the render target.
* @param left left edge of the rectangle to read (inclusive)
* @param top top edge of the rectangle to read (inclusive)
@@ -73,12 +78,14 @@
GrTexture* texture,
int width,
int height,
- int stencilBits)
+ int stencilBits,
+ bool isMultisampled)
: INHERITED(gpu)
, fTexture(texture)
, fWidth(width)
, fHeight(height)
, fStencilBits(stencilBits)
+ , fIsMultisampled(isMultisampled)
{}
friend class GrTexture;
@@ -96,6 +103,7 @@
int fWidth;
int fHeight;
int fStencilBits;
+ bool fIsMultisampled;
private:
// GrGpu keeps a cached clip in the render target to avoid redundantly