Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 91 additions & 18 deletions THIRD_PARTY_README
Original file line number Diff line number Diff line change
Expand Up @@ -1725,31 +1725,104 @@ THE SOFTWARE.

-------------------------------------------------------------------------------

%% This notice is provided with respect to Little CMS 2.12, which may be
%% This notice is provided with respect to Little CMS 2.16, which may be
included with JRE 8, JDK 8, and OpenJDK 8.

--- begin of LICENSE ---

Little CMS
Copyright (c) 1998-2020 Marti Maria Saguer
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Copyright (C) 1998-2023 Marti Maria Saguer

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

---------------------------------
The below license applies to the following files:
liblcms/cmssm.c

Copyright 2001, softSurfer (www.softsurfer.com)

This code may be freely used and modified for any purpose
providing that this copyright notice is included with it.
SoftSurfer makes no warranty for this code, and cannot be held
liable for any real or imagined damage resulting from its use.
Users of this code must verify correctness for their application.

AUTHORS File Information:

Main Author
------------
Marti Maria


Contributors
------------
Bob Friesenhahn
Kai-Uwe Behrmann
Stuart Nixon
Jordi Vilar
Richard Hughes
Auke Nauta
Chris Evans (Google)
Lorenzo Ridolfi
Robin Watts (Artifex)
Shawn Pedersen
Andrew Brygin
Samuli Suominen
Florian Hˆch
Aurelien Jarno
Claudiu Cebuc
Michael Vhrel (Artifex)
Michal Cihar
Daniel Kaneider
Mateusz Jurczyk (Google)
Paul Miller
SÈbastien LÈon
Christian Schmitz
XhmikosR
Stanislav Brabec (SuSe)
Leonhard Gruenschloss (Google)
Patrick Noffke
Christopher James Halse Rogers
John Hein
Thomas Weber (Debian)
Mark Allen
Noel Carboni
Sergei Trofimovic
Philipp Knechtges
Amyspark
Lovell Fuller
Eli Schwartz
Diogo Teles Sant'Anna

Special Thanks
--------------
Artifex software
AlienSkin software
libVIPS
Jan Morovic
Jos Vernon (WebSupergoo)
Harald Schneider (Maxon)
Christian Albrecht
Dimitrios Anastassakis
Lemke Software
Tim Zaman

--- end of LICENSE ---

Expand Down
23 changes: 23 additions & 0 deletions jdk/src/share/native/sun/java2d/cmm/lcms/UPDATING.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Tips and tasks when updating LittleCMS sources to a newer version.

Download and unzip latest release from https://sourceforge.net/projects/lcms/files/
Replace files in jdk/src/share/native/sun/java2d/cmm/lcms with files from unzipped src and include folders
Replace is important because the lcms sources here are just the subset needed by JDK.
This is deliberate, so when updating be sure to import only the same files.
If a file has been removed from upstream you will notice it during the copy.
It should then be removed from the JDK sources.
If a new file is needed then the build will fail. Manually copy that in.

Some re-editing of these updated files will be needed.
Use "expand" and "sed" to remove tabs and trailing white space from the imported files.
Re-apply the GPL headers used by the JDK. If done correctly these should then not
show up in the PR diff.

Update THIRD_PARTY_README per the current license/copyrights/attributions etc.

Build on all platforms.
If there are compiler warnings causing build failures, update the disabled warnings in
jdk/make/lib/Awt2dLibraries.gmk
Run all automated client tests on all platforms.
Also run J2Ddemo and pay particular attention to the "color" tab.
Visually verify the color transforms against the same with the current/previous JDK
44 changes: 24 additions & 20 deletions jdk/src/share/native/sun/java2d/cmm/lcms/cmsalpha.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//---------------------------------------------------------------------------------
//
// Little Color Management System
// Copyright (c) 1998-2020 Marti Maria Saguer
// Copyright (c) 1998-2023 Marti Maria Saguer
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -220,21 +220,21 @@ static
void fromFLTto8(void* dst, const void* src)
{
cmsFloat32Number n = *(cmsFloat32Number*)src;
*(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0f);
*(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0);
}

static
void fromFLTto16(void* dst, const void* src)
{
cmsFloat32Number n = *(cmsFloat32Number*)src;
*(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f);
*(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0);
}

