From bc0b869ba92d12399bb10bbc9d2882e3e0d9e594 Mon Sep 17 00:00:00 2001 From: kojima Date: Mon, 19 Apr 1999 00:27:47 +0000 Subject: [PATCH] fixed bug in texture panel --- WINGs/wtest.c | 8 ++++ WPrefs.app/TexturePanel.c | 7 ++-- WPrefs.app/po/Makefile.in | 3 +- util/wmsetbg.c | 5 +++ wrlib/scale.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 117 insertions(+), 4 deletions(-) diff --git a/WINGs/wtest.c b/WINGs/wtest.c index 05ca39df..5322101f 100644 --- a/WINGs/wtest.c +++ b/WINGs/wtest.c @@ -255,6 +255,12 @@ testColorWell(WMScreen *scr) WMMapWidget(win); } +void +sliderCallback(WMWidget *w, void *data) +{ + printf("SLIEDER == %i\n", WMGetSliderValue(w)); +} + void testSlider(WMScreen *scr) @@ -274,6 +280,8 @@ testSlider(WMScreen *scr) WMResizeWidget(s, 16, 100); WMMoveWidget(s, 100, 100); WMSetSliderKnobThickness(s, 8); + WMSetSliderContinuous(s, False); + WMSetSliderAction(s, sliderCallback, s); s = WMCreateSlider(win); WMResizeWidget(s, 100, 16); diff --git a/WPrefs.app/TexturePanel.c b/WPrefs.app/TexturePanel.c index 68bd431f..d234e23f 100644 --- a/WPrefs.app/TexturePanel.c +++ b/WPrefs.app/TexturePanel.c @@ -238,13 +238,14 @@ updateTGradImage(TexturePanel *panel) RDiagonalGradient); } - RCombineImagesWithOpaqueness(image, gradient, + RCombineImagesWithOpaqueness(image, gradient, WMGetSliderValue(panel->topaS)); RDestroyImage(gradient); pixmap = WMCreatePixmapFromRImage(WMWidgetScreen(panel->win), image, 128); WMSetLabelImage(panel->imageL, pixmap); + WMReleasePixmap(pixmap); WMResizeWidget(panel->imageL, image->width, image->height); RDestroyImage(image); } @@ -387,7 +388,7 @@ static void sliderChangeCallback(WMWidget *w, void *data) { TexturePanel *panel = (TexturePanel*)data; - RHSVColor hsv, *hsvp; + RHSVColor hsv; int row, rows; WMListItem *item; RColor **colors; @@ -588,7 +589,7 @@ static void updateImage(TexturePanel *panel, char *path) { WMScreen *scr = WMWidgetScreen(panel->win); - RImage *image, *scaled; + RImage *image; WMPixmap *pixmap; WMSize size; diff --git a/WPrefs.app/po/Makefile.in b/WPrefs.app/po/Makefile.in index fa2909a4..d1c454eb 100644 --- a/WPrefs.app/po/Makefile.in +++ b/WPrefs.app/po/Makefile.in @@ -94,7 +94,8 @@ nlsdir = $(NLSDIR) CLEANFILES = $(CATALOGS) -EXTRA_DIST = pt.po hr.po fr.po ko.po cs.po ja.po zh_TW.Big5.po es.po +EXTRA_DIST = pt.po hr.po fr.po ko.po cs.po ja.po zh_TW.Big5.po es.po zh_CN.GB2312.po + POTFILES = $(top_builddir)/WPrefs.app/main.c $(top_builddir)/WPrefs.app/WPrefs.c $(top_builddir)/WPrefs.app/Appearance.c $(top_builddir)/WPrefs.app/Configurations.c $(top_builddir)/WPrefs.app/Expert.c $(top_builddir)/WPrefs.app/Focus.c $(top_builddir)/WPrefs.app/Icons.c $(top_builddir)/WPrefs.app/KeyboardSettings.c $(top_builddir)/WPrefs.app/KeyboardShortcuts.c $(top_builddir)/WPrefs.app/Menu.c $(top_builddir)/WPrefs.app/MenuPreferences.c $(top_builddir)/WPrefs.app/MouseSettings.c $(top_builddir)/WPrefs.app/NoMenuAlert.c $(top_builddir)/WPrefs.app/Paths.c $(top_builddir)/WPrefs.app/Preferences.c $(top_builddir)/WPrefs.app/Text.c $(top_builddir)/WPrefs.app/TexturePanel.c $(top_builddir)/WPrefs.app/Themes.c $(top_builddir)/WPrefs.app/WindowHandling.c $(top_builddir)/WPrefs.app/Workspace.c $(top_builddir)/WPrefs.app/double.c $(top_builddir)/WPrefs.app/editmenu.c $(top_builddir)/WPrefs.app/MenuGuru.c $(top_builddir)/WPrefs.app/xmodifier.c diff --git a/util/wmsetbg.c b/util/wmsetbg.c index 8f472034..043c919e 100644 --- a/util/wmsetbg.c +++ b/util/wmsetbg.c @@ -689,6 +689,9 @@ freeTexture(BackgroundTexture *texture) && pixel[0]!=WhitePixelOfScreen(DefaultScreenOfDisplay(dpy))) XFreeColors(dpy, DefaultColormap(dpy, scr), pixel, 1, 0); } + if (texture->pixmap) { + XFreePixmap(dpy, texture->pixmap); + } free(texture->spec); free(texture); } @@ -1066,6 +1069,8 @@ getValueForKey(char *domain, char *keyName) return val; } + + char* getPixmapPath(char *domain) { diff --git a/wrlib/scale.c b/wrlib/scale.c index df181d6d..4e05291a 100644 --- a/wrlib/scale.c +++ b/wrlib/scale.c @@ -141,3 +141,101 @@ RScaleImage(RImage *image, unsigned new_width, unsigned new_height) return img; } + + +RImage* +RSmoothScaleImage(RImage *image, unsigned new_width, unsigned new_height) +{ + int ox; + int px, py; + register int x, y, t; + int dx, dy; + unsigned char *sr, *sg, *sb, *sa; + unsigned char *dr, *dg, *db, *da; + RImage *img; + + assert(new_width >= 0 && new_height >= 0); + + if (new_width == image->width && new_height == image->height) + return RCloneImage(image); + + img = RCreateImage(new_width, new_height, image->data[3]!=NULL); + + if (!img) + return NULL; + + dx = (image->width<<16)/new_width; + dy = (image->height<<16)/new_height; + + py = 0; + + dr = img->data[0]; + dg = img->data[1]; + db = img->data[2]; + da = img->data[3]; + + if (image->data[3]!=NULL) { + int ot; + ot = -1; + for (y=0; ywidth*(py>>16); + + sr = image->data[0]+t; + sg = image->data[1]+t; + sb = image->data[2]+t; + sa = image->data[3]+t; + + ot = t; + ox = 0; + px = 0; + for (x=0; x>16; + ox += t<<16; + + sr += t; + sg += t; + sb += t; + sa += t; + } + py += dy; + } + } else { + int ot; + ot = -1; + for (y=0; ywidth*(py>>16); + + sr = image->data[0]+t; + sg = image->data[1]+t; + sb = image->data[2]+t; + + ot = t; + ox = 0; + px = 0; + for (x=0; x>16; + ox += t<<16; + + sr += t; + sg += t; + sb += t; + } + py += dy; + } + } + + return img; +} -- 2.11.4.GIT