Skip to content

Commit 28ef9f3

Browse files
committed
1 parent 01c05ce commit 28ef9f3

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

native/render_handler.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@
99

1010
namespace {
1111

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.
1813
jobject NewJNIRect(JNIEnv* env, const CefRect& rect) {
1914
ScopedJNIClass cls(env, "java/awt/Rectangle");
2015
if (!cls)
@@ -291,17 +286,20 @@ void RenderHandler::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
291286
ScopedJNIClass cls(env, "org/cef/handler/CefAcceleratedPaintInfo");
292287
if (!cls)
293288
return;
294-
295289
ScopedJNIObjectLocal jpaintInfo(env, NewJNIObject(env, cls));
296290
if (!jpaintInfo)
297291
return;
298292

293+
// Get view rect to determine width and height
294+
CefRect viewRect;
295+
GetViewRect(browser, viewRect);
296+
299297
// Set the fields of the paint info object
300298
SetJNIFieldLong(env, cls, jpaintInfo, "shared_texture_handle",
301-
static_cast<jlong>(info.shared_texture_handle));
299+
reinterpret_cast<jlong>(info.shared_texture_handle));
302300
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);
305303

306304
JNI_CALL_VOID_METHOD(env, handle_, "onAcceleratedPaint",
307305
"(Lorg/cef/browser/CefBrowser;Z[Ljava/awt/"

0 commit comments

Comments
 (0)