diff options
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 5edaa46..9f337ff 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -237,33 +237,43 @@ void OpenGLRenderer::resume() { glBlendEquation(GL_FUNC_ADD); } +void OpenGLRenderer::detachFunctor(Functor* functor) { + mFunctors.remove(functor); +} + +void OpenGLRenderer::attachFunctor(Functor* functor) { + mFunctors.add(functor); +} + status_t OpenGLRenderer::invokeFunctors(Rect& dirty) { status_t result = DrawGlInfo::kStatusDone; + size_t count = functors.size(); - Vector<Functor*> functors(mFunctors); - mFunctors.clear(); + if (count > 0) { + SortedVector<Functor*> functors(mFunctors); + mFunctors.clear(); - DrawGlInfo info; - info.clipLeft = 0; - info.clipTop = 0; - info.clipRight = 0; - info.clipBottom = 0; - info.isLayer = false; - info.width = 0; - info.height = 0; - memset(info.transform, 0, sizeof(float) * 16); + DrawGlInfo info; + info.clipLeft = 0; + info.clipTop = 0; + info.clipRight = 0; + info.clipBottom = 0; + info.isLayer = false; + info.width = 0; + info.height = 0; + memset(info.transform, 0, sizeof(float) * 16); - size_t count = functors.size(); - for (size_t i = 0; i < count; i++) { - Functor* f = functors.itemAt(i); - result |= (*f)(DrawGlInfo::kModeProcess, &info); + for (size_t i = 0; i < count; i++) { + Functor* f = functors.itemAt(i); + result |= (*f)(DrawGlInfo::kModeProcess, &info); - if (result != DrawGlInfo::kStatusDone) { - Rect localDirty(info.dirtyLeft, info.dirtyTop, info.dirtyRight, info.dirtyBottom); - dirty.unionWith(localDirty); + if (result != DrawGlInfo::kStatusDone) { + Rect localDirty(info.dirtyLeft, info.dirtyTop, info.dirtyRight, info.dirtyBottom); + dirty.unionWith(localDirty); - if (result & DrawGlInfo::kStatusInvoke) { - mFunctors.push(f); + if (result & DrawGlInfo::kStatusInvoke) { + mFunctors.add(f); + } } } } @@ -305,7 +315,7 @@ status_t OpenGLRenderer::callDrawGLFunction(Functor* functor, Rect& dirty) { dirty.unionWith(localDirty); if (result & DrawGlInfo::kStatusInvoke) { - mFunctors.push(functor); + mFunctors.add(functor); } } |