File: unbreak-API-compatibility.patch

package info (click to toggle)
lcms2 2.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,632 kB
  • sloc: ansic: 46,202; sh: 4,263; pascal: 1,960; makefile: 197; cpp: 84
file content (35 lines) | stat: -rw-r--r-- 1,254 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: keep API compatibility for 2.16
 Version 2.16 removed cmsGetToneCurveParams() from the public API without
 changing the SONAME. This patch reintroduces the function to keep API
 compatibility.
Author: Thomas Weber <tweber@debian.org>
Bug: https://github.com/mm2/Little-CMS/issues/429
Forwarded: not-needed
Last-Update: 2023-12-25

--- a/include/lcms2.h
+++ b/include/lcms2.h
@@ -1241,7 +1241,7 @@
 CMSAPI cmsBool           CMSEXPORT cmsIsToneCurveDescending(const cmsToneCurve* t);
 CMSAPI cmsInt32Number    CMSEXPORT cmsGetToneCurveParametricType(const cmsToneCurve* t);
 CMSAPI cmsFloat64Number  CMSEXPORT cmsEstimateGamma(const cmsToneCurve* t, cmsFloat64Number Precision);
-
+CMSAPI cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t);
 CMSAPI const cmsCurveSegment* CMSEXPORT cmsGetToneCurveSegment(cmsInt32Number n, const cmsToneCurve* t);
 
 // Tone curve tabular estimation
--- a/src/cmsgamma.c
+++ b/src/cmsgamma.c
@@ -1511,3 +1511,12 @@
     return t->Segments + n;
 }
 
+// Retrieve parameters on one-segment tone curves
+
+cmsFloat64Number* CMSEXPORT cmsGetToneCurveParams(const cmsToneCurve* t)
+{
+    _cmsAssert(t != NULL);
+
+    if (t->nSegments != 1) return NULL;
+    return t->Segments[0].Params;
+}