Skip to content

Commit

Permalink
8321489: Update LCMS to 2.16
Browse files Browse the repository at this point in the history
Backport-of: dc7d3b182d226253ca246dd854c85c4dd964f10e
  • Loading branch information
GoeLin committed Mar 14, 2024
1 parent 0f09d0b commit 2921ad6
Show file tree
Hide file tree
Showing 21 changed files with 1,465 additions and 359 deletions.
39 changes: 17 additions & 22 deletions src/java.desktop/share/legal/lcms.md
@@ -1,34 +1,29 @@
## Little Color Management System (LCMS) v2.15
## Little Color Management System (LCMS) v2.16

### LCMS License
<pre>
README.1ST file information

LittleCMS core is released under MIT License
MIT License

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

Little CMS
Copyright (c) 1998-2023 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"), 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:
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 above copyright notice and this permission notice shall be
included in all copies or substantial portions of 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.
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:
Expand All @@ -47,7 +42,6 @@ Users of this code must verify correctness for their application.
### AUTHORS File Information
```
Main Author
------------
Marti Maria
Expand Down Expand Up @@ -91,6 +85,7 @@ Philipp Knechtges
Amyspark
Lovell Fuller
Eli Schwartz
Diogo Teles Sant'Anna
Special Thanks
--------------
Expand Down
26 changes: 15 additions & 11 deletions src/java.desktop/share/native/liblcms/cmsalpha.c
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 @@ -445,7 +445,7 @@ void ComputeIncrementsForChunky(cmsUInt32Number Format,

// Sanity check
if (total_chans <= 0 || total_chans >= cmsMAXCHANNELS)
return;
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

1 comment on commit 2921ad6

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.