Optimization for pixel loop.

As per erco's comments on fltk.coredev, Mar 21 2021
in thread Subject: Re: 1.4 build failing on OSX for me
This commit is contained in:
Greg Ercolano 2021-03-23 12:18:41 -07:00
parent 5fb6713485
commit 8a9e25cdac

View File

@ -40,10 +40,11 @@ static void draw_image_cb(void *data, int x, int y, int w, uchar *buf) {
cb_data = (struct callback_data*)data;
int last = x+w;
const size_t aD = abs(cb_data->D);
curdata = cb_data->data + x*cb_data->D + y*cb_data->LD;
for (; x<last; x++) {
memcpy(buf, curdata, abs(cb_data->D));
buf += abs(cb_data->D);
memcpy(buf, curdata, aD);
buf += aD;
curdata += cb_data->D;
}
}