diff options
Diffstat (limited to 'libs/hwui/renderthread')
| -rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 15 | ||||
| -rw-r--r-- | libs/hwui/renderthread/CanvasContext.h | 1 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.cpp | 12 | ||||
| -rw-r--r-- | libs/hwui/renderthread/RenderProxy.h | 1 |
4 files changed, 25 insertions, 4 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index fc3548c..5a23158 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -349,6 +349,8 @@ void CanvasContext::setSurface(EGLNativeWindowType window) { mDirtyRegionsEnabled = mGlobalContext->enableDirtyRegions(mEglSurface); mHaveNewSurface = true; makeCurrent(); + } else { + mRenderThread.removeFrameCallback(this); } } @@ -385,6 +387,10 @@ void CanvasContext::setup(int width, int height) { mCanvas->setViewport(width, height); } +void CanvasContext::setOpaque(bool opaque) { + mOpaque = opaque; +} + void CanvasContext::makeCurrent() { // TODO: Figure out why this workaround is needed, see b/13913604 // In the meantime this matches the behavior of GLRenderer, so it is not a regression @@ -468,6 +474,10 @@ void CanvasContext::draw(Rect* dirty) { // Called by choreographer to do an RT-driven animation void CanvasContext::doFrame() { + if (CC_UNLIKELY(!mCanvas || mEglSurface == EGL_NO_SURFACE)) { + return; + } + ATRACE_CALL(); TreeInfo info; @@ -486,10 +496,7 @@ void CanvasContext::invokeFunctor(Functor* functor) { requireGlContext(); mode = DrawGlInfo::kModeProcess; } - // TODO: Remove the dummy info in the future - DrawGlInfo dummyInfo; - memset(&dummyInfo, 0, sizeof(DrawGlInfo)); - (*functor)(mode, &dummyInfo); + (*functor)(mode, NULL); if (mCanvas) { mCanvas->resume(); diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index a95e27a..dcb9858 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -52,6 +52,7 @@ public: void updateSurface(EGLNativeWindowType window); void pauseSurface(EGLNativeWindowType window); void setup(int width, int height); + void setOpaque(bool opaque); void makeCurrent(); void prepareDraw(const Vector<DeferredLayerUpdater*>* layerUpdaters, TreeInfo& info); void draw(Rect* dirty); diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp index c2806fa..82a2dbc 100644 --- a/libs/hwui/renderthread/RenderProxy.cpp +++ b/libs/hwui/renderthread/RenderProxy.cpp @@ -159,6 +159,18 @@ void RenderProxy::setup(int width, int height) { post(task); } +CREATE_BRIDGE2(setOpaque, CanvasContext* context, bool opaque) { + args->context->setOpaque(args->opaque); + return NULL; +} + +void RenderProxy::setOpaque(bool opaque) { + SETUP_TASK(setOpaque); + args->context = mContext; + args->opaque = opaque; + post(task); +} + int RenderProxy::syncAndDrawFrame(nsecs_t frameTimeNanos, int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom) { mDrawFrameTask.setDirty(dirtyLeft, dirtyTop, dirtyRight, dirtyBottom); diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h index 013c3bd..4a7e70a 100644 --- a/libs/hwui/renderthread/RenderProxy.h +++ b/libs/hwui/renderthread/RenderProxy.h @@ -67,6 +67,7 @@ public: ANDROID_API void updateSurface(const sp<ANativeWindow>& window); ANDROID_API void pauseSurface(const sp<ANativeWindow>& window); ANDROID_API void setup(int width, int height); + ANDROID_API void setOpaque(bool opaque); ANDROID_API int syncAndDrawFrame(nsecs_t frameTimeNanos, int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom); ANDROID_API void destroyCanvasAndSurface(); |
