diff options
| author | 2016-06-14 14:43:19 +0000 | |
|---|---|---|
| committer | 2016-06-14 14:43:20 +0000 | |
| commit | 5b4ff21a749dbe2e8990fc1000eb1e2694c04e4f (patch) | |
| tree | 5e2009ee1e49d4d72289ffab2659d07074ff5109 | |
| parent | 7ce75172ddb1c6535bdf3f7f7bc84f65d681e958 (diff) | |
| parent | 306f331f91a86da271ce30d4f14d6badf0d25704 (diff) | |
Merge "Redraw if dirty during stopped when resumed" into nyc-dev
| -rw-r--r-- | libs/hwui/renderthread/CanvasContext.cpp | 5 | ||||
| -rw-r--r-- | libs/hwui/renderthread/CanvasContext.h | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index e6399d4ec789..c626c5452310 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -149,6 +149,8 @@ void CanvasContext::setStopped(bool stopped) { if (mEglManager.isCurrent(mEglSurface)) { mEglManager.makeCurrent(EGL_NO_SURFACE); } + } else if (mIsDirty && hasSurface()) { + mRenderThread.postFrameCallback(this); } } } @@ -231,6 +233,8 @@ void CanvasContext::prepareTree(TreeInfo& info, int64_t* uiFrameInfo, freePrefetchedLayers(info.observer); GL_CHECKPOINT(MODERATE); + mIsDirty = true; + if (CC_UNLIKELY(!mNativeSurface.get())) { mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame); info.out.canDrawThisFrame = false; @@ -503,6 +507,7 @@ void CanvasContext::draw() { // Even if we decided to cancel the frame, from the perspective of jank // metrics the frame was swapped at this point mCurrentFrameInfo->markSwapBuffers(); + mIsDirty = false; if (drew || mEglManager.damageRequiresSwap()) { if (CC_UNLIKELY(!mEglManager.swapBuffers(frame, screenDirty))) { diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h index e739b2949cf9..a6eb7adc3568 100644 --- a/libs/hwui/renderthread/CanvasContext.h +++ b/libs/hwui/renderthread/CanvasContext.h @@ -187,7 +187,12 @@ private: EglManager& mEglManager; sp<Surface> mNativeSurface; EGLSurface mEglSurface = EGL_NO_SURFACE; + // stopped indicates the CanvasContext will reject actual redraw operations, + // and defer repaint until it is un-stopped bool mStopped = false; + // CanvasContext is dirty if it has received an update that it has not + // painted onto its surface. + bool mIsDirty = false; bool mBufferPreserved = false; SwapBehavior mSwapBehavior = kSwap_default; struct SwapHistory { |