fixed indentation and timer var

This commit is contained in:
fluxgen 2002-03-19 00:04:36 +00:00
parent e6e1db0ad6
commit a29dd8e476
2 changed files with 1684 additions and 1700 deletions

View file

@ -1,4 +1,4 @@
// Image.cc for Flxubox Window Manager
// Image.cc for Fluxbox Window Manager
// Copyright (c) 2001 - 2002 Henrik Kinnunen (fluxbox@linuxmail.org)
//
// Image.cc for Blackbox - an X11 Window manager
@ -25,8 +25,9 @@
// stupid macros needed to access some functions in version 2 of the GNU C
// library
// $Id: Image.cc,v 1.5 2002/03/18 15:32:50 fluxgen Exp $
// $Id: Image.cc,v 1.6 2002/03/19 00:04:36 fluxgen Exp $
//use GNU extensions
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif // _GNU_SOURCE
@ -305,13 +306,15 @@ XImage *BImage::renderXImage(void) {
o = image->bits_per_pixel + ((image->byte_order == MSBFirst) ? 1 : 0);
if (control->doDither() && width > 1 && height > 1) {
unsigned char dither4[4][4] = { {0, 4, 1, 5},
unsigned char dither4[4][4] = {
{0, 4, 1, 5},
{6, 2, 7, 3},
{1, 5, 0, 4},
{7, 3, 6, 2} };
#ifdef ORDEREDPSEUDO
unsigned char dither8[8][8] = { { 0, 32, 8, 40, 2, 34, 10, 42 },
unsigned char dither8[8][8] = {
{ 0, 32, 8, 40, 2, 34, 10, 42 },
{ 48, 16, 56, 24, 50, 18, 58, 26 },
{ 12, 44, 4, 36, 14, 46, 6, 38 },
{ 60, 28, 52, 20, 62, 30, 54, 22 },
@ -518,7 +521,7 @@ XImage *BImage::renderXImage(void) {
delete [] nberr;
#endif // ORDEREDPSUEDO
break; }
} break;
/*
case StaticGray:
@ -669,11 +672,7 @@ XImage *BImage::renderXImage(void) {
fprintf(stderr,
i18n->
getMessage(
#ifdef NLS
ImageSet, ImageUnsupVisual,
#else // !NLS
0, 0,
#endif // NLS
"BImage::renderXImage: unsupported visual\n"));
delete [] d;
XDestroyImage(image);
@ -1844,7 +1843,10 @@ void BImage::cdgradient(void) {
BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
int _cpc, unsigned long cache_timeout,
unsigned long cmax)
unsigned long cmax):
#ifdef TIMEDCACHE
timer(this)
#endif //TIMEDCACHE
{
I18n *i18n = I18n::instance();
basedisplay = dpy;
@ -1855,11 +1857,9 @@ BImageControl::BImageControl(BaseDisplay *dpy, ScreenInfo *scrn, Bool _dither,
cache_max = cmax;
#ifdef TIMEDCACHE
if (cache_timeout) {
timer = new BTimer(basedisplay, this);
timer->setTimeout(cache_timeout);
timer->start();
} else
timer = (BTimer *) 0;
timer.setTimeout(cache_timeout);
timer.start();
}
#endif // TIMEDCACHE
colors = (XColor *) 0;
@ -2220,11 +2220,7 @@ BImageControl::~BImageControl(void) {
fprintf(stderr,
I18n::instance()->
getMessage(
#ifdef NLS
ImageSet, ImagePixmapRelease,
#else // !NLS
0, 0,
#endif // NLS
"BImageContol::~BImageControl: pixmap cache - "
"releasing %d pixmaps\n"), cache.size());
@ -2235,11 +2231,6 @@ BImageControl::~BImageControl(void) {
delete (*it);
}
#ifdef TIMEDCACHE
if (timer) {
delete timer;
}
#endif // TIMEDCACHE
}
}
@ -2303,15 +2294,10 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height,
fprintf(stderr,
I18n::instance()->
getMessage(
#ifdef NLS
ImageSet, ImagePixmapCacheLarge,
#else // !NLS
0, 0,
#endif // NLS
"BImageControl::renderImage: cache is large, "
"forcing cleanout\n"));
#endif // DEBUG
timeout();
}
@ -2332,7 +2318,7 @@ void BImageControl::removeImage(Pixmap pixmap) {
(*it)->count--;
#ifdef TIMEDCACHE
if (! timer) timeout();
timeout();
#else // !TIMEDCACHE
if (! (*it)->count) timeout();
#endif // TIMEDCACHE
@ -2392,6 +2378,7 @@ void BImageControl::getColorTables(unsigned char **rmt, unsigned char **gmt,
unsigned char **bmt,
int *roff, int *goff, int *boff,
int *rbit, int *gbit, int *bbit) {
if (rmt) *rmt = red_color_table;
if (gmt) *gmt = green_color_table;
if (bmt) *bmt = blue_color_table;

View file

@ -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.5 2002/02/17 18:57:47 fluxgen Exp $
// $Id: Image.hh,v 1.6 2002/03/19 00:04:36 fluxgen Exp $
#ifndef IMAGE_HH
#define IMAGE_HH
@ -51,11 +51,11 @@ public:
inline const int &isAllocated(void) const { return allocated; }
inline const unsigned char &getRed(void) const { return red; }
inline const unsigned char &getGreen(void) const { return green; }
inline const unsigned char &getBlue(void) const { return blue; }
inline const unsigned char getRed(void) const { return red; }
inline const unsigned char getGreen(void) const { return green; }
inline const unsigned char getBlue(void) const { return blue; }
inline const unsigned long &getPixel(void) const { return pixel; }
inline const unsigned long getPixel(void) const { return pixel; }
inline void setAllocated(int a) { allocated = a; }
inline void setRGB(char r, char g, char b) { red = r; green = g; blue = b; }
@ -76,7 +76,7 @@ public:
inline BColor *getHiColor(void) { return &hiColor; }
inline BColor *getLoColor(void) { return &loColor; }
inline const unsigned long &getTexture(void) const { return texture; }
inline const unsigned long getTexture(void) const { return texture; }
inline void setTexture(unsigned long t) { texture = t; }
inline void addTexture(unsigned long t) { texture |= t; }
@ -150,12 +150,53 @@ public:
class BImageControl : public TimeoutHandler {
public:
BImageControl(BaseDisplay *, ScreenInfo *, Bool = False, int = 4,
unsigned long = 300000l, unsigned long = 200l);
virtual ~BImageControl();
inline BaseDisplay *getBaseDisplay(void) { return basedisplay; }
inline const bool doDither(void) { return dither; }
inline const Colormap &getColormap(void) const { return colormap; }
inline ScreenInfo *getScreenInfo(void) { return screeninfo; }
inline const Window &getDrawable(void) const { return window; }
inline Visual *getVisual(void) { return screeninfo->getVisual(); }
inline const int getBitsPerPixel(void) const { return bits_per_pixel; }
inline const int getDepth(void) const { return screen_depth; }
inline const int getColorsPerChannel(void) const
{ return colors_per_channel; }
unsigned long getColor(const char *);
unsigned long getColor(const char *, unsigned char *, unsigned char *,
unsigned char *);
unsigned long getSqrt(unsigned int);
Pixmap renderImage(unsigned int, unsigned int, BTexture *);
void installRootColormap(void);
void removeImage(Pixmap);
void getColorTables(unsigned char **, unsigned char **, unsigned char **,
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);
virtual void timeout(void);
private:
Bool dither;
BaseDisplay *basedisplay;
ScreenInfo *screeninfo;
#ifdef TIMEDCACHE
BTimer *timer;
BTimer timer;
#endif // TIMEDCACHE
Colormap colormap;
@ -182,52 +223,8 @@ private:
CacheList cache;
protected:
Pixmap searchCache(unsigned int, unsigned int, unsigned long, BColor *,
BColor *);
public:
BImageControl(BaseDisplay *, ScreenInfo *, Bool = False, int = 4,
unsigned long = 300000l, unsigned long = 200l);
virtual ~BImageControl(void);
inline BaseDisplay *getBaseDisplay(void) { return basedisplay; }
inline const Bool &doDither(void) { return dither; }
inline const Colormap &getColormap(void) const { return colormap; }
inline ScreenInfo *getScreenInfo(void) { return screeninfo; }
inline const Window &getDrawable(void) const { return window; }
inline Visual *getVisual(void) { return screeninfo->getVisual(); }
inline const int &getBitsPerPixel(void) const { return bits_per_pixel; }
inline const int &getDepth(void) const { return screen_depth; }
inline const int &getColorsPerChannel(void) const
{ return colors_per_channel; }
unsigned long getColor(const char *);
unsigned long getColor(const char *, unsigned char *, unsigned char *,
unsigned char *);
unsigned long getSqrt(unsigned int);
Pixmap renderImage(unsigned int, unsigned int, BTexture *);
void installRootColormap(void);
void removeImage(Pixmap);
void getColorTables(unsigned char **, unsigned char **, unsigned char **,
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);
virtual void timeout(void);
Pixmap searchCache(unsigned int, unsigned int, unsigned long, BColor *, BColor *);
};