|
9 | 9 |
|
10 | 10 | namespace { |
11 | 11 |
|
12 | | -// Create a // Set the fields of the paint info object |
13 | | - SetJNIFieldLong(env, cls, jpaintInfo, "shared_texture_handle", |
14 | | - static_cast<jlong>(info.shared_texture_handle)); |
15 | | - SetJNIFieldInt(env, cls, jpaintInfo, "format", info.format); |
16 | | - SetJNIFieldInt(env, cls, jpaintInfo, "width", info.width); |
17 | | - SetJNIFieldInt(env, cls, jpaintInfo, "height", info.height);ava.awt.Rectangle. |
| 12 | +// Create a java.awt.Rectangle. |
18 | 13 | jobject NewJNIRect(JNIEnv* env, const CefRect& rect) { |
19 | 14 | ScopedJNIClass cls(env, "java/awt/Rectangle"); |
20 | 15 | if (!cls) |
@@ -291,17 +286,20 @@ void RenderHandler::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser, |
291 | 286 | ScopedJNIClass cls(env, "org/cef/handler/CefAcceleratedPaintInfo"); |
292 | 287 | if (!cls) |
293 | 288 | return; |
294 | | - |
295 | 289 | ScopedJNIObjectLocal jpaintInfo(env, NewJNIObject(env, cls)); |
296 | 290 | if (!jpaintInfo) |
297 | 291 | return; |
298 | 292 |
|
| 293 | + // Get view rect to determine width and height |
| 294 | + CefRect viewRect; |
| 295 | + GetViewRect(browser, viewRect); |
| 296 | + |
299 | 297 | // Set the fields of the paint info object |
300 | 298 | SetJNIFieldLong(env, cls, jpaintInfo, "shared_texture_handle", |
301 | | - static_cast<jlong>(info.shared_texture_handle)); |
| 299 | + reinterpret_cast<jlong>(info.shared_texture_handle)); |
302 | 300 | SetJNIFieldInt(env, cls, jpaintInfo, "format", info.format); |
303 | | - SetJNIFieldInt(env, cls, jpaintInfo, "width", info.width); |
304 | | - SetJNIFieldInt(env, cls, jpaintInfo, "height", info.height); |
| 301 | + SetJNIFieldInt(env, cls, jpaintInfo, "width", viewRect.width); |
| 302 | + SetJNIFieldInt(env, cls, jpaintInfo, "height", viewRect.height); |
305 | 303 |
|
306 | 304 | JNI_CALL_VOID_METHOD(env, handle_, "onAcceleratedPaint", |
307 | 305 | "(Lorg/cef/browser/CefBrowser;Z[Ljava/awt/" |
|
0 commit comments