Reduce glGets for stencil bits.
Clean up GL vs Gr rect conventions for viewport and scissor.
Review URL: http://codereview.appspot.com/4185056/
git-svn-id: http://skia.googlecode.com/svn/trunk@813 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/include/GrGLTexture.h b/gpu/include/GrGLTexture.h
index 6f1b961..fc12ee0 100644
--- a/gpu/include/GrGLTexture.h
+++ b/gpu/include/GrGLTexture.h
@@ -18,36 +18,14 @@
#ifndef GrGLTexture_DEFINED
#define GrGLTexture_DEFINED
-#include "GrGLConfig.h"
-#include "GrGpu.h"
#include "GrTexture.h"
-#include "GrRect.h"
+#include "GrScalar.h"
+#include "GrGLIRect.h"
class GrGpuGL;
class GrGLTexture;
class GrGLRenderTarget : public GrRenderTarget {
-protected:
-
- struct GLRenderTargetIDs {
- GLuint fRTFBOID;
- GLuint fTexFBOID;
- GLuint fStencilRenderbufferID;
- GLuint fMSColorRenderbufferID;
- bool fOwnIDs;
- };
-
- GrGLRenderTarget(const GLRenderTargetIDs& ids,
- const GrIRect& fViewport,
- GrGLTexture* texture,
- GrGpuGL* gl);
-
- void setViewport(const GrIRect& rect) { GrAssert(rect.height() <= 0);
- fViewport = rect;}
-
- virtual uint32_t width() const { return fViewport.width(); }
- virtual uint32_t height() const { return -fViewport.height(); }
-
public:
virtual ~GrGLRenderTarget();
@@ -58,15 +36,39 @@
GLuint renderFBOID() const { return fRTFBOID; }
GLuint textureFBOID() const { return fTexFBOID; }
- const GrIRect& viewport() const { return fViewport; }
+ GLuint getStencilBits() const { return fStencilBits; }
+
+ const GrGLIRect& viewport() const { return fViewport; }
void abandon();
+protected:
+
+ struct GLRenderTargetIDs {
+ GLuint fRTFBOID;
+ GLuint fTexFBOID;
+ GLuint fStencilRenderbufferID;
+ GLuint fMSColorRenderbufferID;
+ bool fOwnIDs;
+ };
+
+ GrGLRenderTarget(const GLRenderTargetIDs& ids,
+ GLuint stencilBits,
+ const GrGLIRect& fViewport,
+ GrGLTexture* texture,
+ GrGpuGL* gl);
+
+ void setViewport(const GrGLIRect& rect) { fViewport = rect; }
+
+ virtual int width() const { return fViewport.fWidth; }
+ virtual int height() const { return fViewport.fHeight; }
+
private:
GrGpuGL* fGL;
GLuint fRTFBOID;
GLuint fTexFBOID;
GLuint fStencilRenderbufferID;
GLuint fMSColorRenderbufferID;
+ GLuint fStencilBits;
// Should this object delete IDs when it is destroyed or does someone
// else own them.
@@ -79,7 +81,7 @@
// when we switch to this rendertarget we want to set the viewport to
// only render to to content area (as opposed to the whole allocation) and
// we want the rendering to be at top left (GL has origin in bottom left)
- GrIRect fViewport;
+ GrGLIRect fViewport;
friend class GrGpuGL;
friend class GrGLTexture;
@@ -111,6 +113,7 @@
GLenum fUploadFormat;
GLenum fUploadByteCount;
GLenum fUploadType;
+ GLuint fStencilBits;
Orientation fOrientation;
};
typedef GrGLRenderTarget::GLRenderTargetIDs GLRenderTargetIDs;