[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Re: KoColor && CMYK -> RGB
From:       Kevin Krammer <kevin.krammer () gmx ! at>
Date:       2003-10-23 22:50:58
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


On Friday 24 October 2003 00:11, Boudewijn Rempt wrote:
> void KoColor::RGBtoCMYK(int R, int G, int B, int *C, int *M, int *Y,
> int *K) {
>     *C = 255 - R;
>     *M = 255 - G;
>     *Y = 255 - B;
>
>     int min = (*C < *M) ? *C : *M;
>     *K = (min < *Y) ? min : *Y;
>
>     *C = *C - *K;
>     *M = *M - *K;
>     *Y = *Y - *K;
> }

Wouldn't it be better to either check if the pointers are != 0 or use int& 
instead of int*?

As it seems you need all four parameters anyway, I think int& would be 
better.
Also makes the code easier to read, no explizit derefencing needed.

Cheers,
Kevin

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Krammer <kevin.krammer@gmx.at>
Developer at the Kmud Project http://www.kmud.de/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[Attachment #5 (application/pgp-signature)]

_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic