From dd3101752c76d4f66a856609042c96596b470a6b Mon Sep 17 00:00:00 2001 From: Ioannis Tsakpinis Date: Sun, 16 Jul 2023 21:16:24 +0300 Subject: [PATCH] fix(nuklear) font_atlas_bake result auto-sizing Close #903 --- doc/notes/3.3.3.md | 1 + .../nuklear/src/generated/java/org/lwjgl/nuklear/Nuklear.java | 4 ++-- .../nuklear/src/templates/kotlin/nuklear/templates/nuklear.kt | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/notes/3.3.3.md b/doc/notes/3.3.3.md index 70d2df9b93..ccd03925ff 100644 --- a/doc/notes/3.3.3.md +++ b/doc/notes/3.3.3.md @@ -20,6 +20,7 @@ This build includes the following changes: #### Fixes - CUDA: Fixed library name on Linux. (#884) +- Nuklear: Fixed the result auto-sizing of `nk_font_atlas_bake`. (#903) - OpenGL: Added support for [libglvnd](https://github.com/NVIDIA/libglvnd). (#880) * LWJGL will now try to load `libGLX.so.0` before `libGL.so.1` on Linux, matching GLFW. * Use `Configuration.OPENGL_LIBRARY_NAME` and `GLFWNativeGLX::setPath` to override this behavior. diff --git a/modules/lwjgl/nuklear/src/generated/java/org/lwjgl/nuklear/Nuklear.java b/modules/lwjgl/nuklear/src/generated/java/org/lwjgl/nuklear/Nuklear.java index ac55738c0e..d846479640 100644 --- a/modules/lwjgl/nuklear/src/generated/java/org/lwjgl/nuklear/Nuklear.java +++ b/modules/lwjgl/nuklear/src/generated/java/org/lwjgl/nuklear/Nuklear.java @@ -9847,7 +9847,7 @@ public static ByteBuffer nk_font_atlas_bake(@NativeType("struct nk_font_atlas *" check(height, 1); } long __result = nnk_font_atlas_bake(atlas.address(), memAddress(width), memAddress(height), fmt); - return memByteBufferSafe(__result, width.get(width.position()) * height.get(height.position())); + return memByteBufferSafe(__result, width.get(width.position()) * height.get(height.position()) * (fmt == NK_FONT_ATLAS_RGBA32 ? 4 : 1)); } // --- [ nk_font_atlas_end ] --- @@ -10886,7 +10886,7 @@ public static ByteBuffer nk_font_atlas_bake(@NativeType("struct nk_font_atlas *" check(height, 1); } long __result = nnk_font_atlas_bake(atlas.address(), width, height, fmt); - return memByteBufferSafe(__result, width[0] * height[0]); + return memByteBufferSafe(__result, width[0] * height[0] * (fmt == NK_FONT_ATLAS_RGBA32 ? 4 : 1)); } } \ No newline at end of file diff --git a/modules/lwjgl/nuklear/src/templates/kotlin/nuklear/templates/nuklear.kt b/modules/lwjgl/nuklear/src/templates/kotlin/nuklear/templates/nuklear.kt index 3c328eb536..aa02ba138a 100644 --- a/modules/lwjgl/nuklear/src/templates/kotlin/nuklear/templates/nuklear.kt +++ b/modules/lwjgl/nuklear/src/templates/kotlin/nuklear/templates/nuklear.kt @@ -5148,7 +5148,7 @@ nk_style_pop_vec2(ctx);""")} nk_font_atlas.p("atlas", ""), AutoSizeResult..Check(1)..int.p("width", ""), AutoSizeResult..Check(1)..int.p("height", ""), - nk_font_atlas_format("fmt", "") + AutoSizeResult("(fmt == NK_FONT_ATLAS_RGBA32 ? 4 : 1)")..nk_font_atlas_format("fmt", "") ) void(