From b48014285402a7039d7b466b1713ab007d83c499 Mon Sep 17 00:00:00 2001 From: Wojciech Jarosz Date: Sun, 4 Feb 2024 14:22:33 +1300 Subject: [PATCH] tweaks --- cmake/CPM.cmake | 2 +- src/brush.cpp | 2 +- src/commandpalette.cpp | 10 +++++++--- src/filters/zap_gremlins.cpp | 1 + src/hdrimage.cpp | 5 ++--- src/hdrimage.h | 2 -- src/hdrimageio.cpp | 10 +--------- src/hdrviewscreen.cpp | 4 ++-- src/tool.cpp | 1 + 9 files changed, 16 insertions(+), 21 deletions(-) diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake index 6073550..04f72bc 100644 --- a/cmake/CPM.cmake +++ b/cmake/CPM.cmake @@ -1,4 +1,4 @@ -set(CPM_DOWNLOAD_VERSION 0.35.1) +set(CPM_DOWNLOAD_VERSION 0.38.6) if(CPM_SOURCE_CACHE) # Expand relative path. This is important if the provided path contains a tilde (~) diff --git a/src/brush.cpp b/src/brush.cpp index 9b88487..24ffc62 100644 --- a/src/brush.cpp +++ b/src/brush.cpp @@ -5,9 +5,9 @@ // #include "brush.h" - #include "color.h" #include "common.h" +#include "parallelfor.h" #include using namespace nanogui; diff --git a/src/commandpalette.cpp b/src/commandpalette.cpp index 2dc56c5..3fbf99c 100644 --- a/src/commandpalette.cpp +++ b/src/commandpalette.cpp @@ -3,9 +3,10 @@ // Use of this source code is governed by a BSD-style license that can // be found in the LICENSE.txt file. // -// -// The part of the Command::draw function that performs the substring highlighting logic is adapted from ImGui -// Command Palette, it's license follows. +// Outside sources: +// [1] +// The part of the Command::draw function that performs the substring highlighting logic is adapted from +// [ImGui Command Palette](https://github.com/hnOsmium0001/imgui-command-palette), it's license follows. // // The MIT License (MIT) // @@ -207,6 +208,9 @@ void Command::draw(NVGcontext *ctx) draw_shadowed_text(false, m_caption.c_str()); else { + // + // CITATION: The logic below is adapted from the ImGui Command Palette. See [1] above. + // auto text = m_caption.c_str(); int range_begin; int range_end; diff --git a/src/filters/zap_gremlins.cpp b/src/filters/zap_gremlins.cpp index ea28084..97a77c4 100644 --- a/src/filters/zap_gremlins.cpp +++ b/src/filters/zap_gremlins.cpp @@ -12,6 +12,7 @@ #include "hdrimage.h" #include "hdrviewscreen.h" #include "imagelistpanel.h" +#include "parallelfor.h" #include "xpuimage.h" #include #include diff --git a/src/hdrimage.cpp b/src/hdrimage.cpp index 1db1d9c..d0bd752 100644 --- a/src/hdrimage.cpp +++ b/src/hdrimage.cpp @@ -28,10 +28,9 @@ #define STB_IMAGE_RESIZE_IMPLEMENTATION #include "stb_image_resize.h" // for stbir_resize_float +#include "parallelfor.h" + using namespace std; -using Imath::M33f; -using Imath::V2f; -using Imath::V3f; // local functions namespace diff --git a/src/hdrimage.h b/src/hdrimage.h index 340e720..ca9eab6 100644 --- a/src/hdrimage.h +++ b/src/hdrimage.h @@ -9,9 +9,7 @@ #include "array2d.h" #include "box.h" #include "color.h" // for Color4, max, min -#include "parallelfor.h" #include "progress.h" -#include #include // for function #include #include // for set diff --git a/src/hdrimageio.cpp b/src/hdrimageio.cpp index 330bd05..5c346e9 100644 --- a/src/hdrimageio.cpp +++ b/src/hdrimageio.cpp @@ -209,17 +209,9 @@ bool HDRImage::load(const string &filename) Imath::M44f chr_M; // the conversion matrix to rec709 RGB; defaults to identity if (hasChromaticities(file.header())) { - // equality comparison for Imf::Chromaticities - auto chr_eq = [](const Imf::Chromaticities &a, const Imf::Chromaticities &b) - { - return (a.red - b.red).length2() + (a.green - b.green).length2() + (a.blue - b.blue).length2() + - (a.white - b.white).length2() < - 1e-8f; - }; - Imf::Chromaticities rec709_chr; // default rec709 (sRGB) primaries Imf::Chromaticities file_chr = Imf::chromaticities(file.header()); - if (!chr_eq(file_chr, rec709_chr)) + if (file_chr != rec709_chr) { chr_M = Imf::RGBtoXYZ(file_chr, 1) * Imf::XYZtoRGB(rec709_chr, 1); spdlog::info("Converting pixel values to Rec709/sRGB primaries and whitepoint."); diff --git a/src/hdrviewscreen.cpp b/src/hdrviewscreen.cpp index f4bc2b0..75c55e4 100644 --- a/src/hdrviewscreen.cpp +++ b/src/hdrviewscreen.cpp @@ -701,9 +701,9 @@ void HDRViewScreen::create_menubar() {{GLFW_MOD_ALT, 'H'}}); add_item({"Flip vertically", "Mirror vertically"}, FA_ARROWS_ALT_V, flip_callback(false, m_images_panel), {{GLFW_MOD_ALT, 'V'}}); - add_item({"Rotate 90° clockwise", "Turn clockwise"}, FA_REDO, rotate_callback(true, m_images_panel), + add_item({"Rotate 90° clockwise", "Rotate right", "Turn clockwise"}, FA_REDO, rotate_callback(true, m_images_panel), {{SYSTEM_COMMAND_MOD, ']'}}); - add_item({"Rotate 90° counter clockwise", "Turn counter clockwise"}, FA_UNDO, + add_item({"Rotate 90° counter clockwise", "Rotate left", "Turn counter clockwise"}, FA_UNDO, rotate_callback(false, m_images_panel), {{SYSTEM_COMMAND_MOD, '['}}); menu->popup()->add(); add_item({"Crop to selection"}, FA_CROP, crop_callback(m_images_panel), {{GLFW_MOD_ALT, 'C'}}); diff --git a/src/tool.cpp b/src/tool.cpp index c28f1b7..76b13a6 100644 --- a/src/tool.cpp +++ b/src/tool.cpp @@ -13,6 +13,7 @@ #include "hscrollpanel.h" #include "imagelistpanel.h" #include "menu.h" +#include "parallelfor.h" #include "rasterdraw.h" #include "well.h" #include