static
void fromFLTto16SE(void* dst, const void* src)
{
cmsFloat32Number n = *(cmsFloat32Number*)src;
cmsUInt16Number i = _cmsQuickSaturateWord(n * 65535.0f);
cmsUInt16Number i = _cmsQuickSaturateWord(n * 65535.0);

*(cmsUInt16Number*)dst = CHANGE_ENDIAN(i);
}
Expand Down Expand Up @@ -272,7 +272,7 @@ void fromHLFto8(void* dst, const void* src)
{
#ifndef CMS_NO_HALF_SUPPORT
cmsFloat32Number n = _cmsHalf2Float(*(cmsUInt16Number*)src);
*(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0f);
*(cmsUInt8Number*)dst = _cmsQuickSaturateByte(n * 255.0);
#else
cmsUNUSED_PARAMETER(dst);
cmsUNUSED_PARAMETER(src);
Expand All @@ -285,7 +285,7 @@ void fromHLFto16(void* dst, const void* src)
{
#ifndef CMS_NO_HALF_SUPPORT
cmsFloat32Number n = _cmsHalf2Float(*(cmsUInt16Number*)src);
*(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0f);
*(cmsUInt16Number*)dst = _cmsQuickSaturateWord(n * 65535.0);
#else
cmsUNUSED_PARAMETER(dst);
cmsUNUSED_PARAMETER(src);
Expand All @@ -297,7 +297,7 @@ void fromHLFto16SE(void* dst, const void* src)
{
#ifndef CMS_NO_HALF_SUPPORT
cmsFloat32Number n = _cmsHalf2Float(*(cmsUInt16Number*)src);
cmsUInt16Number i = _cmsQuickSaturateWord(n * 65535.0f);
cmsUInt16Number i = _cmsQuickSaturateWord(n * 65535.0);
*(cmsUInt16Number*)dst = CHANGE_ENDIAN(i);
#else
cmsUNUSED_PARAMETER(dst);
Expand Down Expand Up @@ -431,7 +431,7 @@ static cmsFormatterAlphaFn FormattersAlpha[6][6] = {

// This function computes the distance from each component to the next one in bytes.
static
void ComputeIncrementsForChunky(cmsUInt32Number Format,
cmsBool ComputeIncrementsForChunky(cmsUInt32Number Format,
cmsUInt32Number ComponentStartingOrder[],
cmsUInt32Number ComponentPointerIncrements[])
{
Expand All @@ -443,9 +443,9 @@ void ComputeIncrementsForChunky(cmsUInt32Number Format,
cmsUInt32Number channelSize = trueBytesSize(Format);
cmsUInt32Number pixelSize = channelSize * total_chans;

// Sanity check
if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS)
return;
// Sanity check
if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS)
return FALSE;

memset(channels, 0, sizeof(channels));

Expand Down Expand Up @@ -482,13 +482,15 @@ void ComputeIncrementsForChunky(cmsUInt32Number Format,

for (i = 0; i < extra; i++)
ComponentStartingOrder[i] = channels[i + nchannels];

return TRUE;
}



// On planar configurations, the distance is the stride added to any non-negative
static
void ComputeIncrementsForPlanar(cmsUInt32Number Format,
cmsBool ComputeIncrementsForPlanar(cmsUInt32Number Format,
cmsUInt32Number BytesPerPlane,
cmsUInt32Number ComponentStartingOrder[],
cmsUInt32Number ComponentPointerIncrements[])
Expand All @@ -502,7 +504,7 @@ void ComputeIncrementsForPlanar(cmsUInt32Number Format,

// Sanity check
if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS)
return;
return FALSE;

memset(channels, 0, sizeof(channels));

Expand Down Expand Up @@ -538,29 +540,29 @@ void ComputeIncrementsForPlanar(cmsUInt32Number Format,

for (i = 0; i < extra; i++)
ComponentStartingOrder[i] = channels[i + nchannels];

return TRUE;
}



// Dispatcher por chunky and planar RGB
static
void ComputeComponentIncrements(cmsUInt32Number Format,
cmsBool ComputeComponentIncrements(cmsUInt32Number Format,
cmsUInt32Number BytesPerPlane,
cmsUInt32Number ComponentStartingOrder[],
cmsUInt32Number ComponentPointerIncrements[])
{
if (T_PLANAR(Format)) {

ComputeIncrementsForPlanar(Format, BytesPerPlane, ComponentStartingOrder, ComponentPointerIncrements);
return ComputeIncrementsForPlanar(Format, BytesPerPlane, ComponentStartingOrder, ComponentPointerIncrements);
}
else {
ComputeIncrementsForChunky(Format, ComponentStartingOrder, ComponentPointerIncrements);
return ComputeIncrementsForChunky(Format, ComponentStartingOrder, ComponentPointerIncrements);
}

}



// Handles extra channels copying alpha if requested by the flags
void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
void* out,
Expand Down Expand Up @@ -595,8 +597,10 @@ void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
return;

// Compute the increments
ComputeComponentIncrements(p->InputFormat, Stride->BytesPerPlaneIn, SourceStartingOrder, SourceIncrements);
ComputeComponentIncrements(p->OutputFormat, Stride->BytesPerPlaneOut, DestStartingOrder, DestIncrements);
if (!ComputeComponentIncrements(p->InputFormat, Stride->BytesPerPlaneIn, SourceStartingOrder, SourceIncrements))
return;
if (!ComputeComponentIncrements(p->OutputFormat, Stride->BytesPerPlaneOut, DestStartingOrder, DestIncrements))
return;

// Check for conversions 8, 16, half, float, dbl
copyValueFn = _cmsGetFormatterAlpha(p->ContextID, p->InputFormat, p->OutputFormat);
Expand Down
4 changes: 2 additions & 2 deletions jdk/src/share/native/sun/java2d/cmm/lcms/cmscam02.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//---------------------------------------------------------------------------------
//
// Little Color Management System
// Copyright (c) 1998-2020 Marti Maria Saguer
// Copyright (c) 1998-2023 Marti Maria Saguer
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
Expand Down Expand Up @@ -353,7 +353,7 @@ CAM02COLOR HPEtoCAT02(CAM02COLOR clr)
M[5] = ((-0.7036 * 0.201908) + (1.6975 * 0.000008) + 0.0061);
M[6] = (( 0.0030 * 1.910197) + (0.0136 * 0.370950));
M[7] = (( 0.0030 * -1.112124) + (0.0136 * 0.629054));
M[8] = (( 0.0030 * 0.201908) + (0.0136 * 0.000008) + 0.9834);;
M[8] = (( 0.0030 * 0.201908) + (0.0136 * 0.000008) + 0.9834);

clr.RGBc[0] = (clr.RGBp[0] * M[0]) + (clr.RGBp[1] * M[1]) + (clr.RGBp[2] * M[2]);
clr.RGBc[1] = (clr.RGBp[0] * M[3]) + (clr.RGBp[1] * M[4]) + (clr.RGBp[2] * M[5]);
Expand Down
Loading