Loading core/java/android/view/HardwareRenderer.java +9 −1 Original line number Diff line number Diff line Loading @@ -300,7 +300,6 @@ public abstract class HardwareRenderer { */ if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throw new RuntimeException("eglMakeCurrent failed"); } return mEglContext.getGL(); Loading Loading @@ -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; Loading libs/hwui/OpenGLRenderer.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -160,7 +160,9 @@ OpenGLRenderer::~OpenGLRenderer() { mTextureCache.clear(); mLayerCache.clear(); mGradientCache.clear(); mPathCache.clear(); mPatchCache.clear(); mProgramCache.clear(); } /////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -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); } Loading libs/hwui/Snapshot.h +17 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading Loading
core/java/android/view/HardwareRenderer.java +9 −1 Original line number Diff line number Diff line Loading @@ -300,7 +300,6 @@ public abstract class HardwareRenderer { */ if (!mEgl.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { throw new RuntimeException("eglMakeCurrent failed"); } return mEglContext.getGL(); Loading Loading @@ -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; Loading
libs/hwui/OpenGLRenderer.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -160,7 +160,9 @@ OpenGLRenderer::~OpenGLRenderer() { mTextureCache.clear(); mLayerCache.clear(); mGradientCache.clear(); mPathCache.clear(); mPatchCache.clear(); mProgramCache.clear(); } /////////////////////////////////////////////////////////////////////////////// Loading Loading @@ -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); } Loading
libs/hwui/Snapshot.h +17 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading