aboutsummaryrefslogtreecommitdiff
path: root/src/Image.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-07-22 22:33:45 (GMT)
committerfluxgen <fluxgen>2002-07-22 22:33:45 (GMT)
commit25a9c7b57ae36da9d8633ff0f7fcad8e3a0c4e94 (patch)
tree09a2b3303b2743a7a6497f66ed032112bb4cf21b /src/Image.cc
parent794e2a522e9058f9a9746d4333fb4a37c64630bd (diff)
downloadfluxbox-25a9c7b57ae36da9d8633ff0f7fcad8e3a0c4e94.zip
fluxbox-25a9c7b57ae36da9d8633ff0f7fcad8e3a0c4e94.tar.bz2
no need to have different sqrt tables for each object
Diffstat (limited to 'src/Image.cc')
-rw-r--r--src/Image.cc30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/Image.cc b/src/Image.cc
index d96adaf..9db3ee3 100644
--- a/src/Image.cc
+++ b/src/Image.cc
@@ -25,7 +25,7 @@
25// stupid macros needed to access some functions in version 2 of the GNU C 25// stupid macros needed to access some functions in version 2 of the GNU C
26// library 26// library
27 27
28// $Id: Image.cc,v 1.10 2002/07/19 20:30:45 fluxgen Exp $ 28// $Id: Image.cc,v 1.11 2002/07/22 22:33:45 fluxgen Exp $
29 29
30//use GNU extensions 30//use GNU extensions
31#ifndef _GNU_SOURCE 31#ifndef _GNU_SOURCE
@@ -69,6 +69,8 @@ typedef unsigned int u_int32_t;
69# include <ctype.h> 69# include <ctype.h>
70#endif // HAVE_CTYPE_H 70#endif // HAVE_CTYPE_H
71 71
72unsigned long *BImageControl::sqrt_table = 0;
73
72static unsigned long bsqrt(unsigned long x) { 74static unsigned long bsqrt(unsigned long x) {
73 if (x <= 0) return 0; 75 if (x <= 0) return 0;
74 if (x == 1) return 1; 76 if (x == 1) return 1;
@@ -261,11 +263,10 @@ Pixmap BImage::render_gradient(BTexture *texture) {
261 if (texture->getTexture() & BImage::BEVEL1) bevel1(); 263 if (texture->getTexture() & BImage::BEVEL1) bevel1();
262 else if (texture->getTexture() & BImage::BEVEL2) bevel2(); 264 else if (texture->getTexture() & BImage::BEVEL2) bevel2();
263 265
264 if (inverted) invert(); 266 if (inverted)
265 267 invert();
266 Pixmap pixmap = renderPixmap();
267 268
268 return pixmap; 269 return renderPixmap();
269 270
270} 271}
271 272
@@ -304,7 +305,7 @@ XImage *BImage::renderXImage(void) {
304 {1, 5, 0, 4}, 305 {1, 5, 0, 4},
305 {7, 3, 6, 2} }; 306 {7, 3, 6, 2} };
306 307
307#ifdef ORDEREDPSEUDO 308#ifdef ORDEREDPSEUDO
308 unsigned char dither8[8][8] = { 309 unsigned char dither8[8][8] = {
309 { 0, 32, 8, 40, 2, 34, 10, 42 }, 310 { 0, 32, 8, 40, 2, 34, 10, 42 },
310 { 48, 16, 56, 24, 50, 18, 58, 26 }, 311 { 48, 16, 56, 24, 50, 18, 58, 26 },
@@ -569,12 +570,12 @@ XImage *BImage::renderXImage(void) {
569 case PseudoColor: 570 case PseudoColor:
570 for (y = 0, offset = 0; y < height; y++) { 571 for (y = 0, offset = 0; y < height; y++) {
571 for (x = 0; x < width; x++, offset++) { 572 for (x = 0; x < width; x++, offset++) {
572 r = red_table[red[offset]]; 573 r = red_table[red[offset]];
573 g = green_table[green[offset]]; 574 g = green_table[green[offset]];
574 b = blue_table[blue[offset]]; 575 b = blue_table[blue[offset]];
575 576
576 pixel = (r * cpccpc) + (g * cpc) + b; 577 pixel = (r * cpccpc) + (g * cpc) + b;
577 *pixel_data++ = colors[pixel].pixel; 578 *pixel_data++ = colors[pixel].pixel;
578 } 579 }
579 580
580 pixel_data = (ppixel_data += image->bytes_per_line); 581 pixel_data = (ppixel_data += image->bytes_per_line);
@@ -1852,8 +1853,6 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, bool _dither,
1852 grad_xbuffer = grad_ybuffer = (unsigned int *) 0; 1853 grad_xbuffer = grad_ybuffer = (unsigned int *) 0;
1853 grad_buffer_width = grad_buffer_height = 0; 1854 grad_buffer_width = grad_buffer_height = 0;
1854 1855
1855 sqrt_table = (unsigned long *) 0;
1856
1857 screen_depth = screeninfo->getDepth(); 1856 screen_depth = screeninfo->getDepth();
1858 window = screeninfo->getRootWindow(); 1857 window = screeninfo->getRootWindow();
1859 screen_number = screeninfo->getScreenNumber(); 1858 screen_number = screeninfo->getScreenNumber();
@@ -1957,15 +1956,16 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, bool _dither,
1957 red_color_table[i] = green_color_table[i] = blue_color_table[i] = 1956 red_color_table[i] = green_color_table[i] = blue_color_table[i] =
1958 i / bits; 1957 i / bits;
1959 1958
1960 for (r = 0, i = 0; r < colors_per_channel; r++) 1959 for (r = 0, i = 0; r < colors_per_channel; r++) {
1961 for (g = 0; g < colors_per_channel; g++) 1960 for (g = 0; g < colors_per_channel; g++) {
1962 for (b = 0; b < colors_per_channel; b++, i++) { 1961 for (b = 0; b < colors_per_channel; b++, i++) {
1963 colors[i].red = (r * 0xffff) / (colors_per_channel - 1); 1962 colors[i].red = (r * 0xffff) / (colors_per_channel - 1);
1964 colors[i].green = (g * 0xffff) / (colors_per_channel - 1); 1963 colors[i].green = (g * 0xffff) / (colors_per_channel - 1);
1965 colors[i].blue = (b * 0xffff) / (colors_per_channel - 1);; 1964 colors[i].blue = (b * 0xffff) / (colors_per_channel - 1);;
1966 colors[i].flags = DoRed|DoGreen|DoBlue; 1965 colors[i].flags = DoRed|DoGreen|DoBlue;
1967 } 1966 }
1968 1967 }
1968 }
1969 basedisplay->grab(); 1969 basedisplay->grab();
1970 1970
1971 for (i = 0; i < ncolors; i++) { 1971 for (i = 0; i < ncolors; i++) {