request explicitly as many elements for the gradient tables as we need

the next step is to not use 'unsigned int' and then only store 'chars'
in it, maybe even using RGBA data instead of separated arrays for
r, g and b.
This commit is contained in:
Mathias Gumz 2010-09-17 23:32:02 +02:00
parent 786eef6e39
commit 87cffef7f5
2 changed files with 8 additions and 18 deletions

View file

@ -381,10 +381,10 @@ void ImageControl::getGradientBuffers(unsigned int w,
unsigned int **ybuf) { unsigned int **ybuf) {
if (w > grad_xbuffer.size()) if (w > grad_xbuffer.size())
grad_xbuffer.resize(w * 3); grad_xbuffer.resize(w);
if (h > grad_ybuffer.size()) if (h > grad_ybuffer.size())
grad_ybuffer.resize(h * 3); grad_ybuffer.resize(h);
*xbuf = &grad_xbuffer[0]; *xbuf = &grad_xbuffer[0];
*ybuf = &grad_ybuffer[0]; *ybuf = &grad_ybuffer[0];

View file

@ -374,13 +374,8 @@ void renderHGradient(bool interlaced,
unsigned char* red = r; unsigned char* red = r;
unsigned char* green = g; unsigned char* green = g;
unsigned char* blue = b; unsigned char* blue = b;
unsigned int* xtable;
unsigned int* ytable;
register unsigned int x, y; register unsigned int x, y;
imgctrl.getGradientBuffers(width, height, &xtable, &ytable);
drx = (float) (to->red() - from->red()); drx = (float) (to->red() - from->red());
dgx = (float) (to->green() - from->green()); dgx = (float) (to->green() - from->green());
dbx = (float) (to->blue() - from->blue()); dbx = (float) (to->blue() - from->blue());
@ -479,11 +474,6 @@ void renderVGradient(bool interlaced,
register unsigned int y; register unsigned int y;
unsigned int* xtable;
unsigned int* ytable;
imgctrl.getGradientBuffers(width, height, &xtable, &ytable);
dry = (float) (to->red() - from->red()); dry = (float) (to->red() - from->red());
dgy = (float) (to->green() - from->green()); dgy = (float) (to->green() - from->green());
dby = (float) (to->blue() - from->blue()); dby = (float) (to->blue() - from->blue());
@ -571,7 +561,7 @@ void renderPGradient(bool interlaced,
register unsigned int x, y; register unsigned int x, y;
imgctrl.getGradientBuffers(width, height, &xtable, &ytable); imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
xt = xtable; xt = xtable;
yt = ytable; yt = ytable;
@ -695,7 +685,7 @@ void renderRGradient(bool interlaced,
register unsigned int x, y; register unsigned int x, y;
imgctrl.getGradientBuffers(width, height, &xtable, &ytable); imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
xt = xtable; xt = xtable;
yt = ytable; yt = ytable;
@ -821,7 +811,7 @@ void renderDGradient(bool interlaced,
unsigned int* yt; unsigned int* yt;
register unsigned int x, y; register unsigned int x, y;
imgctrl.getGradientBuffers(w, h, &xtable, &ytable); imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
xt = xtable; xt = xtable;
yt = ytable; yt = ytable;
@ -939,7 +929,7 @@ void renderEGradient(bool interlaced,
register unsigned int x, y; register unsigned int x, y;
imgctrl.getGradientBuffers(width, height, &xtable, &ytable); imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
xt = xtable; xt = xtable;
yt = ytable; yt = ytable;
@ -1070,7 +1060,7 @@ void renderPCGradient(bool interlaced,
tb = to->blue(); tb = to->blue();
register unsigned int x, y; register unsigned int x, y;
imgctrl.getGradientBuffers(width, height, &xtable, &ytable); imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
xt = xtable; xt = xtable;
yt = ytable; yt = ytable;
@ -1192,7 +1182,7 @@ void renderCDGradient(bool interlaced,
register unsigned int x, y; register unsigned int x, y;
imgctrl.getGradientBuffers(w, h, &xtable, &ytable); imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
xt = xtable; xt = xtable;
yt = ytable; yt = ytable;