< prev index next >

src/java.desktop/share/native/liblcms/cmsvirt.c

Print this page




  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 // This file is available under and governed by the GNU General Public
  26 // License version 2 only, as published by the Free Software Foundation.
  27 // However, the following notice accompanied the original version of this
  28 // file:
  29 //
  30 //---------------------------------------------------------------------------------
  31 //
  32 //  Little Color Management System
  33 //  Copyright (c) 1998-2014 Marti Maria Saguer
  34 //
  35 // Permission is hereby granted, free of charge, to any person obtaining
  36 // a copy of this software and associated documentation files (the "Software"),
  37 // to deal in the Software without restriction, including without limitation
  38 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  39 // and/or sell copies of the Software, and to permit persons to whom the Software
  40 // is furnished to do so, subject to the following conditions:
  41 //
  42 // The above copyright notice and this permission notice shall be included in
  43 // all copies or substantial portions of the Software.
  44 //
  45 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  46 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  47 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  48 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  49 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  50 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  51 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  52 //
  53 //---------------------------------------------------------------------------------


1150      else
1151          DestinationTag = cmsSigAToB0Tag;
1152 
1153     // Check if the profile/version can store the result
1154     if (dwFlags & cmsFLAGS_FORCE_CLUT)
1155         AllowedLUT = NULL;
1156     else
1157         AllowedLUT = FindCombination(LUT, Version >= 4.0, DestinationTag);
1158 
1159     if (AllowedLUT == NULL) {
1160 
1161         // Try to optimize
1162         _cmsOptimizePipeline(ContextID, &LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags);
1163         AllowedLUT = FindCombination(LUT, Version >= 4.0, DestinationTag);
1164 
1165     }
1166 
1167     // If no way, then force CLUT that for sure can be written
1168     if (AllowedLUT == NULL) {
1169 



1170         dwFlags |= cmsFLAGS_FORCE_CLUT;
1171         _cmsOptimizePipeline(ContextID, &LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags);
1172 
1173         // Put identity curves if needed
1174         if (cmsPipelineGetPtrToFirstStage(LUT) ->Type != cmsSigCurveSetElemType)

1175              if (!cmsPipelineInsertStage(LUT, cmsAT_BEGIN, _cmsStageAllocIdentityCurves(ContextID, ChansIn)))
1176                  goto Error;
1177 
1178         if (cmsPipelineGetPtrToLastStage(LUT) ->Type != cmsSigCurveSetElemType)

1179              if (!cmsPipelineInsertStage(LUT, cmsAT_END,   _cmsStageAllocIdentityCurves(ContextID, ChansOut)))
1180                  goto Error;
1181 
1182         AllowedLUT = FindCombination(LUT, Version >= 4.0, DestinationTag);
1183     }
1184 
1185     // Somethings is wrong...
1186     if (AllowedLUT == NULL) {
1187         goto Error;
1188     }
1189 
1190 
1191     if (dwFlags & cmsFLAGS_8BITS_DEVICELINK)
1192                      cmsPipelineSetSaveAs8bitsFlag(LUT, TRUE);
1193 
1194     // Tag profile with information
1195     if (!SetTextTags(hProfile, L"devicelink")) goto Error;
1196 
1197     // Store result
1198     if (!cmsWriteTag(hProfile, DestinationTag, LUT)) goto Error;




  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 // This file is available under and governed by the GNU General Public
  26 // License version 2 only, as published by the Free Software Foundation.
  27 // However, the following notice accompanied the original version of this
  28 // file:
  29 //
  30 //---------------------------------------------------------------------------------
  31 //
  32 //  Little Color Management System
  33 //  Copyright (c) 1998-2016 Marti Maria Saguer
  34 //
  35 // Permission is hereby granted, free of charge, to any person obtaining
  36 // a copy of this software and associated documentation files (the "Software"),
  37 // to deal in the Software without restriction, including without limitation
  38 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  39 // and/or sell copies of the Software, and to permit persons to whom the Software
  40 // is furnished to do so, subject to the following conditions:
  41 //
  42 // The above copyright notice and this permission notice shall be included in
  43 // all copies or substantial portions of the Software.
  44 //
  45 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  46 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  47 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  48 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  49 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  50 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  51 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  52 //
  53 //---------------------------------------------------------------------------------


1150      else
1151          DestinationTag = cmsSigAToB0Tag;
1152 
1153     // Check if the profile/version can store the result
1154     if (dwFlags & cmsFLAGS_FORCE_CLUT)
1155         AllowedLUT = NULL;
1156     else
1157         AllowedLUT = FindCombination(LUT, Version >= 4.0, DestinationTag);
1158 
1159     if (AllowedLUT == NULL) {
1160 
1161         // Try to optimize
1162         _cmsOptimizePipeline(ContextID, &LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags);
1163         AllowedLUT = FindCombination(LUT, Version >= 4.0, DestinationTag);
1164 
1165     }
1166 
1167     // If no way, then force CLUT that for sure can be written
1168     if (AllowedLUT == NULL) {
1169 
1170         cmsStage* FirstStage;
1171         cmsStage* LastStage;
1172 
1173         dwFlags |= cmsFLAGS_FORCE_CLUT;
1174         _cmsOptimizePipeline(ContextID, &LUT, xform ->RenderingIntent, &FrmIn, &FrmOut, &dwFlags);
1175 
1176         // Put identity curves if needed
1177         FirstStage = cmsPipelineGetPtrToFirstStage(LUT);
1178         if (FirstStage != NULL && FirstStage ->Type != cmsSigCurveSetElemType)
1179              if (!cmsPipelineInsertStage(LUT, cmsAT_BEGIN, _cmsStageAllocIdentityCurves(ContextID, ChansIn)))
1180                  goto Error;
1181 
1182         LastStage = cmsPipelineGetPtrToLastStage(LUT);
1183         if (LastStage != NULL && LastStage ->Type != cmsSigCurveSetElemType)
1184              if (!cmsPipelineInsertStage(LUT, cmsAT_END,   _cmsStageAllocIdentityCurves(ContextID, ChansOut)))
1185                  goto Error;
1186 
1187         AllowedLUT = FindCombination(LUT, Version >= 4.0, DestinationTag);
1188     }
1189 
1190     // Somethings is wrong...
1191     if (AllowedLUT == NULL) {
1192         goto Error;
1193     }
1194 
1195 
1196     if (dwFlags & cmsFLAGS_8BITS_DEVICELINK)
1197                      cmsPipelineSetSaveAs8bitsFlag(LUT, TRUE);
1198 
1199     // Tag profile with information
1200     if (!SetTextTags(hProfile, L"devicelink")) goto Error;
1201 
1202     // Store result
1203     if (!cmsWriteTag(hProfile, DestinationTag, LUT)) goto Error;


< prev index next >