Chromium Code Reviews| Index: tools/viewer/sk_app/Window.cpp |
| diff --git a/tools/viewer/sk_app/Window.cpp b/tools/viewer/sk_app/Window.cpp |
| index 0a7bcf8a70b75c0f5d61a4dfdb2b36408275e13d..bf4117bac80bab5e25cf641b11bfb594d7cd265b 100644 |
| --- a/tools/viewer/sk_app/Window.cpp |
| +++ b/tools/viewer/sk_app/Window.cpp |
| @@ -63,6 +63,8 @@ bool Window::onTouch(int owner, InputState state, float x, float y) { |
| } |
| void Window::onPaint() { |
| + SkAutoMutexAcquire ama(fMutex); |
|
jvanverth1
2016/05/23 14:22:32
How long does the mutex take? On single-threaded s
|
| + fIsContentInvalidated = false; |
|
djsollen
2016/05/23 14:44:26
putting this here won't work on Android as the inv
liyuqian
2016/05/23 14:58:24
Good catch! Revised.
|
| sk_sp<SkSurface> backbuffer = fWindowContext->getBackbufferSurface(); |
| if (backbuffer) { |
| // draw into the canvas of this surface |
| @@ -92,4 +94,12 @@ void Window::setDisplayParams(const DisplayParams& params) { |
| fWindowContext->setDisplayParams(params); |
| } |
| +void Window::checkAndInval() { |
| + SkAutoMutexAcquire ama(fMutex); |
| + if (!fIsContentInvalidated) { |
| + fIsContentInvalidated = true; |
| + inval(); |
| + } |
| +} |
| + |
| } // namespace sk_app |