mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
Code refactoring.
This commit is contained in:
parent
3061e7d7a3
commit
757710503f
@ -99,7 +99,7 @@ static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w,
|
|||||||
else if(fl_visual->depth > 8)
|
else if(fl_visual->depth > 8)
|
||||||
bitmap_pad = 16;
|
bitmap_pad = 16;
|
||||||
else {
|
else {
|
||||||
EWARNING(ESTRLOC ": Visual %i not supported\n", fl_visual->depth);
|
E_WARNING(E_STRLOC ": Visual %i not supported\n", fl_visual->depth);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ static Pixmap create_xpixmap(Fl_Image* img, XImage*& xim, Pixmap pix, int wp_w,
|
|||||||
|
|
||||||
#define PIXEL_POS(x, y, w, d) ((( (y) * (w)) + (x) ) * (d))
|
#define PIXEL_POS(x, y, w, d) ((( (y) * (w)) + (x) ) * (d))
|
||||||
|
|
||||||
bool create_tile(Fl_Image* orig, Fl_RGB_Image*& copied, int X, int Y, int W, int H) {
|
static bool create_tile(Fl_Image* orig, Fl_RGB_Image** copied, int X, int Y, int W, int H) {
|
||||||
if(orig->w() >= W && orig->h() >= H)
|
if(orig->w() >= W && orig->h() >= H)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ bool create_tile(Fl_Image* orig, Fl_RGB_Image*& copied, int X, int Y, int W, int
|
|||||||
|
|
||||||
Fl_RGB_Image* c = new Fl_RGB_Image(dest, tw, th, idepth, orig->ld());
|
Fl_RGB_Image* c = new Fl_RGB_Image(dest, tw, th, idepth, orig->ld());
|
||||||
c->alloc_array = 1;
|
c->alloc_array = 1;
|
||||||
copied = c;
|
*copied = c;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -372,7 +372,7 @@ Wallpaper::~Wallpaper() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Wallpaper::set(const char* path) {
|
bool Wallpaper::set(const char* path) {
|
||||||
EASSERT(path != NULL);
|
E_ASSERT(path != NULL);
|
||||||
|
|
||||||
tiled = false;
|
tiled = false;
|
||||||
|
|
||||||
@ -387,23 +387,22 @@ bool Wallpaper::set(const char* path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Wallpaper::set_tiled(const char* path) {
|
bool Wallpaper::set_tiled(const char* path) {
|
||||||
EASSERT(path != NULL);
|
E_ASSERT(path != NULL);
|
||||||
|
|
||||||
Fl_Image* i = Fl_Shared_Image::get(path);
|
Fl_Image* i = Fl_Shared_Image::get(path);
|
||||||
if(!i)
|
if(!i)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Fl_RGB_Image* res = 0;
|
Fl_RGB_Image* res = 0;
|
||||||
if(create_tile(i, res, x(), y(), w(), h())) {
|
if(create_tile(i, &res, x(), y(), w(), h())) {
|
||||||
image(res);
|
image(res);
|
||||||
tiled = true;
|
tiled = true;
|
||||||
|
|
||||||
set_rootpmap();
|
set_rootpmap();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
else {
|
E_WARNING(E_STRLOC ": Unable to create tiles for %s\n", path);
|
||||||
EWARNING(ESTRLOC ": Unable to create tiles for %s\n", path);
|
|
||||||
tiled = false;
|
tiled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,17 +416,13 @@ void Wallpaper::set_rootpmap(void) {
|
|||||||
XImage* rootpmap_image = 0;
|
XImage* rootpmap_image = 0;
|
||||||
rootpmap_pixmap = create_xpixmap(image(), rootpmap_image, rootpmap_pixmap, w(), h());
|
rootpmap_pixmap = create_xpixmap(image(), rootpmap_image, rootpmap_pixmap, w(), h());
|
||||||
|
|
||||||
if(rootpmap_image) {
|
|
||||||
/*
|
|
||||||
* XDestroyImage function calls frees both the image structure and the
|
|
||||||
* data pointed to by the image structure.
|
|
||||||
*/
|
|
||||||
XDestroyImage(rootpmap_image);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!rootpmap_pixmap)
|
if(!rootpmap_pixmap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* XDestroyImage function calls frees both the image structure and the data pointed to by the image structure */
|
||||||
|
if(rootpmap_image)
|
||||||
|
XDestroyImage(rootpmap_image);
|
||||||
|
|
||||||
XChangeProperty(fl_display, RootWindow(fl_display, fl_screen),
|
XChangeProperty(fl_display, RootWindow(fl_display, fl_screen),
|
||||||
_XA_XROOTPMAP_ID, XA_PIXMAP, 32, PropModeReplace, (unsigned char *)&rootpmap_pixmap, 1);
|
_XA_XROOTPMAP_ID, XA_PIXMAP, 32, PropModeReplace, (unsigned char *)&rootpmap_pixmap, 1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user