Simplify ImageclassApplySimple and ScaleRect.

SVN revision: 33312
This commit is contained in:
Kim Woelders 2007-12-30 21:18:04 +00:00
parent 636ad94d4c
commit d40357d2ec
6 changed files with 18 additions and 52 deletions

View File

@ -2479,20 +2479,12 @@ CB_AreaDisplayRedraw(Dialog * d __UNUSED__, int val, void *data)
ImageClass *ic;
ic = ImageclassFind("SETTINGS_AREA_AREA", 0);
if (ic)
ImageclassApply(ic, win, 0, 0, STATE_NORMAL, ST_SOLID);
ImageclassApply(ic, win, 0, 0, STATE_NORMAL, ST_SOLID);
awin = ECreateWindow(win, 0, 0, 18, 14, 0);
ic = ImageclassFind("SETTINGS_AREADESK_AREA", 0);
if (ic)
{
Pixmap pmap;
ImageclassApply(ic, awin, 0, 0, STATE_NORMAL, ST_SOLID);
pmap = ImageclassApplySimple(ic, awin, None, STATE_NORMAL,
0, 0, 18, 14);
ESetWindowBackgroundPixmap(awin, pmap);
EFreePixmap(pmap);
}
EClearWindow(awin);
called = 1;
}
EMoveResizeWindow(awin, ((w / 2) - (9 * tmp_area_x)),

View File

@ -473,7 +473,7 @@ EImageApplyToWin(EImage * im, Win win, int flags, int w, int h)
}
void
ScaleRect(Win wsrc, Drawable src, Win wdst, Pixmap dst, Pixmap * pdst,
ScaleRect(Win wsrc, Drawable src, Win wdst, Pixmap dst,
int sx, int sy, int sw, int sh,
int dx, int dy, int dw, int dh, int scale)
{
@ -483,15 +483,7 @@ ScaleRect(Win wsrc, Drawable src, Win wdst, Pixmap dst, Pixmap * pdst,
im = EImageGrabDrawableScaled(wsrc, src, None, sx, sy, sw, sh,
scale * dw, scale * dh, 0, 0);
if (pdst)
{
EImageRenderPixmaps(im, wdst, EIMAGE_ANTI_ALIAS, pdst, None, dw, dh);
}
else
{
EImageRenderOnDrawable(im, wdst, dst, EIMAGE_ANTI_ALIAS,
dx, dy, dw, dh);
}
EImageRenderOnDrawable(im, wdst, dst, EIMAGE_ANTI_ALIAS, dx, dy, dw, dh);
imlib_free_image();
}

View File

@ -102,8 +102,7 @@ void EImageColorModifierSetTables(EImageColorModifier * icm,
unsigned char *b,
unsigned char *a);
void ScaleRect(Win wsrc, Drawable src,
Win wdst, Pixmap dst, Pixmap * pdst,
void ScaleRect(Win wsrc, Drawable src, Win wdst, Pixmap dst,
int sx, int sy, int sw, int sh,
int dx, int dy, int dw, int dh, int scale);

View File

@ -806,29 +806,18 @@ ImageclassGetImage(ImageClass * ic, int active, int sticky, int state)
return im;
}
Pixmap
void
ImageclassApplySimple(ImageClass * ic, Win win, Drawable draw, int state,
int x, int y, int w, int h)
{
Pixmap pmap;
EImage *im;
im = ImageclassGetImage(ic, 0, 0, state);
if (!im)
return None;
pmap = None;
if (draw == None)
{
pmap = ECreatePixmap(win, w, h, 0);
draw = pmap;
x = y = 0;
}
return;
EImageRenderOnDrawable(im, win, draw, 0, x, y, w, h);
EImageFree(im);
return pmap;
}
#ifdef ENABLE_TRANSPARENCY

View File

@ -105,7 +105,7 @@ ImageState *ImageclassGetImageState(ImageClass * ic, int state,
ImageClass *ImageclassCreateSimple(const char *name, const char *image);
EImage *ImageclassGetImage(ImageClass * ic, int active, int sticky,
int state);
Pixmap ImageclassApplySimple(ImageClass * ic, Win win,
void ImageclassApplySimple(ImageClass * ic, Win win,
Drawable draw, int state, int x,
int y, int w, int h);
void ImageclassApply(ImageClass * ic, Win win,

View File

@ -248,7 +248,7 @@ PagerScanTimeout(int val __UNUSED__, void *data)
y = ((phase & 0xfffffff8) + offsets[phase % 8]) % hh;
y2 = (y * VRoot.h) / hh;
ScaleRect(VRoot.win, VRoot.xwin, p->win, WinGetPmap(p->win), NULL, 0, y2,
ScaleRect(VRoot.win, VRoot.xwin, p->win, WinGetPmap(p->win), 0, y2,
VRoot.w, VRoot.h / hh, xx, yy + y, ww, 1, Conf_pagers.hiq);
EClearArea(p->win, xx, yy + y, ww, 1, False);
y2 = p->h;
@ -256,7 +256,7 @@ PagerScanTimeout(int val __UNUSED__, void *data)
y = ((phase & 0xfffffff8) + offsets[phase % 8]) % ww;
y2 = (y * VRoot.w) / ww;
ScaleRect(VRoot.win, VRoot.xwin, p->win, WinGetPmap(p->win), NULL, y2, 0,
ScaleRect(VRoot.win, VRoot.xwin, p->win, WinGetPmap(p->win), y2, 0,
VRoot.w / ww, VRoot.h, xx + y, yy, 1, hh, Conf_pagers.hiq);
EClearArea(p->win, xx + y, yy, 1, hh, False);
y2 = p->w;
@ -327,6 +327,8 @@ PagerEwinUpdateMini(Pager * p, EWin * ewin)
ewin->mini_w = w;
ewin->mini_h = h;
ewin->mini_pmm.type = 0;
ewin->mini_pmm.pmap = ECreatePixmap(p->win, w, h, 0);
draw = None;
if (pager_mode != PAGER_MODE_SIMPLE)
@ -342,21 +344,13 @@ PagerEwinUpdateMini(Pager * p, EWin * ewin)
ImageClass *ic;
ic = ImageclassFind("PAGER_WIN", 0);
if (ic)
{
ewin->mini_pmm.type = 0;
ewin->mini_pmm.mask = None;
ewin->mini_pmm.pmap =
ImageclassApplySimple(ic, p->win, None, STATE_NORMAL,
0, 0, w, h);
}
ImageclassApplySimple(ic, p->win, ewin->mini_pmm.pmap,
STATE_NORMAL, 0, 0, w, h);
Dprintf("Use Iclass, pmap=%#lx\n", ewin->mini_pmm.pmap);
}
else
{
ewin->mini_pmm.type = 1;
ewin->mini_pmm.mask = None;
ScaleRect(EoGetWin(ewin), draw, p->win, None, &ewin->mini_pmm.pmap,
ScaleRect(EoGetWin(ewin), draw, p->win, ewin->mini_pmm.pmap,
0, 0, EoGetW(ewin), EoGetH(ewin), 0, 0, w, h,
Conf_pagers.hiq);
Dprintf("Grab scaled, pmap=%#lx\n", ewin->mini_pmm.pmap);
@ -487,7 +481,7 @@ doPagerUpdate(Pager * p)
do_screen_update:
Dprintf("doPagerUpdate %d: Snap screen\n", p->dsk->num);
/* Update pager area by snapshotting entire screen */
ScaleRect(VRoot.win, VRoot.xwin, p->win, pmap, NULL, 0, 0,
ScaleRect(VRoot.win, VRoot.xwin, p->win, pmap, 0, 0,
VRoot.w, VRoot.h, cx * p->dw, cy * p->dh, p->dw, p->dh,
Conf_pagers.hiq);
@ -617,7 +611,7 @@ PagerUpdateBg(Pager * p)
if (pager_mode != PAGER_MODE_SIMPLE && p->dsk->bg.pmap)
{
ScaleRect(VRoot.win, p->dsk->bg.pmap, p->win, pmap, NULL, 0, 0,
ScaleRect(VRoot.win, p->dsk->bg.pmap, p->win, pmap, 0, 0,
VRoot.w, VRoot.h, 0, 0, p->dw, p->dh, Conf_pagers.hiq);
return;
}