1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

Fixed the mdgradient code.

P.S. Please, that piece of code is perfectly valid, there's no need to
break it every month. There is nothing wrong with it, still it was
changed (and simultaneously broken) 4 or 5 times already.
That code use a smart trick to draw the multi diagonal gradient using
integer operations, that is perfectly valid and moreover is much faster
than the classical floating point calculation algorithm that was used
before, so there is no need to randomly 'fix' it every now and then.
If you don't understand how it works please ask.
This commit is contained in:
dan
2000-05-24 22:47:54 +00:00
parent 3e0c6920a9
commit 56cacb9336

View File

@@ -478,8 +478,8 @@ renderMDGradient(unsigned width, unsigned height, RColor **colors, int count)
width = width * 3; width = width * 3;
/* copy the first line to the other lines with corresponding offset */ /* copy the first line to the other lines with corresponding offset */
for (offset=0; j<width*height; j += width) { for (j=0, offset=0; j<width*height; j += width) {
memcpy(&(image->data[0]), &ptr[3*(int)offset], width); memcpy(&(image->data[j]), &ptr[3*(int)offset], width);
offset += a; offset += a;
} }
RDestroyImage(tmp); RDestroyImage(tmp);