src/java.desktop/share/native/liblcms/cmsxform.c
author dchuyko
Fri, 08 Feb 2019 16:37:35 +0300
changeset 53797 c1af89d9d44c
parent 49775 8fa5bb0cb937
permissions -rw-r--r--
8215130: Fix errors in LittleCMS 2.9 reported by GCC 8 Reviewed-by: prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5190
diff changeset
     6
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5190
diff changeset
     8
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5190
diff changeset
    20
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5190
diff changeset
    21
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 5190
diff changeset
    22
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
// This file is available under and governed by the GNU General Public
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
// License version 2 only, as published by the Free Software Foundation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
// However, the following notice accompanied the original version of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
// file:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
//
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
    30
//---------------------------------------------------------------------------------
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
//
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
    32
//  Little Color Management System
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
    33
//  Copyright (c) 1998-2017 Marti Maria Saguer
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
// Permission is hereby granted, free of charge, to any person obtaining
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
// a copy of this software and associated documentation files (the "Software"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
// to deal in the Software without restriction, including without limitation
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
// and/or sell copies of the Software, and to permit persons to whom the Software
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
// is furnished to do so, subject to the following conditions:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
// The above copyright notice and this permission notice shall be included in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
// all copies or substantial portions of the Software.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
//
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
    52
//
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
    53
//---------------------------------------------------------------------------------
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
    54
//
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
    56
