diff options
author | Romain Guy <romainguy@google.com> | 2010-08-11 19:38:40 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-08-11 19:38:40 -0700 |
commit | 831cffa572a9228e95528c4a1f6ada7f45f5d2fb (patch) | |
tree | 5db84708f3fd6ed7b8f0bb92f9153425da6806bc | |
parent | 949dbf7629eacfa02f267ade4643c98aef8e42a9 (diff) | |
parent | 959c91f7f7b4f921d341264f5b4ef54e702a0df0 (diff) | |
download | frameworks_base-831cffa572a9228e95528c4a1f6ada7f45f5d2fb.zip frameworks_base-831cffa572a9228e95528c4a1f6ada7f45f5d2fb.tar.gz frameworks_base-831cffa572a9228e95528c4a1f6ada7f45f5d2fb.tar.bz2 |
Merge "Bunch of fixes."
-rw-r--r-- | core/java/android/view/HardwareRenderer.java | 10 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 12 | ||||
-rw-r--r-- | libs/hwui/Snapshot.h | 21 |
3 files changed, 36 insertions, 7 deletions
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index cd6b820..44bd6d4 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -300,7 +300,6 @@ public abstract class HardwareRenderer { */ if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throw new RuntimeException("eglMakeCurrent failed"); - } return mEglContext.getGL(); @@ -374,6 +373,15 @@ public abstract class HardwareRenderer { attachInfo.mIgnoreDirtyState = true; view.mPrivateFlags |= View.DRAWN; + // TODO: Don't check the current context when we have one per UI thread + // TODO: Use a threadlocal flag to know whether the surface has changed + if (mEgl.eglGetCurrentContext() != mEglContext || + mEgl.eglGetCurrentSurface(EGL10.EGL_DRAW) != mEglSurface) { + if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { + throw new RuntimeException("eglMakeCurrent failed"); + } + } + onPreDraw(); Canvas canvas = mCanvas; diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index aaf7564..3c1fe2a 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -160,7 +160,9 @@ OpenGLRenderer::~OpenGLRenderer() { mTextureCache.clear(); mLayerCache.clear(); mGradientCache.clear(); + mPathCache.clear(); mPatchCache.clear(); + mProgramCache.clear(); } /////////////////////////////////////////////////////////////////////////////// @@ -410,8 +412,14 @@ const Rect& OpenGLRenderer::getClipBounds() { } bool OpenGLRenderer::quickReject(float left, float top, float right, float bottom) { - Rect r(left, top, right, bottom); - mSnapshot->transform.mapRect(r); + SkRect sr; + sr.set(left, top, right, bottom); + + SkMatrix m; + mSnapshot->transform.copyTo(m); + m.mapRect(&sr); + + Rect r(sr.fLeft, sr.fTop, sr.fRight, sr.fBottom); return !mSnapshot->clipRect.intersects(r); } diff --git a/libs/hwui/Snapshot.h b/libs/hwui/Snapshot.h index 399ae68..342e5b1 100644 --- a/libs/hwui/Snapshot.h +++ b/libs/hwui/Snapshot.h @@ -96,9 +96,14 @@ public: bool clip(float left, float top, float right, float bottom, SkRegion::Op op) { bool clipped = false; - Rect r(left, top, right, bottom); - transform.mapRect(r); + SkRect sr; + sr.set(left, top, right, bottom); + SkMatrix m; + transform.copyTo(m); + m.mapRect(&sr); + + Rect r(sr.fLeft, sr.fTop, sr.fRight, sr.fBottom); switch (op) { case SkRegion::kDifference_Op: break; @@ -137,8 +142,16 @@ public: if (flags & Snapshot::kFlagDirtyLocalClip) { mat4 inverse; inverse.loadInverse(transform); - localClip.set(clipRect); - inverse.mapRect(localClip); + + SkRect sr; + sr.set(clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); + + SkMatrix m; + inverse.copyTo(m); + m.mapRect(&sr); + + localClip.set(sr.fLeft, sr.fTop, sr.fRight, sr.fBottom); + flags &= ~Snapshot::kFlagDirtyLocalClip; } return localClip; |