summaryrefslogtreecommitdiff
path: root/src
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
parent794e2a522e9058f9a9746d4333fb4a37c64630bd (diff)
downloadfluxbox_lack-25a9c7b57ae36da9d8633ff0f7fcad8e3a0c4e94.zip
fluxbox_lack-25a9c7b57ae36da9d8633ff0f7fcad8e3a0c4e94.tar.bz2
no need to have different sqrt tables for each object
Diffstat (limited to 'src')
-rw-r--r--src/Image.cc30
-rw-r--r--src/Image.hh23
2 files changed, 27 insertions, 26 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++) {
diff --git a/src/Image.hh b/src/Image.hh
index 1a9579b..94aa6b0 100644
--- a/src/Image.hh
+++ b/src/Image.hh
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Image.hh,v 1.8 2002/07/19 20:33:15 fluxgen Exp $ 25// $Id: Image.hh,v 1.9 2002/07/22 22:33:45 fluxgen Exp $
26 26
27#ifndef IMAGE_HH 27#ifndef IMAGE_HH
28#define IMAGE_HH 28#define IMAGE_HH
@@ -177,26 +177,26 @@ public:
177 unsigned long color(const char *colorname); 177 unsigned long color(const char *colorname);
178 unsigned long color(const char *, unsigned char *, unsigned char *, 178 unsigned long color(const char *, unsigned char *, unsigned char *,
179 unsigned char *); 179 unsigned char *);
180 unsigned long getSqrt(unsigned int); 180 unsigned long getSqrt(unsigned int val);
181 181
182 Pixmap renderImage(unsigned int, unsigned int, BTexture *); 182 Pixmap renderImage(unsigned int, unsigned int, BTexture *);
183 183
184 void installRootColormap(); 184 void installRootColormap();
185 void removeImage(Pixmap thepix); 185 void removeImage(Pixmap thepix);
186 void colorTables(unsigned char **, unsigned char **, unsigned char **, 186 void colorTables(unsigned char **, unsigned char **, unsigned char **,
187 int *, int *, int *, int *, int *, int *); 187 int *, int *, int *, int *, int *, int *);
188 void getXColorTable(XColor **, int *); 188 void getXColorTable(XColor **, int *);
189 void getGradientBuffers(unsigned int, unsigned int, 189 void getGradientBuffers(unsigned int, unsigned int,
190 unsigned int **, unsigned int **); 190 unsigned int **, unsigned int **);
191 void setDither(Bool d) { dither = d; } 191 void setDither(bool d) { dither = d; }
192 void setColorsPerChannel(int); 192 void setColorsPerChannel(int cpc);
193 void parseTexture(BTexture *, char *); 193 void parseTexture(BTexture *ret_texture, char *sval);
194 void parseColor(BColor *, char * = 0); 194 void parseColor(BColor *ret_color, char *sval = 0);
195 195
196 virtual void timeout(void); 196 virtual void timeout();
197 197
198private: 198private:
199 Bool dither; 199 bool dither;
200 BaseDisplay *basedisplay; 200 BaseDisplay *basedisplay;
201 ScreenInfo *screeninfo; 201 ScreenInfo *screeninfo;
202#ifdef TIMEDCACHE 202#ifdef TIMEDCACHE
@@ -214,7 +214,8 @@ private:
214 blue_color_table[256]; 214 blue_color_table[256];
215 unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width, 215 unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width,
216 grad_buffer_height; 216 grad_buffer_height;
217 unsigned long *sqrt_table, cache_max; 217 static unsigned long *sqrt_table;
218 unsigned long cache_max;
218 219
219 typedef struct Cache { 220 typedef struct Cache {
220 Pixmap pixmap; 221 Pixmap pixmap;