no need to have different sqrt tables for each object
This commit is contained in:
parent
794e2a522e
commit
25a9c7b57a
2 changed files with 27 additions and 26 deletions
30
src/Image.cc
30
src/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
|
||||
|
@ -69,6 +69,8 @@ typedef unsigned int u_int32_t;
|
|||
# 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;
|
||||
if (x == 1) return 1;
|
||||
|
@ -261,11 +263,10 @@ Pixmap BImage::render_gradient(BTexture *texture) {
|
|||
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 @@ XImage *BImage::renderXImage(void) {
|
|||
{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 @@ XImage *BImage::renderXImage(void) {
|
|||
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 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, bool _dither,
|
|||
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 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, bool _dither,
|
|||
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++) {
|
||||
|
|
23
src/Image.hh
23
src/Image.hh
|
@ -22,7 +22,7 @@
|
|||
// 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 @@ public:
|
|||
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 @@ private:
|
|||
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;
|
||||
|
|
Loading…
Reference in a new issue