#include "lcms2_internal.h"
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
// Transformations stuff
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
// -----------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    61
#define DEFAULT_OBSERVER_ADAPTATION_STATE 1.0
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    62
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    63
// The Context0 observer adaptation state.
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    64
_cmsAdaptationStateChunkType _cmsAdaptationStateChunk = { DEFAULT_OBSERVER_ADAPTATION_STATE };
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    65
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    66
// Init and duplicate observer adaptation state
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    67
void _cmsAllocAdaptationStateChunk(struct _cmsContext_struct* ctx,
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    68
                                   const struct _cmsContext_struct* src)
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    69
{
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    70
    static _cmsAdaptationStateChunkType AdaptationStateChunk = { DEFAULT_OBSERVER_ADAPTATION_STATE };
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    71
    void* from;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    72
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    73
    if (src != NULL) {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    74
        from = src ->chunks[AdaptationStateContext];
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    75
    }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    76
    else {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    77
       from = &AdaptationStateChunk;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    78
    }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    79
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    80
    ctx ->chunks[AdaptationStateContext] = _cmsSubAllocDup(ctx ->MemPool, from, sizeof(_cmsAdaptationStateChunkType));
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    81
}
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    82
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    83
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    84
// Sets adaptation state for absolute colorimetric intent in the given context.  Adaptation state applies on all
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    85
// but cmsCreateExtendedTransformTHR().  Little CMS can handle incomplete adaptation states.
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    86
cmsFloat64Number CMSEXPORT cmsSetAdaptationStateTHR(cmsContext ContextID, cmsFloat64Number d)
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    87
{
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    88
    cmsFloat64Number prev;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    89
    _cmsAdaptationStateChunkType* ptr = (_cmsAdaptationStateChunkType*) _cmsContextGetClientChunk(ContextID, AdaptationStateContext);
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    90
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    91
    // Get previous value for return
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    92
    prev = ptr ->AdaptationState;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    93
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    94
    // Set the value if d is positive or zero
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    95
    if (d >= 0.0) {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    96
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    97
        ptr ->AdaptationState = d;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    98
    }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
    99
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   100
    // Always return previous value
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   101
    return prev;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   102
}
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   103
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   105
// The adaptation state may be defaulted by this function. If you don't like it, use the extended transform routine
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   106
cmsFloat64Number CMSEXPORT cmsSetAdaptationState(cmsFloat64Number d)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   107
{
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   108
    return cmsSetAdaptationStateTHR(NULL, d);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   109
}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   111
// -----------------------------------------------------------------------
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   112
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   113
// Alarm codes for 16-bit transformations, because the fixed range of containers there are
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   114
// no values left to mark out of gamut.
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   115
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   116
#define DEFAULT_ALARM_CODES_VALUE {0x7F00, 0x7F00, 0x7F00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   117
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   118
_cmsAlarmCodesChunkType _cmsAlarmCodesChunk = { DEFAULT_ALARM_CODES_VALUE };
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   119
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   120
// Sets the codes used to mark out-out-gamut on Proofing transforms for a given context. Values are meant to be
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   121
// encoded in 16 bits.
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   122
void CMSEXPORT cmsSetAlarmCodesTHR(cmsContext ContextID, const cmsUInt16Number AlarmCodesP[cmsMAXCHANNELS])
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   123
{
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   124
    _cmsAlarmCodesChunkType* ContextAlarmCodes = (_cmsAlarmCodesChunkType*) _cmsContextGetClientChunk(ContextID, AlarmCodesContext);
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   125
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   126
    _cmsAssert(ContextAlarmCodes != NULL); // Can't happen
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   127
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   128
    memcpy(ContextAlarmCodes->AlarmCodes, AlarmCodesP, sizeof(ContextAlarmCodes->AlarmCodes));
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   129
}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   131
// Gets the current codes used to mark out-out-gamut on Proofing transforms for the given context.
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   132
// Values are meant to be encoded in 16 bits.
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   133
void CMSEXPORT cmsGetAlarmCodesTHR(cmsContext ContextID, cmsUInt16Number AlarmCodesP[cmsMAXCHANNELS])
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   134
{
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   135
    _cmsAlarmCodesChunkType* ContextAlarmCodes = (_cmsAlarmCodesChunkType*) _cmsContextGetClientChunk(ContextID, AlarmCodesContext);
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   136
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   137
    _cmsAssert(ContextAlarmCodes != NULL); // Can't happen
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   138
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   139
    memcpy(AlarmCodesP, ContextAlarmCodes->AlarmCodes, sizeof(ContextAlarmCodes->AlarmCodes));
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   140
}
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   141
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   142
void CMSEXPORT cmsSetAlarmCodes(const cmsUInt16Number NewAlarm[cmsMAXCHANNELS])
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   143
{
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   144
    _cmsAssert(NewAlarm != NULL);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   146
    cmsSetAlarmCodesTHR(NULL, NewAlarm);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   149
void CMSEXPORT cmsGetAlarmCodes(cmsUInt16Number OldAlarm[cmsMAXCHANNELS])
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
{
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   151
    _cmsAssert(OldAlarm != NULL);
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   152
    cmsGetAlarmCodesTHR(NULL, OldAlarm);
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   153
}
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   154
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   156
// Init and duplicate alarm codes
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   157
void _cmsAllocAlarmCodesChunk(struct _cmsContext_struct* ctx,
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   158
                              const struct _cmsContext_struct* src)
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   159
{
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   160
    static _cmsAlarmCodesChunkType AlarmCodesChunk = { DEFAULT_ALARM_CODES_VALUE };
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   161
    void* from;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   163
    if (src != NULL) {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   164
        from = src ->chunks[AlarmCodesContext];
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   165
    }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   166
    else {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   167
       from = &AlarmCodesChunk;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   168
    }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   169
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   170
    ctx ->chunks[AlarmCodesContext] = _cmsSubAllocDup(ctx ->MemPool, from, sizeof(_cmsAlarmCodesChunkType));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   173
// -----------------------------------------------------------------------
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   174
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   175
// Get rid of transform resources
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   176
void CMSEXPORT cmsDeleteTransform(cmsHTRANSFORM hTransform)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   177
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   178
    _cmsTRANSFORM* p = (_cmsTRANSFORM*) hTransform;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   179
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   180
    _cmsAssert(p != NULL);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   181
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   182
    if (p -> GamutCheck)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   183
        cmsPipelineFree(p -> GamutCheck);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   185
    if (p -> Lut)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   186
        cmsPipelineFree(p -> Lut);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   187
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   188
    if (p ->InputColorant)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   189
        cmsFreeNamedColorList(p ->InputColorant);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   190
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   191
    if (p -> OutputColorant)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   192
        cmsFreeNamedColorList(p ->OutputColorant);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   193
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   194
    if (p ->Sequence)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   195
        cmsFreeProfileSequenceDescription(p ->Sequence);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   196
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   197
    if (p ->UserData)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   198
        p ->FreeUserData(p ->ContextID, p ->UserData);
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   199
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   200
    _cmsFree(p ->ContextID, (void *) p);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   203
// Apply transform.
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   204
void CMSEXPORT cmsDoTransform(cmsHTRANSFORM  Transform,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   205
                              const void* InputBuffer,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   206
                              void* OutputBuffer,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   207
                              cmsUInt32Number Size)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
{
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   210
    _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform;
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   211
    cmsStride stride;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   213
    stride.BytesPerLineIn = 0;  // Not used
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   214
    stride.BytesPerLineOut = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   215
    stride.BytesPerPlaneIn = Size;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   216
    stride.BytesPerPlaneOut = Size;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   217
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   218
    p -> xform(p, InputBuffer, OutputBuffer, Size, 1, &stride);
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   219
}
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   220
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   221
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   222
// This is a legacy stride for planar
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   223
void CMSEXPORT cmsDoTransformStride(cmsHTRANSFORM  Transform,
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   224
                              const void* InputBuffer,
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   225
                              void* OutputBuffer,
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   226
                              cmsUInt32Number Size, cmsUInt32Number Stride)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   227
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   228
{
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   229
    _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform;
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   230
    cmsStride stride;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   231
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   232
    stride.BytesPerLineIn = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   233
    stride.BytesPerLineOut = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   234
    stride.BytesPerPlaneIn = Stride;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   235
    stride.BytesPerPlaneOut = Stride;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   236
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   237
    p -> xform(p, InputBuffer, OutputBuffer, Size, 1, &stride);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   240
// This is the "fast" function for plugins
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   241
void CMSEXPORT cmsDoTransformLineStride(cmsHTRANSFORM  Transform,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   242
                              const void* InputBuffer,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   243
                              void* OutputBuffer,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   244
                              cmsUInt32Number PixelsPerLine,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   245
                              cmsUInt32Number LineCount,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   246
                              cmsUInt32Number BytesPerLineIn,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   247
                              cmsUInt32Number BytesPerLineOut,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   248
                              cmsUInt32Number BytesPerPlaneIn,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   249
                              cmsUInt32Number BytesPerPlaneOut)
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   250
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   251
{
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   252
    _cmsTRANSFORM* p = (_cmsTRANSFORM*) Transform;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   253
    cmsStride stride;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   254
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   255
    stride.BytesPerLineIn = BytesPerLineIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   256
    stride.BytesPerLineOut = BytesPerLineOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   257
    stride.BytesPerPlaneIn = BytesPerPlaneIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   258
    stride.BytesPerPlaneOut = BytesPerPlaneOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   259
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   260
    p->xform(p, InputBuffer, OutputBuffer, PixelsPerLine, LineCount, &stride);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   261
}
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   262
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   263
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   265
// Transform routines ----------------------------------------------------------------------------------------------------------
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   267
// Float xform converts floats. Since there are no performance issues, one routine does all job, including gamut check.
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   268
// Note that because extended range, we can use a -1.0 value for out of gamut in this case.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
static
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   270
void FloatXFORM(_cmsTRANSFORM* p,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   271
                const void* in,
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   272
                void* out,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   273
                cmsUInt32Number PixelsPerLine,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   274
                cmsUInt32Number LineCount,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   275
                const cmsStride* Stride)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
{
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   277
    cmsUInt8Number* accum;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   278
    cmsUInt8Number* output;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   279
    cmsFloat32Number fIn[cmsMAXCHANNELS], fOut[cmsMAXCHANNELS];
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   280
    cmsFloat32Number OutOfGamut;
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   281
    cmsUInt32Number i, j, c, strideIn, strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   282
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   283
    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   284
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   285
    strideIn = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   286
    strideOut = 0;
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   287
    memset(fIn, 0, sizeof(fIn));
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   288
    memset(fOut, 0, sizeof(fIn));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   290
    for (i = 0; i < LineCount; i++) {
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   291
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   292
        accum = (cmsUInt8Number*)in + strideIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   293
        output = (cmsUInt8Number*)out + strideOut;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   294
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   295
        for (j = 0; j < PixelsPerLine; j++) {
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   296
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   297
            accum = p->FromInputFloat(p, fIn, accum, Stride->BytesPerPlaneIn);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   299
            // Any gamut chack to do?
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   300
            if (p->GamutCheck != NULL) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   302
                // Evaluate gamut marker.
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   303
                cmsPipelineEvalFloat(fIn, &OutOfGamut, p->GamutCheck);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   304
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   305
                // Is current color out of gamut?
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   306
                if (OutOfGamut > 0.0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   308
                    // Certainly, out of gamut
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   309
                    for (c = 0; c < cmsMAXCHANNELS; c++)
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   310
                        fOut[c] = -1.0;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   311
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   312
                }
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   313
                else {
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   314
                    // No, proceed normally
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   315
                    cmsPipelineEvalFloat(fIn, fOut, p->Lut);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   316
                }
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   317
            }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   318
            else {
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   319
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   320
                // No gamut check at all
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   321
                cmsPipelineEvalFloat(fIn, fOut, p->Lut);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   322
            }
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   323
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   325
            output = p->ToOutputFloat(p, fOut, output, Stride->BytesPerPlaneOut);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   326
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   328
        strideIn += Stride->BytesPerLineIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   329
        strideOut += Stride->BytesPerLineOut;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   330
    }
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   331
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   332
}
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   333
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   334
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   335
static
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   336
void NullFloatXFORM(_cmsTRANSFORM* p,
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   337
                    const void* in,
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   338
                    void* out,
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   339
                    cmsUInt32Number PixelsPerLine,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   340
                    cmsUInt32Number LineCount,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   341
                    const cmsStride* Stride)
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   342
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   343
{
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   344
    cmsUInt8Number* accum;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   345
    cmsUInt8Number* output;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   346
    cmsFloat32Number fIn[cmsMAXCHANNELS];
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   347
    cmsUInt32Number i, j, strideIn, strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   348
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   349
    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   350
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   351
    strideIn = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   352
    strideOut = 0;
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   353
    memset(fIn, 0, sizeof(fIn));
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   354
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   355
    for (i = 0; i < LineCount; i++) {
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   356
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   357
           accum = (cmsUInt8Number*) in + strideIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   358
           output = (cmsUInt8Number*) out + strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   359
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   360
           for (j = 0; j < PixelsPerLine; j++) {
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   361
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   362
                  accum = p->FromInputFloat(p, fIn, accum, Stride ->BytesPerPlaneIn);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   363
                  output = p->ToOutputFloat(p, fIn, output, Stride->BytesPerPlaneOut);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   364
           }
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   365
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   366
           strideIn += Stride->BytesPerLineIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   367
           strideOut += Stride->BytesPerLineOut;
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   368
    }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   369
}
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   370
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   371
// 16 bit precision -----------------------------------------------------------------------------------------------------------
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   373
// Null transformation, only applies formatters. No caché
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   374
static
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   375
void NullXFORM(_cmsTRANSFORM* p,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   376
               const void* in,
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   377
               void* out,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   378
               cmsUInt32Number PixelsPerLine,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   379
               cmsUInt32Number LineCount,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   380
               const cmsStride* Stride)
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   381
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   382
    cmsUInt8Number* accum;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   383
    cmsUInt8Number* output;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   384
    cmsUInt16Number wIn[cmsMAXCHANNELS];
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   385
    cmsUInt32Number i, j, strideIn, strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   386
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   387
    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   389
    strideIn = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   390
    strideOut = 0;
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   391
    memset(wIn, 0, sizeof(wIn));
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   392
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   393
    for (i = 0; i < LineCount; i++) {
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   394
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   395
           accum = (cmsUInt8Number*)in + strideIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   396
           output = (cmsUInt8Number*)out + strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   397
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   398
           for (j = 0; j < PixelsPerLine; j++) {
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   399
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   400
                  accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   401
                  output = p->ToOutput(p, wIn, output, Stride->BytesPerPlaneOut);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   402
    }
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   403
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   404
           strideIn += Stride->BytesPerLineIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   405
           strideOut += Stride->BytesPerLineOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   406
    }
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   407
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   408
}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   411
// No gamut check, no cache, 16 bits
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   412
static
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   413
void PrecalculatedXFORM(_cmsTRANSFORM* p,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   414
                        const void* in,
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   415
                        void* out,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   416
                        cmsUInt32Number PixelsPerLine,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   417
                        cmsUInt32Number LineCount,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   418
                        const cmsStride* Stride)
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   419
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   420
    register cmsUInt8Number* accum;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   421
    register cmsUInt8Number* output;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   422
    cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   423
    cmsUInt32Number i, j, strideIn, strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   424
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   425
    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   427
    strideIn = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   428
    strideOut = 0;
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   429
    memset(wIn, 0, sizeof(wIn));
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   430
    memset(wOut, 0, sizeof(wOut));
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   431
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   432
    for (i = 0; i < LineCount; i++) {
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   433
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   434
        accum = (cmsUInt8Number*)in + strideIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   435
        output = (cmsUInt8Number*)out + strideOut;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   437
        for (j = 0; j < PixelsPerLine; j++) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   439
            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   440
            p->Lut->Eval16Fn(wIn, wOut, p->Lut->Data);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   441
            output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   442
        }
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   443
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   444
        strideIn += Stride->BytesPerLineIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   445
        strideOut += Stride->BytesPerLineOut;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   446
    }
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   447
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   451
// Auxiliary: Handle precalculated gamut check. The retrieval of context may be alittle bit slow, but this function is not critical.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
static
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   453
void TransformOnePixelWithGamutCheck(_cmsTRANSFORM* p,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   454
                                     const cmsUInt16Number wIn[],
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   455
                                     cmsUInt16Number wOut[])
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
{
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   457
    cmsUInt16Number wOutOfGamut;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   458
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   459
    p ->GamutCheck ->Eval16Fn(wIn, &wOutOfGamut, p ->GamutCheck ->Data);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   460
    if (wOutOfGamut >= 1) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   461
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   462
        cmsUInt16Number i;
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   463
        _cmsAlarmCodesChunkType* ContextAlarmCodes = (_cmsAlarmCodesChunkType*) _cmsContextGetClientChunk(p->ContextID, AlarmCodesContext);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   465
        for (i=0; i < p ->Lut->OutputChannels; i++) {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   466
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   467
            wOut[i] = ContextAlarmCodes ->AlarmCodes[i];
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   468
        }
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   469
    }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   470
    else
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   471
        p ->Lut ->Eval16Fn(wIn, wOut, p -> Lut->Data);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   472
}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   474
// Gamut check, No caché, 16 bits.
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   475
static
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   476
void PrecalculatedXFORMGamutCheck(_cmsTRANSFORM* p,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   477
                                  const void* in,
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   478
                                  void* out,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   479
                                  cmsUInt32Number PixelsPerLine,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   480
                                  cmsUInt32Number LineCount,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   481
                                  const cmsStride* Stride)
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   482
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   483
    cmsUInt8Number* accum;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   484
    cmsUInt8Number* output;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   485
    cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   486
    cmsUInt32Number i, j, strideIn, strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   487
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   488
    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   490
    strideIn = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   491
    strideOut = 0;
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   492
    memset(wIn, 0, sizeof(wIn));
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   493
    memset(wOut, 0, sizeof(wOut));
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   494
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   495
    for (i = 0; i < LineCount; i++) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   497
           accum = (cmsUInt8Number*)in + strideIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   498
           output = (cmsUInt8Number*)out + strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   499
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   500
           for (j = 0; j < PixelsPerLine; j++) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   502
                  accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   503
                  TransformOnePixelWithGamutCheck(p, wIn, wOut);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   504
                  output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   505
           }
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   506
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   507
           strideIn += Stride->BytesPerLineIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   508
           strideOut += Stride->BytesPerLineOut;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   509
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   513
// No gamut check, Caché, 16 bits,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
static
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   515
void CachedXFORM(_cmsTRANSFORM* p,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   516
                 const void* in,
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   517
                 void* out,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   518
                 cmsUInt32Number PixelsPerLine,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   519
                 cmsUInt32Number LineCount,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   520
                 const cmsStride* Stride)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
{
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   522
    cmsUInt8Number* accum;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   523
    cmsUInt8Number* output;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   524
    cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   525
    _cmsCACHE Cache;
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   526
    cmsUInt32Number i, j, strideIn, strideOut;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   527
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   528
    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   529
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   530
    // Empty buffers for quick memcmp
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   531
    memset(wIn, 0, sizeof(wIn));
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   532
    memset(wOut, 0, sizeof(wOut));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   534
    // Get copy of zero cache
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   535
    memcpy(&Cache, &p->Cache, sizeof(Cache));
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   536
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   537
    strideIn = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   538
    strideOut = 0;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   539
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   540
    for (i = 0; i < LineCount; i++) {
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   541
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   542
        accum = (cmsUInt8Number*)in + strideIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   543
        output = (cmsUInt8Number*)out + strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   544
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   545
        for (j = 0; j < PixelsPerLine; j++) {
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   546
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   547
            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   548
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   549
            if (memcmp(wIn, Cache.CacheIn, sizeof(Cache.CacheIn)) == 0) {
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   550
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   551
                memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut));
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   552
            }
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   553
            else {
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   554
                p->Lut->Eval16Fn(wIn, wOut, p->Lut->Data);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   555
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   556
                memcpy(Cache.CacheIn, wIn, sizeof(Cache.CacheIn));
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   557
                memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut));
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   558
            }
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   559
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   560
            output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   561
        }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   562
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   563
        strideIn += Stride->BytesPerLineIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   564
        strideOut += Stride->BytesPerLineOut;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   565
    }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   566
}
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   567
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   568
// All those nice features together
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   569
static
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   570
void CachedXFORMGamutCheck(_cmsTRANSFORM* p,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   571
                           const void* in,
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   572
                           void* out,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   573
                           cmsUInt32Number PixelsPerLine,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   574
                           cmsUInt32Number LineCount,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   575
                           const cmsStride* Stride)
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   576
{
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   577
    cmsUInt8Number* accum;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   578
    cmsUInt8Number* output;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   579
    cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   580
    _cmsCACHE Cache;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   581
    cmsUInt32Number i, j, strideIn, strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   582
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   583
    _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   584
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   585
    // Empty buffers for quick memcmp
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   586
    memset(wIn, 0, sizeof(wIn));
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   587
    memset(wOut, 0, sizeof(wOut));
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   588
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   589
    // Get copy of zero cache
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   590
    memcpy(&Cache, &p->Cache, sizeof(Cache));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   592
    strideIn = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   593
    strideOut = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   594
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   595
    for (i = 0; i < LineCount; i++) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   597
        accum = (cmsUInt8Number*)in + strideIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   598
        output = (cmsUInt8Number*)out + strideOut;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   600
        for (j = 0; j < PixelsPerLine; j++) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   602
            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   604
            if (memcmp(wIn, Cache.CacheIn, sizeof(Cache.CacheIn)) == 0) {
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   605
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   606
                memcpy(wOut, Cache.CacheOut, sizeof(Cache.CacheOut));
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   607
            }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   608
            else {
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   609
                TransformOnePixelWithGamutCheck(p, wIn, wOut);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   610
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   611
                memcpy(Cache.CacheIn, wIn, sizeof(Cache.CacheIn));
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   612
                memcpy(Cache.CacheOut, wOut, sizeof(Cache.CacheOut));
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   613
            }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   615
            output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   616
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   618
        strideIn += Stride->BytesPerLineIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   619
        strideOut += Stride->BytesPerLineOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   620
    }
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   621
}
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   622
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   623
// Transform plug-ins ----------------------------------------------------------------------------------------------------
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   624
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   625
// List of used-defined transform factories
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   626
typedef struct _cmsTransformCollection_st {
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   627
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   628
    _cmsTransform2Factory  Factory;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   629
    cmsBool                OldXform;   // Factory returns xform function in the old style
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   630
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   631
    struct _cmsTransformCollection_st *Next;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   632
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   633
} _cmsTransformCollection;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   634
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   635
// The linked list head
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   636
_cmsTransformPluginChunkType _cmsTransformPluginChunk = { NULL };
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   637
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   638
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   639
// Duplicates the zone of memory used by the plug-in in the new context
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   640
static
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   641
void DupPluginTransformList(struct _cmsContext_struct* ctx,
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   642
                                               const struct _cmsContext_struct* src)
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   643
{
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   644
   _cmsTransformPluginChunkType newHead = { NULL };
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   645
   _cmsTransformCollection*  entry;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   646
   _cmsTransformCollection*  Anterior = NULL;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   647
   _cmsTransformPluginChunkType* head = (_cmsTransformPluginChunkType*) src->chunks[TransformPlugin];
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   648
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   649
    // Walk the list copying all nodes
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   650
   for (entry = head->TransformCollection;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   651
        entry != NULL;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   652
        entry = entry ->Next) {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   653
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   654
            _cmsTransformCollection *newEntry = ( _cmsTransformCollection *) _cmsSubAllocDup(ctx ->MemPool, entry, sizeof(_cmsTransformCollection));
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   655
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   656
            if (newEntry == NULL)
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   657
                return;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   658
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   659
            // We want to keep the linked list order, so this is a little bit tricky
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   660
            newEntry -> Next = NULL;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   661
            if (Anterior)
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   662
                Anterior -> Next = newEntry;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   663
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   664
            Anterior = newEntry;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   665
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   666
            if (newHead.TransformCollection == NULL)
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   667
                newHead.TransformCollection = newEntry;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   668
    }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   669
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   670
  ctx ->chunks[TransformPlugin] = _cmsSubAllocDup(ctx->MemPool, &newHead, sizeof(_cmsTransformPluginChunkType));
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   671
}
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   672
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   673
// Allocates memory for transform plugin factory
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   674
void _cmsAllocTransformPluginChunk(struct _cmsContext_struct* ctx,
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   675
                                        const struct _cmsContext_struct* src)
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   676
{
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   677
    if (src != NULL) {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   678
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   679
        // Copy all linked list
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   680
        DupPluginTransformList(ctx, src);
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   681
    }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   682
    else {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   683
        static _cmsTransformPluginChunkType TransformPluginChunkType = { NULL };
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   684
        ctx ->chunks[TransformPlugin] = _cmsSubAllocDup(ctx ->MemPool, &TransformPluginChunkType, sizeof(_cmsTransformPluginChunkType));
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   685
    }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   686
}
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   687
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   688
// Adaptor for old versions of plug-in
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   689
static
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   690
void _cmsTransform2toTransformAdaptor(struct _cmstransform_struct *CMMcargo,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   691
                                      const void* InputBuffer,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   692
                                      void* OutputBuffer,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   693
                                      cmsUInt32Number PixelsPerLine,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   694
                                      cmsUInt32Number LineCount,
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   695
                                      const cmsStride* Stride)
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   696
{
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   697
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   698
       cmsUInt32Number i, strideIn, strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   699
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   700
       _cmsHandleExtraChannels(CMMcargo, InputBuffer, OutputBuffer, PixelsPerLine, LineCount, Stride);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   701
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   702
       strideIn = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   703
       strideOut = 0;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   704
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   705
       for (i = 0; i < LineCount; i++) {
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   706
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   707
              void *accum = (cmsUInt8Number*)InputBuffer + strideIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   708
              void *output = (cmsUInt8Number*)OutputBuffer + strideOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   709
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   710
              CMMcargo->OldXform(CMMcargo, accum, output, PixelsPerLine, Stride->BytesPerPlaneIn);
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   711
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   712
              strideIn += Stride->BytesPerLineIn;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   713
              strideOut += Stride->BytesPerLineOut;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   714
       }
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   715
}
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   716
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   717
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   718
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   719
// Register new ways to transform
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   720
cmsBool  _cmsRegisterTransformPlugin(cmsContext ContextID, cmsPluginBase* Data)
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   721
{
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   722
    cmsPluginTransform* Plugin = (cmsPluginTransform*) Data;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   723
    _cmsTransformCollection* fl;
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   724
    _cmsTransformPluginChunkType* ctx = ( _cmsTransformPluginChunkType*) _cmsContextGetClientChunk(ContextID,TransformPlugin);
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   725
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   726
    if (Data == NULL) {
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   727
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   728
        // Free the chain. Memory is safely freed at exit
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   729
        ctx->TransformCollection = NULL;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   730
        return TRUE;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   731
    }
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   732
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   733
    // Factory callback is required
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   734
    if (Plugin->factories.xform == NULL) return FALSE;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   735
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   736
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   737
    fl = (_cmsTransformCollection*) _cmsPluginMalloc(ContextID, sizeof(_cmsTransformCollection));
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   738
    if (fl == NULL) return FALSE;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   739
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   740
    // Check for full xform plug-ins previous to 2.8, we would need an adapter in that case
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   741
    if (Plugin->base.ExpectedVersion < 2080) {
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   742
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   743
           fl->OldXform = TRUE;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   744
    }
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   745
    else
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   746
           fl->OldXform = FALSE;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   747
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   748
    // Copy the parameters
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   749
    fl->Factory = Plugin->factories.xform;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   750
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   751
    // Keep linked list
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   752
    fl ->Next = ctx->TransformCollection;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   753
    ctx->TransformCollection = fl;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   754
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   755
    // All is ok
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   756
    return TRUE;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   760
void CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   761
{
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   762
    _cmsAssert(CMMcargo != NULL);
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   763
    CMMcargo ->UserData = ptr;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   764
    CMMcargo ->FreeUserData = FreePrivateDataFn;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   765
}
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   766
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   767
// returns the pointer defined by the plug-in to store private data
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   768
void * CMSEXPORT _cmsGetTransformUserData(struct _cmstransform_struct *CMMcargo)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   769
{
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   770
    _cmsAssert(CMMcargo != NULL);
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   771
    return CMMcargo ->UserData;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   772
}
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   773
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   774
// returns the current formatters
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   775
void CMSEXPORT _cmsGetTransformFormatters16(struct _cmstransform_struct *CMMcargo, cmsFormatter16* FromInput, cmsFormatter16* ToOutput)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   776
{
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   777
     _cmsAssert(CMMcargo != NULL);
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   778
     if (FromInput) *FromInput = CMMcargo ->FromInput;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   779
     if (ToOutput)  *ToOutput  = CMMcargo ->ToOutput;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   780
}
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   781
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   782
void CMSEXPORT _cmsGetTransformFormattersFloat(struct _cmstransform_struct *CMMcargo, cmsFormatterFloat* FromInput, cmsFormatterFloat* ToOutput)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   783
{
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   784
     _cmsAssert(CMMcargo != NULL);
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   785
     if (FromInput) *FromInput = CMMcargo ->FromInputFloat;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   786
     if (ToOutput)  *ToOutput  = CMMcargo ->ToOutputFloat;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   787
}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   790
// Allocate transform struct and set it to defaults. Ask the optimization plug-in about if those formats are proper
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   791
// for separated transforms. If this is the case,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
static
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   793
_cmsTRANSFORM* AllocEmptyTransform(cmsContext ContextID, cmsPipeline* lut,
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   794
                                               cmsUInt32Number Intent, cmsUInt32Number* InputFormat, cmsUInt32Number* OutputFormat, cmsUInt32Number* dwFlags)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
{
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   796
     _cmsTransformPluginChunkType* ctx = ( _cmsTransformPluginChunkType*) _cmsContextGetClientChunk(ContextID, TransformPlugin);
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   797
     _cmsTransformCollection* Plugin;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   798
30491
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   799
       // Allocate needed memory
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   800
       _cmsTRANSFORM* p = (_cmsTRANSFORM*)_cmsMallocZero(ContextID, sizeof(_cmsTRANSFORM));
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   801
       if (!p) {
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   802
              cmsPipelineFree(lut);
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   803
              return NULL;
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   804
       }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
30491
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   806
       // Store the proposed pipeline
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   807
       p->Lut = lut;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   808
30491
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   809
       // Let's see if any plug-in want to do the transform by itself
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   810
       if (p->Lut != NULL) {
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   811
30491
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   812
              for (Plugin = ctx->TransformCollection;
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   813
                     Plugin != NULL;
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   814
                     Plugin = Plugin->Next) {
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   815
30491
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   816
                     if (Plugin->Factory(&p->xform, &p->UserData, &p->FreeUserData, &p->Lut, InputFormat, OutputFormat, dwFlags)) {
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   817
30491
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   818
                            // Last plugin in the declaration order takes control. We just keep
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   819
                            // the original parameters as a logging.
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   820
                            // Note that cmsFLAGS_CAN_CHANGE_FORMATTER is not set, so by default
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   821
                            // an optimized transform is not reusable. The plug-in can, however, change
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   822
                            // the flags and make it suitable.
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   823
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   824
                            p->ContextID = ContextID;
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   825
                            p->InputFormat = *InputFormat;
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   826
                            p->OutputFormat = *OutputFormat;
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   827
                            p->dwOriginalFlags = *dwFlags;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   828
30491
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   829
                            // Fill the formatters just in case the optimized routine is interested.
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   830
                            // No error is thrown if the formatter doesn't exist. It is up to the optimization
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   831
                            // factory to decide what to do in those cases.
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   832
                            p->FromInput = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   833
                            p->ToOutput = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   834
                            p->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat, cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   835
                            p->ToOutputFloat = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   836
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   837
                            // Save the day? (Ignore the warning)
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   838
                            if (Plugin->OldXform) {
53797
c1af89d9d44c 8215130: Fix errors in LittleCMS 2.9 reported by GCC 8
dchuyko
parents: 49775
diff changeset
   839
                                   p->OldXform = (_cmsTransformFn)(void*) p->xform;
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   840
                                   p->xform = _cmsTransform2toTransformAdaptor;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   841
                            }
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
   842
30491
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   843
                            return p;
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   844
                     }
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   845
              }
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   846
30491
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   847
              // Not suitable for the transform plug-in, let's check  the pipeline plug-in
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   848
              _cmsOptimizePipeline(ContextID, &p->Lut, Intent, InputFormat, OutputFormat, dwFlags);
ea1c291ee28f 8078331: Upgrade JDK to use LittleCMS 2.7
prr
parents: 26609
diff changeset
   849
       }
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   850
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   851
    // Check whatever this is a true floating point transform
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   852
    if (_cmsFormatterIsFloat(*InputFormat) && _cmsFormatterIsFloat(*OutputFormat)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   854
        // Get formatter function always return a valid union, but the contents of this union may be NULL.
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   855
        p ->FromInputFloat = _cmsGetFormatter(ContextID, *InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   856
        p ->ToOutputFloat  = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_FLOAT).FmtFloat;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   857
        *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   859
        if (p ->FromInputFloat == NULL || p ->ToOutputFloat == NULL) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   861
            cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format");
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   862
            cmsDeleteTransform(p);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   863
            return NULL;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   866
        if (*dwFlags & cmsFLAGS_NULLTRANSFORM) {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   867
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   868
            p ->xform = NullFloatXFORM;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   869
        }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   870
        else {
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   871
            // Float transforms don't use caché, always are non-NULL
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   872
            p ->xform = FloatXFORM;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   873
        }
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   874
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
    else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   878
        if (*InputFormat == 0 && *OutputFormat == 0) {
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   879
            p ->FromInput = p ->ToOutput = NULL;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   880
            *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   881
        }
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   882
        else {
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   883
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   884
            cmsUInt32Number BytesPerPixelInput;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   885
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   886
            p ->FromInput = _cmsGetFormatter(ContextID, *InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
   887
            p ->ToOutput  = _cmsGetFormatter(ContextID, *OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   889
            if (p ->FromInput == NULL || p ->ToOutput == NULL) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   891
                cmsSignalError(ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format");
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   892
                cmsDeleteTransform(p);
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   893
                return NULL;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   894
            }
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   895
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   896
            BytesPerPixelInput = T_BYTES(p ->InputFormat);
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   897
            if (BytesPerPixelInput == 0 || BytesPerPixelInput >= 2)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   898
                   *dwFlags |= cmsFLAGS_CAN_CHANGE_FORMATTER;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   899
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   902
        if (*dwFlags & cmsFLAGS_NULLTRANSFORM) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   904
            p ->xform = NullXFORM;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
        }
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   906
        else {
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   907
            if (*dwFlags & cmsFLAGS_NOCACHE) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   909
                if (*dwFlags & cmsFLAGS_GAMUTCHECK)
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   910
                    p ->xform = PrecalculatedXFORMGamutCheck;  // Gamut check, no caché
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   911
                else
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   912
                    p ->xform = PrecalculatedXFORM;  // No caché, no gamut check
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   913
            }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   914
            else {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   915
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   916
                if (*dwFlags & cmsFLAGS_GAMUTCHECK)
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   917
                    p ->xform = CachedXFORMGamutCheck;    // Gamut check, caché
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   918
                else
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   919
                    p ->xform = CachedXFORM;  // No gamut check, caché
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   920
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   921
            }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   922
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   925
    p ->InputFormat     = *InputFormat;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   926
    p ->OutputFormat    = *OutputFormat;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   927
    p ->dwOriginalFlags = *dwFlags;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   928
    p ->ContextID       = ContextID;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   929
    p ->UserData        = NULL;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   930
    return p;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   933
static
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   934
cmsBool GetXFormColorSpaces(cmsUInt32Number nProfiles, cmsHPROFILE hProfiles[], cmsColorSpaceSignature* Input, cmsColorSpaceSignature* Output)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
{
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   936
    cmsColorSpaceSignature ColorSpaceIn, ColorSpaceOut;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   937
    cmsColorSpaceSignature PostColorSpace;
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   938
    cmsUInt32Number i;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   940
    if (nProfiles == 0) return FALSE;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   941
    if (hProfiles[0] == NULL) return FALSE;
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
   942
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   943
    *Input = PostColorSpace = cmsGetColorSpace(hProfiles[0]);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
    for (i=0; i < nProfiles; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   947
        cmsProfileClassSignature cls;
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   948
        cmsHPROFILE hProfile = hProfiles[i];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   950
        int lIsInput = (PostColorSpace != cmsSigXYZData) &&
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   951
                       (PostColorSpace != cmsSigLabData);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   952
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   953
        if (hProfile == NULL) return FALSE;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   955
        cls = cmsGetDeviceClass(hProfile);
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   956
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   957
        if (cls == cmsSigNamedColorClass) {
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   958
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   959
            ColorSpaceIn    = cmsSig1colorData;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   960
            ColorSpaceOut   = (nProfiles > 1) ? cmsGetPCS(hProfile) : cmsGetColorSpace(hProfile);
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   961
        }
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   962
        else
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   963
        if (lIsInput || (cls == cmsSigLinkClass)) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
            ColorSpaceIn    = cmsGetColorSpace(hProfile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
            ColorSpaceOut   = cmsGetPCS(hProfile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
        }
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   968
        else
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   969
        {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
            ColorSpaceIn    = cmsGetPCS(hProfile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
            ColorSpaceOut   = cmsGetColorSpace(hProfile);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   974
        if (i==0)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   975
            *Input = ColorSpaceIn;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
   976
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   977
        PostColorSpace = ColorSpaceOut;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   978
    }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   979
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   980
    *Output = PostColorSpace;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   981
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   982
    return TRUE;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   983
}
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   984
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   985
// Check colorspace
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   986
static
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   987
cmsBool  IsProperColorSpace(cmsColorSpaceSignature Check, cmsUInt32Number dwFormat)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   988
{
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
   989
    int Space1 = (int) T_COLORSPACE(dwFormat);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   990
    int Space2 = _cmsLCMScolorSpace(Check);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   991
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   992
    if (Space1 == PT_ANY) return TRUE;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   993
    if (Space1 == Space2) return TRUE;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   994
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   995
    if (Space1 == PT_LabV2 && Space2 == PT_Lab) return TRUE;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   996
    if (Space1 == PT_Lab   && Space2 == PT_LabV2) return TRUE;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   997
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   998
    return FALSE;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
   999
}
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1000
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1001
// ----------------------------------------------------------------------------------------------------------------
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1003
// Jun-21-2000: Some profiles (those that comes with W2K) comes
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1004
// with the media white (media black?) x 100. Add a sanity check
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1005
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1006
static
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1007
void NormalizeXYZ(cmsCIEXYZ* Dest)
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1008
{
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1009
    while (Dest -> X > 2. &&
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1010
           Dest -> Y > 2. &&
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1011
           Dest -> Z > 2.) {
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1012
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1013
               Dest -> X /= 10.;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1014
               Dest -> Y /= 10.;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1015
               Dest -> Z /= 10.;
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1016
       }
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1017
}
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1018
23906
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1019
static
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1020
void SetWhitePoint(cmsCIEXYZ* wtPt, const cmsCIEXYZ* src)
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1021
{
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1022
    if (src == NULL) {
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1023
        wtPt ->X = cmsD50X;
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1024
        wtPt ->Y = cmsD50Y;
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1025
        wtPt ->Z = cmsD50Z;
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1026
    }
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1027
    else {
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1028
        wtPt ->X = src->X;
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1029
        wtPt ->Y = src->Y;
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1030
        wtPt ->Z = src->Z;
40152
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1031
35cbab101a76 8162488: JDK should be updated to use LittleCMS 2.8
prr
parents: 30491
diff changeset
  1032
        NormalizeXYZ(wtPt);
23906
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1033
    }
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1034
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1035
}
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1036
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1037
// New to lcms 2.0 -- have all parameters available.
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1038
cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1039
                                                   cmsUInt32Number nProfiles, cmsHPROFILE hProfiles[],
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1040
                                                   cmsBool  BPC[],
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1041
                                                   cmsUInt32Number Intents[],
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1042
                                                   cmsFloat64Number AdaptationStates[],
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1043
                                                   cmsHPROFILE hGamutProfile,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1044
                                                   cmsUInt32Number nGamutPCSposition,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1045
                                                   cmsUInt32Number InputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1046
                                                   cmsUInt32Number OutputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1047
                                                   cmsUInt32Number dwFlags)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1048
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1049
    _cmsTRANSFORM* xform;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1050
    cmsColorSpaceSignature EntryColorSpace;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1051
    cmsColorSpaceSignature ExitColorSpace;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1052
    cmsPipeline* Lut;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1053
    cmsUInt32Number LastIntent = Intents[nProfiles-1];
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1054
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1055
    // If it is a fake transform
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1056
    if (dwFlags & cmsFLAGS_NULLTRANSFORM)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1057
    {
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1058
        return AllocEmptyTransform(ContextID, NULL, INTENT_PERCEPTUAL, &InputFormat, &OutputFormat, &dwFlags);
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1059
    }
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1060
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1061
    // If gamut check is requested, make sure we have a gamut profile
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1062
    if (dwFlags & cmsFLAGS_GAMUTCHECK) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1063
        if (hGamutProfile == NULL) dwFlags &= ~cmsFLAGS_GAMUTCHECK;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1064
    }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1065
23906
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1066
    // On floating point transforms, inhibit cache
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1067
    if (_cmsFormatterIsFloat(InputFormat) || _cmsFormatterIsFloat(OutputFormat))
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1068
        dwFlags |= cmsFLAGS_NOCACHE;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1069
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1070
    // Mark entry/exit spaces
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1071
    if (!GetXFormColorSpaces(nProfiles, hProfiles, &EntryColorSpace, &ExitColorSpace)) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1072
        cmsSignalError(ContextID, cmsERROR_NULL, "NULL input profiles on transform");
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1073
        return NULL;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1074
    }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1075
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1076
    // Check if proper colorspaces
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1077
    if (!IsProperColorSpace(EntryColorSpace, InputFormat)) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1078
        cmsSignalError(ContextID, cmsERROR_COLORSPACE_CHECK, "Wrong input color space on transform");
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1079
        return NULL;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1080
    }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1081
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1082
    if (!IsProperColorSpace(ExitColorSpace, OutputFormat)) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1083
        cmsSignalError(ContextID, cmsERROR_COLORSPACE_CHECK, "Wrong output color space on transform");
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1084
        return NULL;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1085
    }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1086
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1087
    // Create a pipeline with all transformations
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1088
    Lut = _cmsLinkProfiles(ContextID, nProfiles, Intents, hProfiles, BPC, AdaptationStates, dwFlags);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1089
    if (Lut == NULL) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1090
        cmsSignalError(ContextID, cmsERROR_NOT_SUITABLE, "Couldn't link the profiles");
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1091
        return NULL;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1092
    }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1093
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1094
    // Check channel count
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1095
    if ((cmsChannelsOf(EntryColorSpace) != cmsPipelineInputChannels(Lut)) ||
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1096
        (cmsChannelsOf(ExitColorSpace)  != cmsPipelineOutputChannels(Lut))) {
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
  1097
        cmsPipelineFree(Lut);
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1098
        cmsSignalError(ContextID, cmsERROR_NOT_SUITABLE, "Channel count doesn't match. Profile is corrupted");
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1099
        return NULL;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1100
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1103
    // All seems ok
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1104
    xform = AllocEmptyTransform(ContextID, Lut, LastIntent, &InputFormat, &OutputFormat, &dwFlags);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1105
    if (xform == NULL) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1106
        return NULL;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1107
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1109
    // Keep values
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1110
    xform ->EntryColorSpace = EntryColorSpace;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1111
    xform ->ExitColorSpace  = ExitColorSpace;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1112
    xform ->RenderingIntent = Intents[nProfiles-1];
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1113
23906
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1114
    // Take white points
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1115
    SetWhitePoint(&xform->EntryWhitePoint, (cmsCIEXYZ*) cmsReadTag(hProfiles[0], cmsSigMediaWhitePointTag));
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1116
    SetWhitePoint(&xform->ExitWhitePoint,  (cmsCIEXYZ*) cmsReadTag(hProfiles[nProfiles-1], cmsSigMediaWhitePointTag));
8f7f9cb6fe11 8029750: Enhance LCMS color processing
prr
parents: 14300
diff changeset
  1117
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1119
    // Create a gamut check LUT if requested
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1120
    if (hGamutProfile != NULL && (dwFlags & cmsFLAGS_GAMUTCHECK))
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1121
        xform ->GamutCheck  = _cmsCreateGamutCheckPipeline(ContextID, hProfiles,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1122
                                                        BPC, Intents,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1123
                                                        AdaptationStates,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1124
                                                        nGamutPCSposition,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1125
                                                        hGamutProfile);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1128
    // Try to read input and output colorant table
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1129
    if (cmsIsTag(hProfiles[0], cmsSigColorantTableTag)) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1130
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1131
        // Input table can only come in this way.
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1132
        xform ->InputColorant = cmsDupNamedColorList((cmsNAMEDCOLORLIST*) cmsReadTag(hProfiles[0], cmsSigColorantTableTag));
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1133
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1135
    // Output is a little bit more complex.
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1136
    if (cmsGetDeviceClass(hProfiles[nProfiles-1]) == cmsSigLinkClass) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1137
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1138
        // This tag may exist only on devicelink profiles.
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1139
        if (cmsIsTag(hProfiles[nProfiles-1], cmsSigColorantTableOutTag)) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1140
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1141
            // It may be NULL if error
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1142
            xform ->OutputColorant = cmsDupNamedColorList((cmsNAMEDCOLORLIST*) cmsReadTag(hProfiles[nProfiles-1], cmsSigColorantTableOutTag));
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1143
        }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1144
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1145
    } else {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1147
        if (cmsIsTag(hProfiles[nProfiles-1], cmsSigColorantTableTag)) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1148
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1149
            xform -> OutputColorant = cmsDupNamedColorList((cmsNAMEDCOLORLIST*) cmsReadTag(hProfiles[nProfiles-1], cmsSigColorantTableTag));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
        }
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1151
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1153
    // Store the sequence of profiles
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1154
    if (dwFlags & cmsFLAGS_KEEP_SEQUENCE) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1155
        xform ->Sequence = _cmsCompileProfileSequence(ContextID, nProfiles, hProfiles);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1156
    }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1157
    else
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1158
        xform ->Sequence = NULL;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1160
    // If this is a cached transform, init first value, which is zero (16 bits only)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1161
    if (!(dwFlags & cmsFLAGS_NOCACHE)) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1162
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1163
        memset(&xform ->Cache.CacheIn, 0, sizeof(xform ->Cache.CacheIn));
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1164
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1165
        if (xform ->GamutCheck != NULL) {
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1166
            TransformOnePixelWithGamutCheck(xform, xform ->Cache.CacheIn, xform->Cache.CacheOut);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
        else {
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1169
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1170
            xform ->Lut ->Eval16Fn(xform ->Cache.CacheIn, xform->Cache.CacheOut, xform -> Lut->Data);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1175
    return (cmsHTRANSFORM) xform;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1176
}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1178
// Multiprofile transforms: Gamut check is not available here, as it is unclear from which profile the gamut comes.
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1179
cmsHTRANSFORM CMSEXPORT cmsCreateMultiprofileTransformTHR(cmsContext ContextID,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1180
                                                       cmsHPROFILE hProfiles[],
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1181
                                                       cmsUInt32Number nProfiles,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1182
                                                       cmsUInt32Number InputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1183
                                                       cmsUInt32Number OutputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1184
                                                       cmsUInt32Number Intent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1185
                                                       cmsUInt32Number dwFlags)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1186
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1187
    cmsUInt32Number i;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1188
    cmsBool BPC[256];
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1189
    cmsUInt32Number Intents[256];
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1190
    cmsFloat64Number AdaptationStates[256];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1192
    if (nProfiles <= 0 || nProfiles > 255) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1193
         cmsSignalError(ContextID, cmsERROR_RANGE, "Wrong number of profiles. 1..255 expected, %d found.", nProfiles);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1194
        return NULL;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1197
    for (i=0; i < nProfiles; i++) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1198
        BPC[i] = dwFlags & cmsFLAGS_BLACKPOINTCOMPENSATION ? TRUE : FALSE;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1199
        Intents[i] = Intent;
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
  1200
        AdaptationStates[i] = cmsSetAdaptationStateTHR(ContextID, -1);
2394
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
  1201
    }
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
  1202
