| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "surface_glue_android.h" | 8 #include "surface_glue_android.h" |
| 9 | 9 |
| 10 #include <jni.h> | 10 #include <jni.h> |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 fPThreadEnv->DeleteLocalRef(titleString); | 70 fPThreadEnv->DeleteLocalRef(titleString); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SkiaAndroidApp::paintIfNeeded() { | 73 void SkiaAndroidApp::paintIfNeeded() { |
| 74 if (fNativeWindow && fWindow) { | 74 if (fNativeWindow && fWindow) { |
| 75 fWindow->onPaint(); | 75 fWindow->onPaint(); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 void SkiaAndroidApp::postMessage(const Message& message) const { | 79 void SkiaAndroidApp::postMessage(const Message& message) const { |
| 80 SkAssertResult(write(fPipes[1], &message, sizeof(message)) == sizeof(message
)); | 80 SkDEBUGCODE(auto writeSize =) write(fPipes[1], &message, sizeof(message)); |
| 81 SkASSERT(writeSize == sizeof(message)); |
| 81 } | 82 } |
| 82 | 83 |
| 83 void SkiaAndroidApp::readMessage(Message* message) const { | 84 void SkiaAndroidApp::readMessage(Message* message) const { |
| 84 SkAssertResult(read(fPipes[0], message, sizeof(Message)) == sizeof(Message))
; | 85 SkDEBUGCODE(auto readSize =) read(fPipes[0], message, sizeof(Message)); |
| 86 SkASSERT(readSize == sizeof(Message)); |
| 85 } | 87 } |
| 86 | 88 |
| 87 void SkiaAndroidApp::inval() { | 89 void SkiaAndroidApp::inval() { |
| 88 SkAutoMutexAcquire ama(fMutex); | 90 SkAutoMutexAcquire ama(fMutex); |
| 89 if (!fIsContentInvalidated) { | 91 if (!fIsContentInvalidated) { |
| 90 postMessage(Message(kContentInvalidated)); | 92 postMessage(Message(kContentInvalidated)); |
| 91 fIsContentInvalidated = true; | 93 fIsContentInvalidated = true; |
| 92 } | 94 } |
| 93 } | 95 } |
| 94 | 96 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 auto skiaAndroidApp = (SkiaAndroidApp*)handle; | 239 auto skiaAndroidApp = (SkiaAndroidApp*)handle; |
| 238 Message message(kTouched); | 240 Message message(kTouched); |
| 239 message.fTouchOwner = owner; | 241 message.fTouchOwner = owner; |
| 240 message.fTouchState = state; | 242 message.fTouchState = state; |
| 241 message.fTouchX = x; | 243 message.fTouchX = x; |
| 242 message.fTouchY = y; | 244 message.fTouchY = y; |
| 243 skiaAndroidApp->postMessage(message); | 245 skiaAndroidApp->postMessage(message); |
| 244 } | 246 } |
| 245 | 247 |
| 246 } // namespace sk_app | 248 } // namespace sk_app |
| OLD | NEW |