From 6d7701a7c3a855cdbfd3cf3f8e61bc2d5425be3a Mon Sep 17 00:00:00 2001 From: JeremyStarTM Date: Wed, 16 Oct 2024 13:21:54 +0200 Subject: [PATCH] Update GlfwWindow#setIcons logging --- .../glfw/implementation/GlfwWindow.java | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/windowing/glfw/src/main/java/de/staropensource/engine/windowing/glfw/implementation/GlfwWindow.java b/windowing/glfw/src/main/java/de/staropensource/engine/windowing/glfw/implementation/GlfwWindow.java index 75a37b59..45f3907d 100644 --- a/windowing/glfw/src/main/java/de/staropensource/engine/windowing/glfw/implementation/GlfwWindow.java +++ b/windowing/glfw/src/main/java/de/staropensource/engine/windowing/glfw/implementation/GlfwWindow.java @@ -357,8 +357,6 @@ public final class GlfwWindow extends Window { @ApiStatus.Experimental @Override public void setIcons(@NotNull Path @Nullable [] icons) { - getLogger().warn("GlfwWindow#setIcons is experimental and may cause engine or JVM crashes. Here be dragons!"); - // Ensure the window is not terminated if (isTerminated()) return; @@ -366,7 +364,8 @@ public final class GlfwWindow extends Window { this.icons = icons; if (icons != null) try (GLFWImage.Buffer iconsBuffer = GLFWImage.malloc(icons.length)) { - getLogger().diag("GlfwWindow#setIcons » icons.length = " + icons.length); + getLogger().warn("GlfwWindow#setIcons is experimental and may cause engine or JVM crashes. Here be dragons!"); + getLogger().diag("icons.length = " + icons.length); List iconBuffers = new ArrayList<>(); IntBuffer width = MemoryUtil.memAllocInt(1); @@ -374,9 +373,9 @@ public final class GlfwWindow extends Window { IntBuffer channels = MemoryUtil.memAllocInt(1); for (Path filepath : icons) { - getLogger().diag("GlfwWindow#setIcons » iterating icons » " + iconBuffers.size() + " » " + filepath); + getLogger().diag("iterating icons » " + iconBuffers.size() + " » " + filepath); // Load icon - getLogger().diag("GlfwWindow#setIcons » loading icon"); + getLogger().diag("loading icon"); iconBuffers.add(STBImage.stbi_load(filepath.toAbsolutePath().toString(), width, height, channels, 4)); if (iconBuffers.getLast() == null) { @@ -385,33 +384,31 @@ public final class GlfwWindow extends Window { } // Save into 'iconsBuffer' - getLogger().diag("GlfwWindow#setIcons » saving into buffer"); + getLogger().diag("saving into buffer"); iconsBuffer .position(iconsBuffer.position() + 1) .width(width.get(0)) .height(height.get(0)) .pixels(iconBuffers.getLast()); } - getLogger().diag("GlfwWindow#setIcons » out of iteration"); + getLogger().diag("out of iteration"); // Set icons - getLogger().diag("GlfwWindow#setIcons » setting position"); + getLogger().diag("setting position"); iconsBuffer.position(0); - getLogger().diag("GlfwWindow#setIcons » setting icons"); + getLogger().diag("setting icons"); Logger.flushLogMessages(); glfwSetWindowIcon(identifierLong, iconsBuffer); // Free icons - getLogger().diag("GlfwWindow#setIcons » freeing icons"); + getLogger().diag("freeing icons"); for (ByteBuffer buffer : iconBuffers) if (buffer != null) { - getLogger().diag("GlfwWindow#setIcons » freeing buffer"); + getLogger().diag("freeing buffer"); STBImage.stbi_image_free(buffer); } else - getLogger().diag("GlfwWindow#setIcons » skipping null buffer"); + getLogger().diag("skipping null buffer"); } - else - getLogger().diag("GlfwWindow#setIcons » icons is null"); } /** {@inheritDoc} */