404cbe399601 6821031: Upgrade OpenJDK's LittleCMS version to 1.18
prr
parents: 2
diff changeset
  1203
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1204
    return cmsCreateExtendedTransform(ContextID, nProfiles, hProfiles, BPC, Intents, AdaptationStates, NULL, 0, InputFormat, OutputFormat, dwFlags);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1209
cmsHTRANSFORM CMSEXPORT cmsCreateMultiprofileTransform(cmsHPROFILE hProfiles[],
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1210
                                                  cmsUInt32Number nProfiles,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1211
                                                  cmsUInt32Number InputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1212
                                                  cmsUInt32Number OutputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1213
                                                  cmsUInt32Number Intent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1214
                                                  cmsUInt32Number dwFlags)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
{
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1216
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1217
    if (nProfiles <= 0 || nProfiles > 255) {
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1218
         cmsSignalError(NULL, cmsERROR_RANGE, "Wrong number of profiles. 1..255 expected, %d found.", nProfiles);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1219
         return NULL;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1220
    }
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1221
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1222
    return cmsCreateMultiprofileTransformTHR(cmsGetProfileContextID(hProfiles[0]),
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1223
                                                  hProfiles,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1224
                                                  nProfiles,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1225
                                                  InputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1226
                                                  OutputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1227
                                                  Intent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1228
                                                  dwFlags);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1229
}
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1230
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1231
cmsHTRANSFORM CMSEXPORT cmsCreateTransformTHR(cmsContext ContextID,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1232
                                              cmsHPROFILE Input,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1233
                                              cmsUInt32Number InputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1234
                                              cmsHPROFILE Output,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1235
                                              cmsUInt32Number OutputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1236
                                              cmsUInt32Number Intent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1237
                                              cmsUInt32Number dwFlags)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1238
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1239
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1240
    cmsHPROFILE hArray[2];
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1241
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1242
    hArray[0] = Input;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1243
    hArray[1] = Output;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1244
