ector: correct implementation for color multiplication.

This commit is contained in:
Jose Gonzalez 2015-04-03 16:33:01 +02:00 committed by Cedric BAIL
parent f5fe46ec3c
commit 472f3a72ff
3 changed files with 15 additions and 0 deletions

View File

@ -40,6 +40,7 @@ lib_LTLIBRARIES += lib/ector/libector.la
installed_ectormainheadersdir = $(includedir)/ector-@VMAJ@
dist_installed_ectormainheaders_DATA = \
lib/ector/Ector.h \
lib/ector/ector_util.h \
lib/ector/cairo/Ector_Cairo.h \
lib/ector/software/Ector_Software.h

View File

@ -174,6 +174,7 @@ EAPI int ector_shutdown(void);
#include "ector_surface.h"
#include "ector_renderer.h"
#include "ector_util.h"
#endif

View File

@ -0,0 +1,13 @@
#ifndef ECTOR_UTIL_H
# define ECTOR_UTIL_H
static inline unsigned int
ector_color_multiply(unsigned int c1, unsigned int c2)
{
return ( ((((((c1) >> 16) & 0xff00) * (((c2) >> 16) & 0xff00)) + 0xff0000) & 0xff000000) +
((((((c1) >> 8) & 0xff00) * (((c2) >> 16) & 0xff)) + 0xff00) & 0xff0000) +
((((((c1) & 0xff00) * ((c2) & 0xff00)) + 0xff00) >> 16) & 0xff00) +
(((((c1) & 0xff) * ((c2) & 0xff)) + 0xff) >> 8) );
}
#endif