Skip to content
This repository was archived by the owner on Jun 19, 2024. It is now read-only.

Commit 0e49ba8

Browse files
authored
Merge pull request #52 from LabyMod/develop
0.4.4 - Add missing device scale method
2 parents 7f872ae + 479f18c commit 0e49ba8

File tree

6 files changed

+20
-2
lines changed

6 files changed

+20
-2
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.4.3
1+
0.4.4

ultralight-java-base/src/main/java/com/labymedia/ultralight/UltralightView.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,12 @@ public native void resize(@NativeType("uint32_t") @Unsigned long width, @NativeT
321321
*/
322322
public native boolean needsPaint();
323323

324+
/**
325+
* Sets the viewport scale factor.
326+
* @param deviceScale the scale factor to set
327+
*/
328+
public native void setDeviceScale(double deviceScale);
329+
324330
/**
325331
* Get the inspector for this View, this is useful for debugging and inspecting pages locally. This will only
326332
* succeed if you have the inspector assets in your filesystem-- the inspector will look for

ultralight-java-native/src/main/c/include/ultralight_java/java_bridges/ultralight_view_jni.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ namespace ultralight_java {
295295
*/
296296
static void set_needs_paint(JNIEnv *env, jobject instance, jboolean needs_paint);
297297

298+
static void set_device_scale(JNIEnv *env, jobject instance, jdouble device_scale);
299+
298300
/**
299301
* Checks if this view needs a repaint
300302
*

ultralight-java-native/src/main/c/include/ultralight_java/ultralight_java_instance.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ namespace ultralight_java {
207207
/**
208208
* Native methods that should be bound
209209
*/
210-
std::array<JNINativeMethod, 31> native_methods;
210+
std::array<JNINativeMethod, 32> native_methods;
211211
} ultralight_view;
212212

213213
struct {

ultralight-java-native/src/main/c/src/java_bridges/ultralight_view_jni.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,15 @@ namespace ultralight_java {
371371
view->set_needs_paint(needs_paint);
372372
}
373373

374+
void UltralightViewJNI::set_device_scale(JNIEnv *env, jobject instance, jdouble device_scale) {
375+
auto view = UltralightRefPtrJNI::unwrap_ref_ptr<ultralight::View>(env, instance);
376+
if(env->ExceptionCheck()) {
377+
return;
378+
}
379+
380+
view->set_device_scale(device_scale);
381+
}
382+
374383
jboolean UltralightViewJNI::needs_paint(JNIEnv *env, jobject instance) {
375384
auto view = UltralightRefPtrJNI::unwrap_ref_ptr<ultralight::View>(env, instance);
376385
if(env->ExceptionCheck()) {

ultralight-java-native/src/main/c/src/ultralight_initializer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ namespace ultralight_java {
155155
"(Lcom/labymedia/ultralight/plugin/loading/UltralightLoadListener;)V",
156156
UltralightViewJNI::set_load_listener),
157157
NATIVE_METHOD("setNeedsPaint", "(Z)V", UltralightViewJNI::set_needs_paint),
158+
NATIVE_METHOD("setDeviceScale", "(D)V", UltralightViewJNI::set_device_scale),
158159
NATIVE_METHOD("needsPaint", "()Z", UltralightViewJNI::needs_paint),
159160
NATIVE_METHOD("inspector", "()Lcom/labymedia/ultralight/UltralightView;", UltralightViewJNI::inspector),
160161
NATIVE_METHOD(

0 commit comments

Comments
 (0)