OLD | NEW |
1 //------------------------------------------------------------------------------
--- | 1 //------------------------------------------------------------------------------
--- |
2 // | 2 // |
3 // Little Color Management System | 3 // Little Color Management System |
4 // Copyright (c) 1998-2014 Marti Maria Saguer | 4 // Copyright (c) 1998-2014 Marti Maria Saguer |
5 // | 5 // |
6 // Permission is hereby granted, free of charge, to any person obtaining | 6 // Permission is hereby granted, free of charge, to any person obtaining |
7 // a copy of this software and associated documentation files (the "Software"), | 7 // a copy of this software and associated documentation files (the "Software"), |
8 // to deal in the Software without restriction, including without limitation | 8 // to deal in the Software without restriction, including without limitation |
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, | 9 // the rights to use, copy, modify, merge, publish, distribute, sublicense, |
10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e | 10 // and/or sell copies of the Software, and to permit persons to whom the Softwar
e |
(...skipping 4279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4290 if (!_cmsReadUInt16Number(io, &OutputChans)) return NULL; | 4290 if (!_cmsReadUInt16Number(io, &OutputChans)) return NULL; |
4291 | 4291 |
4292 if (InputChans == 0) goto Error; | 4292 if (InputChans == 0) goto Error; |
4293 if (OutputChans == 0) goto Error; | 4293 if (OutputChans == 0) goto Error; |
4294 | 4294 |
4295 if (io ->Read(io, Dimensions8, sizeof(cmsUInt8Number), 16) != 16) | 4295 if (io ->Read(io, Dimensions8, sizeof(cmsUInt8Number), 16) != 16) |
4296 goto Error; | 4296 goto Error; |
4297 | 4297 |
4298 // Copy MAX_INPUT_DIMENSIONS at most. Expand to cmsUInt32Number | 4298 // Copy MAX_INPUT_DIMENSIONS at most. Expand to cmsUInt32Number |
4299 nMaxGrids = InputChans > MAX_INPUT_DIMENSIONS ? MAX_INPUT_DIMENSIONS : Input
Chans; | 4299 nMaxGrids = InputChans > MAX_INPUT_DIMENSIONS ? MAX_INPUT_DIMENSIONS : Input
Chans; |
4300 for (i=0; i < nMaxGrids; i++) GridPoints[i] = (cmsUInt32Number) Dimensions8[
i]; | |
4301 | 4300 |
| 4301 for (i = 0; i < nMaxGrids; i++) { |
| 4302 if (Dimensions8[i] == 1) goto Error; // Impossible value, 0 for no CLUT
and then 2 at least |
| 4303 GridPoints[i] = (cmsUInt32Number)Dimensions8[i]; |
| 4304 } |
| 4305 |
4302 // Allocate the true CLUT | 4306 // Allocate the true CLUT |
4303 mpe = cmsStageAllocCLutFloatGranular(self ->ContextID, GridPoints, InputChan
s, OutputChans, NULL); | 4307 mpe = cmsStageAllocCLutFloatGranular(self ->ContextID, GridPoints, InputChan
s, OutputChans, NULL); |
4304 if (mpe == NULL) goto Error; | 4308 if (mpe == NULL) goto Error; |
4305 | 4309 |
4306 // Read the data | 4310 // Read the data |
4307 clut = (_cmsStageCLutData*) mpe ->Data; | 4311 clut = (_cmsStageCLutData*) mpe ->Data; |
4308 for (i=0; i < clut ->nEntries; i++) { | 4312 for (i=0; i < clut ->nEntries; i++) { |
4309 | 4313 |
4310 if (!_cmsReadFloat32Number(io, &clut ->Tab.TFloat[i])) goto Error; | 4314 if (!_cmsReadFloat32Number(io, &clut ->Tab.TFloat[i])) goto Error; |
4311 } | 4315 } |
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5575 | 5579 |
5576 for (pt = SupportedTags; | 5580 for (pt = SupportedTags; |
5577 pt != NULL; | 5581 pt != NULL; |
5578 pt = pt ->Next) { | 5582 pt = pt ->Next) { |
5579 | 5583 |
5580 if (sig == pt -> Signature) return &pt ->Descriptor; | 5584 if (sig == pt -> Signature) return &pt ->Descriptor; |
5581 } | 5585 } |
5582 | 5586 |
5583 return NULL; | 5587 return NULL; |
5584 } | 5588 } |
OLD | NEW |