[poppler] [PATCH] Correctly manipulate spot colors if SPOT_NCOMPS != 4

Adam Reichold adam.reichold at t-online.de
Sat May 26 09:13:35 UTC 2018


Hello again,

Am 26.05.2018 um 10:55 schrieb Albert Astals Cid:
> I don't really understand the patch, are you saying something like "the code 
> is correct, if you change it wrong it will break"? That happens in lots of 
> places ;)

I guess the point is that the for loops should always start at i = 4
(since dest[0..3] are handly outside) and should always go until NCOMPS + 4.

The current code does this only if NCOMPS == 4 which is the default and
why this currently works. But if NCOMPS != 4, the current code breaks as
the for does not start with 4 anymore and leaves out dest[4..NCOMPS] and
this patch fixes this.

Best regards, Adam.

> But since this happens inside SPLASH_CMYK, and that's mostly Thomas baby, so 
> asking for his input (or anyone elses), at this point my vote is -0.25
> 
> Cheers,
>   Albert
> 
> El dissabte, 26 de maig de 2018, a les 2:47:13 CEST, Stefan BrĂ¼ns va escriure:
>> The default number of spot colors is 4, in this case the change is
>> without effect, otherwise only the last 4 colors where handled.
>> ---
>>  splash/SplashTypes.h | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/splash/SplashTypes.h b/splash/SplashTypes.h
>> index ca0e3bc0..2f65b5ba 100644
>> --- a/splash/SplashTypes.h
>> +++ b/splash/SplashTypes.h
>> @@ -126,7 +126,7 @@ static inline void splashClearColor(SplashColorPtr dest)
>> { dest[2] = 0;
>>  #ifdef SPLASH_CMYK
>>    dest[3] = 0;
>> -  for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++)
>> +  for (int i = 4; i < SPOT_NCOMPS + 4; i++)
>>      dest[i] = 0;
>>  #endif
>>  }
>> @@ -137,7 +137,7 @@ static inline void splashColorCopy(SplashColorPtr dest,
>> SplashColorPtr src) { dest[2] = src[2];
>>  #ifdef SPLASH_CMYK
>>    dest[3] = src[3];
>> -  for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++)
>> +  for (int i = 4; i < SPOT_NCOMPS + 4; i++)
>>      dest[i] = src[i];
>>  #endif
>>  }
>> @@ -148,7 +148,7 @@ static inline void splashColorXor(SplashColorPtr dest,
>> SplashColorPtr src) { dest[2] ^= src[2];
>>  #ifdef SPLASH_CMYK
>>    dest[3] ^= src[3];
>> -  for (int i = SPOT_NCOMPS; i < SPOT_NCOMPS + 4; i++)
>> +  for (int i = 4; i < SPOT_NCOMPS + 4; i++)
>>      dest[i] ^= src[i];
>>  #endif
>>  }
> 
> 
> 
> 
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/poppler
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/poppler/attachments/20180526/deaf1ae6/attachment.sig>


More information about the poppler mailing list