Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | #ifndef QCMS_H |
michael@0 | 2 | #define QCMS_H |
michael@0 | 3 | |
michael@0 | 4 | #ifdef __cplusplus |
michael@0 | 5 | extern "C" { |
michael@0 | 6 | #endif |
michael@0 | 7 | |
michael@0 | 8 | /* if we've already got an ICC_H header we can ignore the following */ |
michael@0 | 9 | #ifndef ICC_H |
michael@0 | 10 | /* icc34 defines */ |
michael@0 | 11 | |
michael@0 | 12 | /***************************************************************** |
michael@0 | 13 | Copyright (c) 1994-1996 SunSoft, Inc. |
michael@0 | 14 | |
michael@0 | 15 | Rights Reserved |
michael@0 | 16 | |
michael@0 | 17 | Permission is hereby granted, free of charge, to any person |
michael@0 | 18 | obtaining a copy of this software and associated documentation |
michael@0 | 19 | files (the "Software"), to deal in the Software without restrict- |
michael@0 | 20 | ion, including without limitation the rights to use, copy, modify, |
michael@0 | 21 | merge, publish distribute, sublicense, and/or sell copies of the |
michael@0 | 22 | Software, and to permit persons to whom the Software is furnished |
michael@0 | 23 | to do so, subject to the following conditions: |
michael@0 | 24 | |
michael@0 | 25 | The above copyright notice and this permission notice shall be |
michael@0 | 26 | included in all copies or substantial portions of the Software. |
michael@0 | 27 | |
michael@0 | 28 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
michael@0 | 29 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
michael@0 | 30 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON- |
michael@0 | 31 | INFRINGEMENT. IN NO EVENT SHALL SUNSOFT, INC. OR ITS PARENT |
michael@0 | 32 | COMPANY BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
michael@0 | 33 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
michael@0 | 34 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
michael@0 | 35 | OTHER DEALINGS IN THE SOFTWARE. |
michael@0 | 36 | |
michael@0 | 37 | Except as contained in this notice, the name of SunSoft, Inc. |
michael@0 | 38 | shall not be used in advertising or otherwise to promote the |
michael@0 | 39 | sale, use or other dealings in this Software without written |
michael@0 | 40 | authorization from SunSoft Inc. |
michael@0 | 41 | ******************************************************************/ |
michael@0 | 42 | |
michael@0 | 43 | /* |
michael@0 | 44 | * QCMS, in general, is not threadsafe. However, it should be safe to create |
michael@0 | 45 | * profile and transformation objects on different threads, so long as you |
michael@0 | 46 | * don't use the same objects on different threads at the same time. |
michael@0 | 47 | */ |
michael@0 | 48 | |
michael@0 | 49 | /* |
michael@0 | 50 | * Color Space Signatures |
michael@0 | 51 | * Note that only icSigXYZData and icSigLabData are valid |
michael@0 | 52 | * Profile Connection Spaces (PCSs) |
michael@0 | 53 | */ |
michael@0 | 54 | typedef enum { |
michael@0 | 55 | icSigXYZData = 0x58595A20L, /* 'XYZ ' */ |
michael@0 | 56 | icSigLabData = 0x4C616220L, /* 'Lab ' */ |
michael@0 | 57 | icSigLuvData = 0x4C757620L, /* 'Luv ' */ |
michael@0 | 58 | icSigYCbCrData = 0x59436272L, /* 'YCbr' */ |
michael@0 | 59 | icSigYxyData = 0x59787920L, /* 'Yxy ' */ |
michael@0 | 60 | icSigRgbData = 0x52474220L, /* 'RGB ' */ |
michael@0 | 61 | icSigGrayData = 0x47524159L, /* 'GRAY' */ |
michael@0 | 62 | icSigHsvData = 0x48535620L, /* 'HSV ' */ |
michael@0 | 63 | icSigHlsData = 0x484C5320L, /* 'HLS ' */ |
michael@0 | 64 | icSigCmykData = 0x434D594BL, /* 'CMYK' */ |
michael@0 | 65 | icSigCmyData = 0x434D5920L, /* 'CMY ' */ |
michael@0 | 66 | icSig2colorData = 0x32434C52L, /* '2CLR' */ |
michael@0 | 67 | icSig3colorData = 0x33434C52L, /* '3CLR' */ |
michael@0 | 68 | icSig4colorData = 0x34434C52L, /* '4CLR' */ |
michael@0 | 69 | icSig5colorData = 0x35434C52L, /* '5CLR' */ |
michael@0 | 70 | icSig6colorData = 0x36434C52L, /* '6CLR' */ |
michael@0 | 71 | icSig7colorData = 0x37434C52L, /* '7CLR' */ |
michael@0 | 72 | icSig8colorData = 0x38434C52L, /* '8CLR' */ |
michael@0 | 73 | icSig9colorData = 0x39434C52L, /* '9CLR' */ |
michael@0 | 74 | icSig10colorData = 0x41434C52L, /* 'ACLR' */ |
michael@0 | 75 | icSig11colorData = 0x42434C52L, /* 'BCLR' */ |
michael@0 | 76 | icSig12colorData = 0x43434C52L, /* 'CCLR' */ |
michael@0 | 77 | icSig13colorData = 0x44434C52L, /* 'DCLR' */ |
michael@0 | 78 | icSig14colorData = 0x45434C52L, /* 'ECLR' */ |
michael@0 | 79 | icSig15colorData = 0x46434C52L, /* 'FCLR' */ |
michael@0 | 80 | icMaxEnumData = 0xFFFFFFFFL |
michael@0 | 81 | } icColorSpaceSignature; |
michael@0 | 82 | #endif |
michael@0 | 83 | |
michael@0 | 84 | #include <stdio.h> |
michael@0 | 85 | |
michael@0 | 86 | typedef int qcms_bool; |
michael@0 | 87 | |
michael@0 | 88 | struct _qcms_transform; |
michael@0 | 89 | typedef struct _qcms_transform qcms_transform; |
michael@0 | 90 | |
michael@0 | 91 | struct _qcms_profile; |
michael@0 | 92 | typedef struct _qcms_profile qcms_profile; |
michael@0 | 93 | |
michael@0 | 94 | /* these values match the Rendering Intent values from the ICC spec */ |
michael@0 | 95 | typedef enum { |
michael@0 | 96 | QCMS_INTENT_MIN = 0, |
michael@0 | 97 | QCMS_INTENT_PERCEPTUAL = 0, |
michael@0 | 98 | QCMS_INTENT_RELATIVE_COLORIMETRIC = 1, |
michael@0 | 99 | QCMS_INTENT_SATURATION = 2, |
michael@0 | 100 | QCMS_INTENT_ABSOLUTE_COLORIMETRIC = 3, |
michael@0 | 101 | QCMS_INTENT_MAX = 3, |
michael@0 | 102 | |
michael@0 | 103 | /* Chris Murphy (CM consultant) suggests this as a default in the event that we |
michael@0 | 104 | * cannot reproduce relative + Black Point Compensation. BPC brings an |
michael@0 | 105 | * unacceptable performance overhead, so we go with perceptual. */ |
michael@0 | 106 | QCMS_INTENT_DEFAULT = QCMS_INTENT_PERCEPTUAL, |
michael@0 | 107 | } qcms_intent; |
michael@0 | 108 | |
michael@0 | 109 | //XXX: I don't really like the _DATA_ prefix |
michael@0 | 110 | typedef enum { |
michael@0 | 111 | QCMS_DATA_RGB_8, |
michael@0 | 112 | QCMS_DATA_RGBA_8, |
michael@0 | 113 | QCMS_DATA_GRAY_8, |
michael@0 | 114 | QCMS_DATA_GRAYA_8 |
michael@0 | 115 | } qcms_data_type; |
michael@0 | 116 | |
michael@0 | 117 | /* the names for the following two types are sort of ugly */ |
michael@0 | 118 | typedef struct |
michael@0 | 119 | { |
michael@0 | 120 | double x; |
michael@0 | 121 | double y; |
michael@0 | 122 | double Y; |
michael@0 | 123 | } qcms_CIE_xyY; |
michael@0 | 124 | |
michael@0 | 125 | typedef struct |
michael@0 | 126 | { |
michael@0 | 127 | qcms_CIE_xyY red; |
michael@0 | 128 | qcms_CIE_xyY green; |
michael@0 | 129 | qcms_CIE_xyY blue; |
michael@0 | 130 | } qcms_CIE_xyYTRIPLE; |
michael@0 | 131 | |
michael@0 | 132 | qcms_profile* qcms_profile_create_rgb_with_gamma( |
michael@0 | 133 | qcms_CIE_xyY white_point, |
michael@0 | 134 | qcms_CIE_xyYTRIPLE primaries, |
michael@0 | 135 | float gamma); |
michael@0 | 136 | |
michael@0 | 137 | void qcms_data_create_rgb_with_gamma( |
michael@0 | 138 | qcms_CIE_xyY white_point, |
michael@0 | 139 | qcms_CIE_xyYTRIPLE primaries, |
michael@0 | 140 | float gamma, |
michael@0 | 141 | void **mem, |
michael@0 | 142 | size_t *size); |
michael@0 | 143 | |
michael@0 | 144 | qcms_profile* qcms_profile_from_memory(const void *mem, size_t size); |
michael@0 | 145 | |
michael@0 | 146 | qcms_profile* qcms_profile_from_file(FILE *file); |
michael@0 | 147 | qcms_profile* qcms_profile_from_path(const char *path); |
michael@0 | 148 | |
michael@0 | 149 | void qcms_data_from_path(const char *path, void **mem, size_t *size); |
michael@0 | 150 | |
michael@0 | 151 | #ifdef _WIN32 |
michael@0 | 152 | qcms_profile* qcms_profile_from_unicode_path(const wchar_t *path); |
michael@0 | 153 | void qcms_data_from_unicode_path(const wchar_t *path, void **mem, size_t *size); |
michael@0 | 154 | #endif |
michael@0 | 155 | qcms_profile* qcms_profile_sRGB(void); |
michael@0 | 156 | void qcms_profile_release(qcms_profile *profile); |
michael@0 | 157 | |
michael@0 | 158 | qcms_bool qcms_profile_is_bogus(qcms_profile *profile); |
michael@0 | 159 | qcms_intent qcms_profile_get_rendering_intent(qcms_profile *profile); |
michael@0 | 160 | icColorSpaceSignature qcms_profile_get_color_space(qcms_profile *profile); |
michael@0 | 161 | |
michael@0 | 162 | void qcms_profile_precache_output_transform(qcms_profile *profile); |
michael@0 | 163 | |
michael@0 | 164 | qcms_transform* qcms_transform_create( |
michael@0 | 165 | qcms_profile *in, qcms_data_type in_type, |
michael@0 | 166 | qcms_profile* out, qcms_data_type out_type, |
michael@0 | 167 | qcms_intent intent); |
michael@0 | 168 | |
michael@0 | 169 | void qcms_transform_release(qcms_transform *); |
michael@0 | 170 | |
michael@0 | 171 | void qcms_transform_data(qcms_transform *transform, void *src, void *dest, size_t length); |
michael@0 | 172 | |
michael@0 | 173 | void qcms_enable_iccv4(); |
michael@0 | 174 | |
michael@0 | 175 | #ifdef __cplusplus |
michael@0 | 176 | } |
michael@0 | 177 | #endif |
michael@0 | 178 | |
michael@0 | 179 | #endif |