inkscape/inkscape-poppler-c++20.patch

77 lines
3.6 KiB
Diff

Index: inkscape-1.3.2_2023-11-25_091e20ef0f/CMakeLists.txt
===================================================================
--- inkscape-1.3.2_2023-11-25_091e20ef0f.orig/CMakeLists.txt
+++ inkscape-1.3.2_2023-11-25_091e20ef0f/CMakeLists.txt
@@ -18,9 +18,9 @@ message("Binary Dir: ${CMAKE_CURRENT_BIN
# -----------------------------------------------------------------------------
# CMake Configuration
# -----------------------------------------------------------------------------
-set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
-# set(CMAKE_CXX_EXTENSIONS OFF) # enforces -std=c++17 instead of -std=gnu++17
+# set(CMAKE_CXX_EXTENSIONS OFF) # enforces -std=c++20 instead of -std=gnu++20
# TODO: build currently fails with it as we actually depend on GNU compiler extensions...
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeScripts/Modules")
Index: inkscape-1.3.2_2023-11-25_091e20ef0f/_clang-format
===================================================================
--- inkscape-1.3.2_2023-11-25_091e20ef0f.orig/_clang-format
+++ inkscape-1.3.2_2023-11-25_091e20ef0f/_clang-format
@@ -103,7 +103,7 @@ SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: c++17
+Standard: c++20
StatementMacros: []
TypenameMacros: []
TabWidth: 4
Index: inkscape-1.3.2_2023-11-25_091e20ef0f/src/ui/knot/knot-holder-entity.cpp
===================================================================
--- inkscape-1.3.2_2023-11-25_091e20ef0f.orig/src/ui/knot/knot-holder-entity.cpp
+++ inkscape-1.3.2_2023-11-25_091e20ef0f/src/ui/knot/knot-holder-entity.cpp
@@ -329,7 +329,7 @@ PatternKnotHolderEntityScale::knot_set(G
double scale_x = std::clamp(new_extent[X] / _cached_diagonal[X], _cached_min_scale, 1e9);
double scale_y = std::clamp(new_extent[Y] / _cached_diagonal[Y], _cached_min_scale, 1e9);
- Affine new_transform = (state & GDK_CONTROL_MASK) ? Scale(lerp(0.5, scale_x, scale_y))
+ Affine new_transform = (state & GDK_CONTROL_MASK) ? Scale((scale_x + scale_y) * 0.5)
: Scale(scale_x, scale_y);
// 2. Calculate offset to keep pattern origin aligned
Index: inkscape-1.3.2_2023-11-25_091e20ef0f/src/ui/tools/pencil-tool.cpp
===================================================================
--- inkscape-1.3.2_2023-11-25_091e20ef0f.orig/src/ui/tools/pencil-tool.cpp
+++ inkscape-1.3.2_2023-11-25_091e20ef0f/src/ui/tools/pencil-tool.cpp
@@ -17,7 +17,11 @@
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
-#include <numeric> // For std::accumulate
+#include "pencil-tool.h"
+
+#include <cmath> // std::lerp
+#include <numeric> // std::accumulate
+
#include <gdk/gdkkeysyms.h>
#include <glibmm/i18n.h>
@@ -26,7 +30,6 @@
#include <2geom/sbasis-to-bezier.h>
#include <2geom/svg-path-parser.h>
-#include "pencil-tool.h"
#include "context-fns.h"
#include "desktop.h"
@@ -814,7 +817,7 @@ void PencilTool::_addFreehandPoint(Geom:
min = max;
}
double dezoomify_factor = 0.05 * 1000 / _desktop->current_zoom();
- double const pressure_shrunk = pressure * (max - min) + min; // C++20 -> use std::lerp()
+ double const pressure_shrunk = std::lerp(min, max, pressure);
double pressure_computed = std::abs(pressure_shrunk * dezoomify_factor);
double pressure_computed_scaled = std::abs(pressure_computed * _desktop->getDocument()->getDocumentScale().inverse()[Geom::X]);
if (p != this->p[this->_npoints - 1]) {