49775
8fa5bb0cb937 8183032: Upgrade to LittleCMS 2.9
prr
parents: 47216
diff changeset
  1245
    return cmsCreateMultiprofileTransformTHR(ContextID, hArray, Output == NULL ? 1U : 2U, InputFormat, OutputFormat, Intent, dwFlags);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1246
}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1248
CMSAPI cmsHTRANSFORM CMSEXPORT cmsCreateTransform(cmsHPROFILE Input,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1249
                                                  cmsUInt32Number InputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1250
                                                  cmsHPROFILE Output,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1251
                                                  cmsUInt32Number OutputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1252
                                                  cmsUInt32Number Intent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1253
                                                  cmsUInt32Number dwFlags)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1254
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1255
    return cmsCreateTransformTHR(cmsGetProfileContextID(Input), Input, InputFormat, Output, OutputFormat, Intent, dwFlags);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1256
}
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1257
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1259
cmsHTRANSFORM CMSEXPORT cmsCreateProofingTransformTHR(cmsContext ContextID,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1260
                                                   cmsHPROFILE InputProfile,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1261
                                                   cmsUInt32Number InputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1262
                                                   cmsHPROFILE OutputProfile,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1263
                                                   cmsUInt32Number OutputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1264
                                                   cmsHPROFILE ProofingProfile,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1265
                                                   cmsUInt32Number nIntent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1266
                                                   cmsUInt32Number ProofingIntent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1267
                                                   cmsUInt32Number dwFlags)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1268
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1269
    cmsHPROFILE hArray[4];
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1270
    cmsUInt32Number Intents[4];
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1271
    cmsBool  BPC[4];
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1272
    cmsFloat64Number Adaptation[4];
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1273
    cmsBool  DoBPC = (dwFlags & cmsFLAGS_BLACKPOINTCOMPENSATION) ? TRUE : FALSE;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1274
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1275
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1276
    hArray[0]  = InputProfile; hArray[1] = ProofingProfile; hArray[2]  = ProofingProfile;               hArray[3] = OutputProfile;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1277
    Intents[0] = nIntent;      Intents[1] = nIntent;        Intents[2] = INTENT_RELATIVE_COLORIMETRIC;  Intents[3] = ProofingIntent;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1278
    BPC[0]     = DoBPC;        BPC[1] = DoBPC;              BPC[2] = 0;                                 BPC[3] = 0;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1279
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
  1280
    Adaptation[0] = Adaptation[1] = Adaptation[2] = Adaptation[3] = cmsSetAdaptationStateTHR(ContextID, -1);
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1281
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1282
    if (!(dwFlags & (cmsFLAGS_SOFTPROOFING|cmsFLAGS_GAMUTCHECK)))
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1283
        return cmsCreateTransformTHR(ContextID, InputProfile, InputFormat, OutputProfile, OutputFormat, nIntent, dwFlags);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1284
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1285
    return cmsCreateExtendedTransform(ContextID, 4, hArray, BPC, Intents, Adaptation,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1286
                                        ProofingProfile, 1, InputFormat, OutputFormat, dwFlags);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
}
6482
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1289
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1290
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1291
cmsHTRANSFORM CMSEXPORT cmsCreateProofingTransform(cmsHPROFILE InputProfile,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1292
                                                   cmsUInt32Number InputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1293
                                                   cmsHPROFILE OutputProfile,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1294
                                                   cmsUInt32Number OutputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1295
                                                   cmsHPROFILE ProofingProfile,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1296
                                                   cmsUInt32Number nIntent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1297
                                                   cmsUInt32Number ProofingIntent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1298
                                                   cmsUInt32Number dwFlags)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1299
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1300
    return cmsCreateProofingTransformTHR(cmsGetProfileContextID(InputProfile),
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1301
                                                   InputProfile,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1302
                                                   InputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1303
                                                   OutputProfile,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1304
                                                   OutputFormat,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1305
                                                   ProofingProfile,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1306
                                                   nIntent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1307
                                                   ProofingIntent,
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1308
                                                   dwFlags);
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1309
}
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1310
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1311
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1312
// Grab the ContextID from an open transform. Returns NULL if a NULL transform is passed
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1313
cmsContext CMSEXPORT cmsGetTransformContextID(cmsHTRANSFORM hTransform)
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1314
{
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1315
    _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1316
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1317
    if (xform == NULL) return NULL;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1318
    return xform -> ContextID;
0f6a4442b29e 6523398: OSS CMM: Need to implement writing ICC profile tags in new lcms library
bae
parents: 5506
diff changeset
  1319
}
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1320
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1321
// Grab the input/output formats
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1322
cmsUInt32Number CMSEXPORT cmsGetTransformInputFormat(cmsHTRANSFORM hTransform)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1323
{
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1324
    _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1325
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1326
    if (xform == NULL) return 0;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1327
    return xform->InputFormat;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1328
}
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1329
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1330
cmsUInt32Number CMSEXPORT cmsGetTransformOutputFormat(cmsHTRANSFORM hTransform)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1331
{
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1332
    _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1333
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1334
    if (xform == NULL) return 0;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1335
    return xform->OutputFormat;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1336
}
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1337
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1338
// For backwards compatibility
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1339
cmsBool CMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform,
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1340
                                         cmsUInt32Number InputFormat,
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1341
                                         cmsUInt32Number OutputFormat)
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1342
{
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1343
    _cmsTRANSFORM* xform = (_cmsTRANSFORM*) hTransform;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1344
    cmsFormatter16 FromInput, ToOutput;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1345
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1346
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1347
    // We only can afford to change formatters if previous transform is at least 16 bits
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1348
    if (!(xform ->dwOriginalFlags & cmsFLAGS_CAN_CHANGE_FORMATTER)) {
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1349
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1350
        cmsSignalError(xform ->ContextID, cmsERROR_NOT_SUITABLE, "cmsChangeBuffersFormat works only on transforms created originally with at least 16 bits of precision");
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1351
        return FALSE;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1352
    }
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1353
26609
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
  1354
    FromInput = _cmsGetFormatter(xform->ContextID, InputFormat,  cmsFormatterInput, CMS_PACK_FLAGS_16BITS).Fmt16;
de18f570018c 8056122: Upgrade JDK to use LittleCMS 2.6
prr
parents: 25859
diff changeset
  1355
    ToOutput  = _cmsGetFormatter(xform->ContextID, OutputFormat, cmsFormatterOutput, CMS_PACK_FLAGS_16BITS).Fmt16;
14300
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1356
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1357
    if (FromInput == NULL || ToOutput == NULL) {
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1358
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1359
        cmsSignalError(xform -> ContextID, cmsERROR_UNKNOWN_EXTENSION, "Unsupported raster format");
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1360
        return FALSE;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1361
    }
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1362
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1363
    xform ->InputFormat  = InputFormat;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1364
    xform ->OutputFormat = OutputFormat;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1365
    xform ->FromInput    = FromInput;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1366
    xform ->ToOutput     = ToOutput;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1367
    return TRUE;
117dc9b98a7b 7053526: Upgrade JDK 8 to use Little CMS 2.4
bae
parents: 6879
diff changeset
  1368
}