aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-09-17 21:32:02 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-09-17 21:32:02 (GMT)
commit87cffef7f5d0bf960e5682fad68bd8186fc36e29 (patch)
tree2806734a239a8bee0e1cefcf733e5aced758213f
parent786eef6e39d58c590143d02f30e9949b40af1a24 (diff)
downloadfluxbox_pavel-87cffef7f5d0bf960e5682fad68bd8186fc36e29.zip
fluxbox_pavel-87cffef7f5d0bf960e5682fad68bd8186fc36e29.tar.bz2
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.
-rw-r--r--src/FbTk/ImageControl.cc4
-rw-r--r--src/FbTk/TextureRender.cc22
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,
381 unsigned int **ybuf) { 381 unsigned int **ybuf) {
382 382
383 if (w > grad_xbuffer.size()) 383 if (w > grad_xbuffer.size())
384 grad_xbuffer.resize(w * 3); 384 grad_xbuffer.resize(w);
385 385
386 if (h > grad_ybuffer.size()) 386 if (h > grad_ybuffer.size())
387 grad_ybuffer.resize(h * 3); 387 grad_ybuffer.resize(h);
388 388
389 *xbuf = &grad_xbuffer[0]; 389 *xbuf = &grad_xbuffer[0];
390 *ybuf = &grad_ybuffer[0]; 390 *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,
374 unsigned char* red = r; 374 unsigned char* red = r;
375 unsigned char* green = g; 375 unsigned char* green = g;
376 unsigned char* blue = b; 376 unsigned char* blue = b;
377 unsigned int* xtable;
378 unsigned int* ytable;
379 register unsigned int x, y; 377 register unsigned int x, y;
380 378
381 imgctrl.getGradientBuffers(width, height, &xtable, &ytable);
382
383
384 drx = (float) (to->red() - from->red()); 379 drx = (float) (to->red() - from->red());
385 dgx = (float) (to->green() - from->green()); 380 dgx = (float) (to->green() - from->green());
386 dbx = (float) (to->blue() - from->blue()); 381 dbx = (float) (to->blue() - from->blue());
@@ -479,11 +474,6 @@ void renderVGradient(bool interlaced,
479 474
480 register unsigned int y; 475 register unsigned int y;
481 476
482 unsigned int* xtable;
483 unsigned int* ytable;
484
485 imgctrl.getGradientBuffers(width, height, &xtable, &ytable);
486
487 dry = (float) (to->red() - from->red()); 477 dry = (float) (to->red() - from->red());
488 dgy = (float) (to->green() - from->green()); 478 dgy = (float) (to->green() - from->green());
489 dby = (float) (to->blue() - from->blue()); 479 dby = (float) (to->blue() - from->blue());
@@ -571,7 +561,7 @@ void renderPGradient(bool interlaced,
571 561
572 register unsigned int x, y; 562 register unsigned int x, y;
573 563
574 imgctrl.getGradientBuffers(width, height, &xtable, &ytable); 564 imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
575 xt = xtable; 565 xt = xtable;
576 yt = ytable; 566 yt = ytable;
577 567
@@ -695,7 +685,7 @@ void renderRGradient(bool interlaced,
695 685
696 register unsigned int x, y; 686 register unsigned int x, y;
697 687
698 imgctrl.getGradientBuffers(width, height, &xtable, &ytable); 688 imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
699 xt = xtable; 689 xt = xtable;
700 yt = ytable; 690 yt = ytable;
701 691
@@ -821,7 +811,7 @@ void renderDGradient(bool interlaced,
821 unsigned int* yt; 811 unsigned int* yt;
822 register unsigned int x, y; 812 register unsigned int x, y;
823 813
824 imgctrl.getGradientBuffers(w, h, &xtable, &ytable); 814 imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
825 xt = xtable; 815 xt = xtable;
826 yt = ytable; 816 yt = ytable;
827 817
@@ -939,7 +929,7 @@ void renderEGradient(bool interlaced,
939 register unsigned int x, y; 929 register unsigned int x, y;
940 930
941 931
942 imgctrl.getGradientBuffers(width, height, &xtable, &ytable); 932 imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
943 xt = xtable; 933 xt = xtable;
944 yt = ytable; 934 yt = ytable;
945 935
@@ -1070,7 +1060,7 @@ void renderPCGradient(bool interlaced,
1070 tb = to->blue(); 1060 tb = to->blue();
1071 register unsigned int x, y; 1061 register unsigned int x, y;
1072 1062
1073 imgctrl.getGradientBuffers(width, height, &xtable, &ytable); 1063 imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
1074 xt = xtable; 1064 xt = xtable;
1075 yt = ytable; 1065 yt = ytable;
1076 1066
@@ -1192,7 +1182,7 @@ void renderCDGradient(bool interlaced,
1192 1182
1193 register unsigned int x, y; 1183 register unsigned int x, y;
1194 1184
1195 imgctrl.getGradientBuffers(w, h, &xtable, &ytable); 1185 imgctrl.getGradientBuffers(width * 3, height * 3, &xtable, &ytable);
1196 xt = xtable; 1186 xt = xtable;
1197 yt = ytable; 1187 yt = ytable;
1198 1188