forked from e16/e16
1
0
Fork 0

Introduce PmapMaskInit().

SVN revision: 53807
This commit is contained in:
Kim Woelders 2010-10-23 10:22:52 +00:00
parent 288a6c0541
commit 15ede64ea1
5 changed files with 37 additions and 42 deletions

View File

@ -603,6 +603,24 @@ EDrawableDumpImage(Drawable draw, const char *txt)
}
#endif
void
PmapMaskInit(PmapMask * pmm, Win win, int w, int h)
{
if (pmm->pmap)
{
if (pmm->w == w && pmm->h == h && pmm->depth == WinGetDepth(win))
return;
PmapMaskFree(pmm);
}
pmm->type = 0;
pmm->depth = WinGetDepth(win);
pmm->pmap = ECreatePixmap(win, w, h, 0);
pmm->mask = None;
pmm->w = w;
pmm->h = h;
}
void
PmapMaskFree(PmapMask * pmm)
{

View File

@ -243,7 +243,6 @@ struct _ewin {
int area_x, area_y;
char *session_id;
PmapMask mini_pmm;
int mini_w, mini_h;
int shape_x, shape_y, shape_w, shape_h;
int req_x, req_y;

View File

@ -89,7 +89,7 @@ HiwinRenderImageInit(Hiwin * phi)
{
phi->im =
EImageGrabDrawable(ewin->mini_pmm.pmap, ewin->mini_pmm.mask, 0, 0,
ewin->mini_w, ewin->mini_h, 0);
ewin->mini_pmm.w, ewin->mini_pmm.h, 0);
}
ESetWindowBackgroundPixmap(EoGetWin(phi), None);

View File

@ -268,7 +268,7 @@ PagerHiwinUpdate(Hiwin * phi, Pager * p __UNUSED__, EWin * ewin)
return;
im = EImageGrabDrawable(ewin->mini_pmm.pmap, None, 0, 0,
ewin->mini_w, ewin->mini_h, 0);
ewin->mini_pmm.w, ewin->mini_pmm.h, 0);
EImageRenderOnDrawable(im, EoGetWin(phi), 0, 0, 0, EoGetW(phi), EoGetH(phi));
EImageDecache(im);
}
@ -294,7 +294,7 @@ PagerEwinUpdateMini(Pager * p, EWin * ewin)
update = 0;
if (!ewin->mini_pmm.pmap)
update = 1;
if (ewin->mini_w != w || ewin->mini_h != h)
if (ewin->mini_pmm.w != w || ewin->mini_pmm.h != h)
update = 1;
if (serdif > 0 && ewin->type != EWIN_TYPE_PAGER &&
@ -312,12 +312,7 @@ PagerEwinUpdateMini(Pager * p, EWin * ewin)
p->do_update = 1;
PmapMaskFree(&ewin->mini_pmm);
ewin->mini_w = w;
ewin->mini_h = h;
ewin->mini_pmm.type = 0;
ewin->mini_pmm.pmap = ECreatePixmap(p->win, w, h, 0);
PmapMaskInit(&ewin->mini_pmm, p->win, w, h);
draw = None;
if (pager_mode != PAGER_MODE_SIMPLE)
@ -916,21 +911,7 @@ PagerEwinUpdateFromPager(Pager * p, EWin * ewin)
if (!gc)
gc = EXCreateGC(WinGetPmap(p->win), 0, NULL);
/* NB! If the pixmap/mask was created by imlib, free it. Due to imlibs */
/* image/pixmap cache it may be in use elsewhere. */
if (ewin->mini_pmm.pmap &&
((ewin->mini_pmm.type) || (ewin->mini_w != w) || (ewin->mini_h != h)))
PmapMaskFree(&ewin->mini_pmm);
if (!ewin->mini_pmm.pmap)
{
ewin->mini_w = w;
ewin->mini_h = h;
ewin->mini_pmm.type = 0;
ewin->mini_pmm.pmap = ECreatePixmap(p->win, w, h, 0);
ewin->mini_pmm.mask = None;
}
PmapMaskInit(&ewin->mini_pmm, p->win, w, h);
if (!ewin->mini_pmm.pmap)
return;
@ -1288,19 +1269,22 @@ PagersUpdateBackground(Desk * dsk)
}
static void
PagerSetHiQ(char onoff)
_EwinsMiniFree(void)
{
EWin *const *lst;
int i, num;
Conf_pagers.hiq = onoff;
lst = EwinListGetAll(&num);
for (i = 0; i < num; i++)
{
lst[i]->mini_w = 0;
lst[i]->mini_h = 0;
}
PmapMaskFree(&(lst[i]->mini_pmm));
}
static void
PagerSetHiQ(char onoff)
{
Conf_pagers.hiq = onoff;
_EwinsMiniFree();
PagersUpdateBackground(NULL);
@ -1316,19 +1300,11 @@ _PagerSetSnap(Pager * p, void *prm __UNUSED__)
static void
PagersSetMode(int mode)
{
EWin *const *lst;
int i, num;
if (mode == Conf_pagers.mode)
return;
Conf_pagers.mode = mode;
lst = EwinListGetAll(&num);
for (i = 0; i < num; i++)
{
lst[i]->mini_w = 0;
lst[i]->mini_h = 0;
}
_EwinsMiniFree();
PagersUpdateBackground(NULL);

View File

@ -282,11 +282,13 @@ Atom EInternAtom(const char *name);
typedef struct {
char type;
char depth;
Pixmap pmap;
Pixmap mask;
int w, h;
unsigned short w, h;
} PmapMask;
void PmapMaskInit(PmapMask * pmm, Win win, int w, int h);
void PmapMaskFree(PmapMask * pmm);
#if USE_COMPOSITE