mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +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:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user