all repos — fluxbox @ 25a9c7b57ae36da9d8633ff0f7fcad8e3a0c4e94

custom fork of the fluxbox windowmanager

no need to have different sqrt tables for each object
fluxgen fluxgen
commit

25a9c7b57ae36da9d8633ff0f7fcad8e3a0c4e94

parent

794e2a522e9058f9a9746d4333fb4a37c64630bd

2 files changed, 27 insertions(+), 26 deletions(-)

jump to
M src/Image.ccsrc/Image.cc

@@ -25,7 +25,7 @@

// stupid macros needed to access some functions in version 2 of the GNU C // library -// $Id: Image.cc,v 1.10 2002/07/19 20:30:45 fluxgen Exp $ +// $Id: Image.cc,v 1.11 2002/07/22 22:33:45 fluxgen Exp $ //use GNU extensions #ifndef _GNU_SOURCE

@@ -68,6 +68,8 @@

#ifdef HAVE_CTYPE_H # include <ctype.h> #endif // HAVE_CTYPE_H + +unsigned long *BImageControl::sqrt_table = 0; static unsigned long bsqrt(unsigned long x) { if (x <= 0) return 0;

@@ -261,11 +263,10 @@

if (texture->getTexture() & BImage::BEVEL1) bevel1(); else if (texture->getTexture() & BImage::BEVEL2) bevel2(); - if (inverted) invert(); + if (inverted) + invert(); - Pixmap pixmap = renderPixmap(); - - return pixmap; + return renderPixmap(); }

@@ -304,7 +305,7 @@ {6, 2, 7, 3},

{1, 5, 0, 4}, {7, 3, 6, 2} }; -#ifdef ORDEREDPSEUDO +#ifdef ORDEREDPSEUDO unsigned char dither8[8][8] = { { 0, 32, 8, 40, 2, 34, 10, 42 }, { 48, 16, 56, 24, 50, 18, 58, 26 },

@@ -569,12 +570,12 @@ case StaticColor:

case PseudoColor: for (y = 0, offset = 0; y < height; y++) { for (x = 0; x < width; x++, offset++) { - r = red_table[red[offset]]; + r = red_table[red[offset]]; g = green_table[green[offset]]; - b = blue_table[blue[offset]]; + b = blue_table[blue[offset]]; - pixel = (r * cpccpc) + (g * cpc) + b; - *pixel_data++ = colors[pixel].pixel; + pixel = (r * cpccpc) + (g * cpc) + b; + *pixel_data++ = colors[pixel].pixel; } pixel_data = (ppixel_data += image->bytes_per_line);

@@ -1852,8 +1853,6 @@

grad_xbuffer = grad_ybuffer = (unsigned int *) 0; grad_buffer_width = grad_buffer_height = 0; - sqrt_table = (unsigned long *) 0; - screen_depth = screeninfo->getDepth(); window = screeninfo->getRootWindow(); screen_number = screeninfo->getScreenNumber();

@@ -1957,15 +1956,16 @@ for (i = 0; i < 256; i++)

red_color_table[i] = green_color_table[i] = blue_color_table[i] = i / bits; - for (r = 0, i = 0; r < colors_per_channel; r++) - for (g = 0; g < colors_per_channel; g++) + for (r = 0, i = 0; r < colors_per_channel; r++) { + for (g = 0; g < colors_per_channel; g++) { for (b = 0; b < colors_per_channel; b++, i++) { colors[i].red = (r * 0xffff) / (colors_per_channel - 1); colors[i].green = (g * 0xffff) / (colors_per_channel - 1); colors[i].blue = (b * 0xffff) / (colors_per_channel - 1);; colors[i].flags = DoRed|DoGreen|DoBlue; } - + } + } basedisplay->grab(); for (i = 0; i < ncolors; i++) {
M src/Image.hhsrc/Image.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Image.hh,v 1.8 2002/07/19 20:33:15 fluxgen Exp $ +// $Id: Image.hh,v 1.9 2002/07/22 22:33:45 fluxgen Exp $ #ifndef IMAGE_HH #define IMAGE_HH

@@ -177,26 +177,26 @@

unsigned long color(const char *colorname); unsigned long color(const char *, unsigned char *, unsigned char *, unsigned char *); - unsigned long getSqrt(unsigned int); + unsigned long getSqrt(unsigned int val); Pixmap renderImage(unsigned int, unsigned int, BTexture *); void installRootColormap(); void removeImage(Pixmap thepix); void colorTables(unsigned char **, unsigned char **, unsigned char **, - int *, int *, int *, int *, int *, int *); + int *, int *, int *, int *, int *, int *); void getXColorTable(XColor **, int *); void getGradientBuffers(unsigned int, unsigned int, - unsigned int **, unsigned int **); - void setDither(Bool d) { dither = d; } - void setColorsPerChannel(int); - void parseTexture(BTexture *, char *); - void parseColor(BColor *, char * = 0); + unsigned int **, unsigned int **); + void setDither(bool d) { dither = d; } + void setColorsPerChannel(int cpc); + void parseTexture(BTexture *ret_texture, char *sval); + void parseColor(BColor *ret_color, char *sval = 0); - virtual void timeout(void); + virtual void timeout(); private: - Bool dither; + bool dither; BaseDisplay *basedisplay; ScreenInfo *screeninfo; #ifdef TIMEDCACHE

@@ -214,7 +214,8 @@ unsigned char red_color_table[256], green_color_table[256],

blue_color_table[256]; unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width, grad_buffer_height; - unsigned long *sqrt_table, cache_max; + static unsigned long *sqrt_table; + unsigned long cache_max; typedef struct Cache { Pixmap pixmap;