summaryrefslogtreecommitdiffstats
path: root/libs/hwui/OpenGLRenderer.h
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-10-26 16:31:31 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-10-26 16:31:31 -0700
commitf887594d0e83542d8b374d294b62a1bff606478f (patch)
tree182975af6d0812d73a24c8b45b962a421b4a400d /libs/hwui/OpenGLRenderer.h
parenta8264dfe5a6f614e77b228edc71053cae7cd2153 (diff)
parent746b7401ceb86b5f2805f8c0d3b39ac739152015 (diff)
downloadframeworks_base-f887594d0e83542d8b374d294b62a1bff606478f.zip
frameworks_base-f887594d0e83542d8b374d294b62a1bff606478f.tar.gz
frameworks_base-f887594d0e83542d8b374d294b62a1bff606478f.tar.bz2
Merge "Remove unnecessary GL calls."
Diffstat (limited to 'libs/hwui/OpenGLRenderer.h')
-rw-r--r--libs/hwui/OpenGLRenderer.h39
1 files changed, 28 insertions, 11 deletions
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 07188d4..3492d2c 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -259,7 +259,8 @@ private:
bool swapSrcDst = false, bool ignoreTransform = false, GLuint vbo = 0);
/**
- * Prepares the renderer to draw the specified shadow.
+ * Prepares the renderer to draw the specified shadow. The active texture
+ * unit must be 0 and the other units must be unbound.
*
* @param texture The shadow texture
* @param x The x coordinate of the shadow
@@ -360,11 +361,18 @@ private:
inline void getAlphaAndMode(SkPaint* paint, int* alpha, SkXfermode::Mode* mode);
/**
- * Binds the specified texture to the specified texture unit.
+ * Binds the specified texture. The texture unit must have been selected
+ * prior to calling this method.
*/
- inline void bindTexture(GLuint texture, GLuint textureUnit = 0);
- inline void setTextureWrapModes(Texture* texture, GLenum wrapS, GLenum wrapT,
- GLuint textureUnit = 0);
+ inline void bindTexture(GLuint texture) {
+ glBindTexture(GL_TEXTURE_2D, texture);
+ }
+
+ /**
+ * Sets the wrap modes for the specified texture. The wrap modes are modified
+ * only when needed.
+ */
+ inline void setTextureWrapModes(Texture* texture, GLenum wrapS, GLenum wrapT);
/**
* Enable or disable blending as necessary. This function sets the appropriate
@@ -391,6 +399,18 @@ private:
*/
inline bool useProgram(Program* program);
+ /**
+ * Invoked before any drawing operation. This sets required state.
+ */
+ void setupDraw();
+
+ /**
+ * Should be invoked every time the glScissor is modified.
+ */
+ inline void dirtyClip() {
+ mDirtyClip = true;
+ }
+
// Dimensions of the drawing surface
int mWidth, mHeight;
@@ -416,9 +436,6 @@ private:
// Used to draw textured quads
TextureVertex mMeshVertices[4];
- // GL extensions
- Extensions mExtensions;
-
// Drop shadow
bool mHasShadow;
float mShadowRadius;
@@ -432,12 +449,12 @@ private:
// List of rectangles to clear due to calls to saveLayer()
Vector<Rect*> mLayers;
- // Misc
- GLint mMaxTextureSize;
-
// Indentity matrix
const mat4 mIdentity;
+ // Indicates whether the clip must be restored
+ bool mDirtyClip;
+
friend class DisplayListRenderer;
}; // class OpenGLRenderer