summaryrefslogtreecommitdiff
path: root/third_party/lcms/src/lcms2_internal.h
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-08-14 10:36:01 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-08-14 15:02:17 +0000
commit0bd847232a1f430c70dd9d8df177ce68a3cde010 (patch)
tree15cec8c11493549f1974ae2f6aeac58234c176d2 /third_party/lcms/src/lcms2_internal.h
parentdff02cee2d2410d81a55c59345fb38b5aac8a457 (diff)
downloadpdfium-0bd847232a1f430c70dd9d8df177ce68a3cde010.tar.xz
LCMS: upgrade to 2.8
This CL upgrades LCMS from version 2.6 to 2.8. All changes from LCMS original version 2.8 are stored in patch files: - Patch 0: memory management modifications to use PDFium methods. This was previously not in any patch, so the changes were manually applied. - Patches 1-5: new patch files corresponding to old changes that can be seen in the history, but did not previously have patch files. - Patches 6-25: previous patches (patch numbers shifted by 6). The one for from16-to-8-overflow.patch was deleted as it was already upstream. Some patches did not apply cleanly so their .patch files were modified. - Patch 26: as I just moved files directly, unsupported characters were moved in unchanged, so I had to fix all of them: e with tilde and other characters were replaced to allow compilation on Windows. - Patch 27: Went over the code and re-applied changes that included comments clearly indicating this was Foxit. These changes are all already seen in the initial PDFium commit. Change-Id: Ic1d84e54803ef9e6b280ef7619bbf0b757312fbf Reviewed-on: https://pdfium-review.googlesource.com/10590 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'third_party/lcms/src/lcms2_internal.h')
-rw-r--r--third_party/lcms/src/lcms2_internal.h63
1 files changed, 44 insertions, 19 deletions
diff --git a/third_party/lcms/src/lcms2_internal.h b/third_party/lcms/src/lcms2_internal.h
index 1dedf16b8d..115ac59701 100644
--- a/third_party/lcms/src/lcms2_internal.h
+++ b/third_party/lcms/src/lcms2_internal.h
@@ -1,8 +1,7 @@
-//<<<+++OPENSOURCE
-//<<<+++OPENSOURCE_MUST_BEGIN COMMENT==TRUE
+
//
// Little Color Management System
-// Copyright (c) 1998-2014 Marti Maria Saguer
+// Copyright (c) 1998-2016 Marti Maria Saguer
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the "Software"),
@@ -29,7 +28,7 @@
// Include plug-in foundation
#ifndef _lcms_plugin_H
-#include "third_party/lcms/include/lcms2_plugin.h"
+# include "third_party/lcms/include/lcms2_plugin.h"
#endif
// ctype is part of C99 as per 7.1.2
@@ -58,7 +57,15 @@
#define _cmsALIGNLONG(x) (((x)+(sizeof(cmsUInt32Number)-1)) & ~(sizeof(cmsUInt32Number)-1))
// Alignment to memory pointer
-#define _cmsALIGNMEM(x) (((x)+(sizeof(void *) - 1)) & ~(sizeof(void *) - 1))
+
+// (Ultra)SPARC with gcc requires ptr alignment of 8 bytes
+// even though sizeof(void *) is only four: for greatest flexibility
+// allow the build to specify ptr alignment.
+#ifndef CMS_PTR_ALIGNMENT
+# define CMS_PTR_ALIGNMENT sizeof(void *)
+#endif
+
+#define _cmsALIGNMEM(x) (((x)+(CMS_PTR_ALIGNMENT - 1)) & ~(CMS_PTR_ALIGNMENT - 1))
// Maximum encodeable values in floating point
#define MAX_ENCODEABLE_XYZ (1.0 + 32767.0/32768.0)
@@ -195,11 +202,17 @@ cmsINLINE cmsUInt16Number _cmsQuickSaturateWord(cmsFloat64Number d)
// Microsoft felt that it was necessary to keep it set at -1 for an unlocked critical
// section, even when they changed the underlying algorithm to be more scalable.
// The final parts of the critical section object are unimportant, and can be set
-// to zero for their defaults. This yields an initialization macro:
+// to zero for their defaults. This yields to an initialization macro:
typedef CRITICAL_SECTION _cmsMutex;
-#define CMS_MUTEX_INITIALIZER {(void*) -1,-1,0,0,0,0}
+#define CMS_MUTEX_INITIALIZER {(PRTL_CRITICAL_SECTION_DEBUG) -1,-1,0,0,0,0}
+
+#ifdef _MSC_VER
+# if (_MSC_VER >= 1800)
+# pragma warning(disable : 26135)
+# endif
+#endif
cmsINLINE int _cmsLockPrimitive(_cmsMutex *m)
{
@@ -285,38 +298,38 @@ typedef int _cmsMutex;
cmsINLINE int _cmsLockPrimitive(_cmsMutex *m)
{
- return 0;
cmsUNUSED_PARAMETER(m);
+ return 0;
}
cmsINLINE int _cmsUnlockPrimitive(_cmsMutex *m)
{
- return 0;
cmsUNUSED_PARAMETER(m);
+ return 0;
}
cmsINLINE int _cmsInitMutexPrimitive(_cmsMutex *m)
{
- return 0;
cmsUNUSED_PARAMETER(m);
+ return 0;
}
cmsINLINE int _cmsDestroyMutexPrimitive(_cmsMutex *m)
{
- return 0;
cmsUNUSED_PARAMETER(m);
+ return 0;
}
cmsINLINE int _cmsEnterCriticalSectionPrimitive(_cmsMutex *m)
{
- return 0;
cmsUNUSED_PARAMETER(m);
+ return 0;
}
cmsINLINE int _cmsLeaveCriticalSectionPrimitive(_cmsMutex *m)
{
- return 0;
cmsUNUSED_PARAMETER(m);
+ return 0;
}
#endif
@@ -657,8 +670,8 @@ struct _cms_MLU_struct {
cmsContext ContextID;
// The directory
- int AllocatedEntries;
- int UsedEntries;
+ cmsUInt32Number AllocatedEntries;
+ cmsUInt32Number UsedEntries;
_cmsMLUentry* Entries; // Array of pointers to strings allocated in MemPool
// The Pool
@@ -726,7 +739,7 @@ typedef struct _cms_iccprofile_struct {
// Dictionary
cmsUInt32Number TagCount;
cmsTagSignature TagNames[MAX_TABLE_TAG];
- cmsTagSignature TagLinked[MAX_TABLE_TAG]; // The tag to wich is linked (0=none)
+ cmsTagSignature TagLinked[MAX_TABLE_TAG]; // The tag to which is linked (0=none)
cmsUInt32Number TagSizes[MAX_TABLE_TAG]; // Size on disk
cmsUInt32Number TagOffsets[MAX_TABLE_TAG];
cmsBool TagSaveAsRaw[MAX_TABLE_TAG]; // True to write uncooked
@@ -824,6 +837,8 @@ cmsStage* _cmsStageNormalizeFromLabFloat(cmsContext ContextID);
cmsStage* _cmsStageNormalizeFromXyzFloat(cmsContext ContextID);
cmsStage* _cmsStageNormalizeToLabFloat(cmsContext ContextID);
cmsStage* _cmsStageNormalizeToXyzFloat(cmsContext ContextID);
+cmsStage* _cmsStageClipNegatives(cmsContext ContextID, int nChannels);
+
// For curve set only
cmsToneCurve** _cmsStageGetPtrToCurveSet(const cmsStage* mpe);
@@ -952,7 +967,7 @@ typedef struct _cmstransform_struct {
cmsUInt32Number InputFormat, OutputFormat; // Keep formats for further reference
// Points to transform code
- _cmsTransformFn xform;
+ _cmsTransform2Fn xform;
// Formatters, cannot be embedded into LUT because cache
cmsFormatter16 FromInput;
@@ -998,9 +1013,20 @@ typedef struct _cmstransform_struct {
void* UserData;
_cmsFreeUserDataFn FreeUserData;
+ // A way to provide backwards compatibility with full xform plugins
+ _cmsTransformFn OldXform;
+
} _cmsTRANSFORM;
-// --------------------------------------------------------------------------------------------------
+// Copies extra channels from input to output if the original flags in the transform structure
+// instructs to do so. This function is called on all standard transform functions.
+void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
+ void* out,
+ cmsUInt32Number PixelsPerLine,
+ cmsUInt32Number LineCount,
+ const cmsStride* Stride);
+
+// -----------------------------------------------------------------------------------------------------------------------
cmsHTRANSFORM _cmsChain2Lab(cmsContext ContextID,
cmsUInt32Number nProfiles,
@@ -1029,4 +1055,3 @@ cmsBool _cmsBuildRGB2XYZtransferMatrix(cmsMAT3* r, const cmsCIExyY* WhitePoint
#define _lcms_internal_H
#endif
-//<<<+++OPENSOURCE_MUST_END