From 87cffef7f5d0bf960e5682fad68bd8186fc36e29 Mon Sep 17 00:00:00 2001 From: Mathias Gumz Date: Fri, 17 Sep 2010 23:32:02 +0200 Subject: 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. --- src/FbTk/ImageControl.cc | 4 ++-- src/FbTk/TextureRender.cc | 22 ++++++---------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/FbTk/ImageControl.cc b/src/FbTk/ImageControl.cc index 13d6ec3..00f566d 100644 --- a/src/FbTk/ImageControl.cc +++ b/src/FbTk/ImageControl.cc @@ -381,10 +381,10 @@ void ImageControl::getGradientBuffers(unsigned int w, unsigned int **ybuf) { if (w > grad_xbuffer.size()) - grad_xbuffer.resize(w * 3); + grad_xbuffer.resize(w); if (h > grad_ybuffer.size()) - grad_ybuffer.resize(h * 3); + grad_ybuffer.resize(h); *xbuf = &grad_xbuffer[0]; *ybuf = &grad_ybuffer[0]; diff --git a/src/FbTk/TextureRender.cc b/src/FbTk/TextureRender.cc index 1fb38c6..c2f8e07 100644 --- a/src/FbTk/TextureRender.cc +++ b/src/FbTk/TextureRender.cc @@ -374,13 +374,8 @@ void renderHGradient(bool interlaced, unsigned char* red = r; unsigned char* green = g; unsigned char* blue = b; - unsigned int* xtable; - unsigned int* ytable; register unsigned int x, y; - imgctrl.getGradientBuffers(width, height, &xtable, &ytable); - - drx = (float) (to->red() - from->red()); dgx = (float) (to->green() - from->green()); dbx = (float) (to->blue() - from->blue()); @@ -479,11 +474,6 @@ void renderVGradient(bool interlaced, register unsigned int y; - unsigned int* xtable; - unsigned int* ytable; - - imgctrl.getGradientBuffers(width, height, &xtable, &ytable); - dry = (float) (to->red() - from->red()); dgy = (float) (to->green() - from->green()); dby = (float) (to->blue() - from->blue()); @@ -571,7 +561,7 @@ void renderPGradient(bool interlaced, register unsigned int x, y; - imgctrl.getGradientBuffers(width, height, &xtable, &ytable); + imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable); xt = xtable; yt = ytable; @@ -695,7 +685,7 @@ void renderRGradient(bool interlaced, register unsigned int x, y; - imgctrl.getGradientBuffers(width, height, &xtable, &ytable); + imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable); xt = xtable; yt = ytable; @@ -821,7 +811,7 @@ void renderDGradient(bool interlaced, unsigned int* yt; register unsigned int x, y; - imgctrl.getGradientBuffers(w, h, &xtable, &ytable); + imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable); xt = xtable; yt = ytable; @@ -939,7 +929,7 @@ void renderEGradient(bool interlaced, register unsigned int x, y; - imgctrl.getGradientBuffers(width, height, &xtable, &ytable); + imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable); xt = xtable; yt = ytable; @@ -1070,7 +1060,7 @@ void renderPCGradient(bool interlaced, tb = to->blue(); register unsigned int x, y; - imgctrl.getGradientBuffers(width, height, &xtable, &ytable); + imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable); xt = xtable; yt = ytable; @@ -1192,7 +1182,7 @@ void renderCDGradient(bool interlaced, register unsigned int x, y; - imgctrl.getGradientBuffers(w, h, &xtable, &ytable); + imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable); xt = xtable; yt = ytable; -- cgit v0.11.2