summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-08-31 11:50:35 -0700
committerRomain Guy <romainguy@google.com>2010-08-31 11:50:35 -0700
commitda8532c6f48b4c10b5e2ccb9e08690341efa1616 (patch)
treee6ce7f533b4f4bb5bb9cdf60be64138d6bbb34ea /libs
parent7dff1a72146ba549d51649ad786a0e1cc8b6897c (diff)
downloadframeworks_base-da8532c6f48b4c10b5e2ccb9e08690341efa1616.zip
frameworks_base-da8532c6f48b4c10b5e2ccb9e08690341efa1616.tar.gz
frameworks_base-da8532c6f48b4c10b5e2ccb9e08690341efa1616.tar.bz2
Add hooks for hardware accelerated WebView.
Change-Id: I907cdec8a67594f87749ac46bda85f04af5a2003
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp23
-rw-r--r--libs/hwui/OpenGLRenderer.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 4ce30b0..02f5dc5 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -143,6 +143,29 @@ void OpenGLRenderer::prepare() {
mSnapshot->setClip(0.0f, 0.0f, mWidth, mHeight);
}
+void OpenGLRenderer::acquireContext() {
+ if (mCaches.currentProgram) {
+ if (mCaches.currentProgram->isInUse()) {
+ mCaches.currentProgram->remove();
+ mCaches.currentProgram = NULL;
+ }
+ }
+}
+
+void OpenGLRenderer::releaseContext() {
+ glViewport(0, 0, mSnapshot->viewport.getWidth(), mSnapshot->viewport.getHeight());
+
+ glEnable(GL_SCISSOR_TEST);
+ setScissorFromClip();
+
+ if (mCaches.blend) {
+ glEnable(GL_BLEND);
+ glBlendFunc(mCaches.lastSrcMode, mCaches.lastDstMode);
+ } else {
+ glDisable(GL_BLEND);
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// State management
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 5748d57..d0e04b2 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -58,6 +58,8 @@ public:
void setViewport(int width, int height);
void prepare();
+ void acquireContext();
+ void releaseContext();
int getSaveCount() const;
int save(int flags);