Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
borders.c iclass.c x.c xwin.h
Log Message:
Fix caching of imlib images (has been severely crippled for some time).
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.275
retrieving revision 1.276
diff -u -3 -r1.275 -r1.276
--- borders.c 26 Sep 2005 17:32:09 -0000 1.275
+++ borders.c 16 Oct 2005 16:27:46 -0000 1.276
@@ -161,8 +161,8 @@
#if 0 /* Debug */
Eprintf("EwinBorderDraw %#lx %s d=%d s=%d p=%d\n",
- _EwinGetClientXwin(ewin), EoGetName(ewin), EoGetDesk(ewin), do_shape,
- do_paint);
+ _EwinGetClientXwin(ewin), EoGetName(ewin), EoGetDeskNum(ewin),
+ do_shape, do_paint);
#endif
for (i = 0; i < ewin->border->num_winparts; i++)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iclass.c,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -3 -r1.77 -r1.78
--- iclass.c 16 Oct 2005 13:59:52 -0000 1.77
+++ iclass.c 16 Oct 2005 16:27:48 -0000 1.78
@@ -830,6 +830,7 @@
#ifdef ENABLE_TRANSPARENCY
Imlib_Image *ii = NULL;
int flags;
+ Pixmap pmap, mask;
flags = ICLASS_ATTR_OPAQUE;
if (Conf.trans.alpha > 0)
@@ -964,36 +965,36 @@
#endif
}
- pmm->type = 1;
- imlib_render_pixmaps_for_whole_image_at_size(&pmm->pmap, &pmm->mask,
- w, h);
- if (ii && make_mask && !(flags & ICLASS_ATTR_NO_CLIP))
+ if (ii)
+ {
+ pmm->type = 0;
+ pmap = ECreatePixmap(win, w, h, VRoot.depth);
+ imlib_context_set_drawable(pmap);
+ imlib_render_image_on_drawable_at_size(0, 0, w, h);
+ imlib_context_set_drawable(win);
+ pmm->pmap = pmap;
+ pmm->mask = None;
+ }
+ else
{
- Pixmap pmap = 0, mask = 0;
- GC gc;
+ pmm->type = 1;
+ imlib_render_pixmaps_for_whole_image_at_size(&pmm->pmap,
+ &pmm->mask, w, h);
+ }
+ if (ii && make_mask && !(flags & ICLASS_ATTR_NO_CLIP))
+ {
imlib_context_set_image(is->im);
if (imlib_image_has_alpha())
{
- /* Due to the blending the mask will always be 0 here */
-
/* Make the scaled clip mask to be used */
imlib_render_pixmaps_for_whole_image_at_size(&pmap, &mask, w,
h);
- /* And now some uglyness to make a single "Imlib2
pixmap/mask" thing */
-
- /* Replace the pmap with the previously blended one */
- gc = ECreateGC(pmm->pmap, 0, NULL);
- XCopyArea(disp, pmm->pmap, pmap, gc, 0, 0, w, h, 0, 0);
- EFreeGC(gc);
-
- /* Free the old pixmap without associated mask */
- imlib_free_pixmap_and_mask(pmm->pmap);
+ /* Replace the mask with the correct one */
+ pmm->mask = ECreatePixmapCopy(mask, w, h, 1);
- /* We now have the copied pixmap with proper mask */
- pmm->pmap = pmap;
- pmm->mask = mask;
+ imlib_free_pixmap_and_mask(pmap);
}
}
#else
@@ -1042,7 +1043,7 @@
if (ii)
{
imlib_context_set_image(ii);
- imlib_free_image();
+ imlib_free_image_and_decache();
}
#else
make_mask = 0;
@@ -1178,39 +1179,38 @@
if (is->im && w <= 8192 && h <= 8192)
{
PmapMask pmm;
- int decache = 1;
ImagestateMakePmapMask(is, win, &pmm, 1, w, h, image_type);
if (pmm.pmap)
{
+ Pixmap pmap = pmm.pmap;
+
if (ts && text)
{
- TextstateDrawText(ts, pmm.pmap, text, ic->padding.left,
+ if (pmm.type != 0)
+ pmap = ECreatePixmapCopy(pmm.pmap, w, h, VRoot.depth);
+
+ TextstateDrawText(ts, pmap, text, ic->padding.left,
ic->padding.top,
w - (ic->padding.left +
ic->padding.right),
h - (ic->padding.top +
ic->padding.bottom),
0, TextclassGetJustification(tc));
- decache = 1;
}
/* Set window pixmap */
+ ESetWindowBackgroundPixmap(win, pmap);
+ if (pmap != pmm.pmap)
+ EFreePixmap(pmap);
+
if (pmm.w == w && pmm.h == h)
- {
- ESetWindowBackgroundPixmap(win, pmm.pmap);
- EShapeCombineMask(win, ShapeBounding, 0, 0,
- pmm.mask, ShapeSet);
- }
- else
- {
- /* Tiled */
- ESetWindowBackgroundPixmap(win, pmm.pmap);
- if (pmm.mask)
- EShapeCombineMaskTiled(win, ShapeBounding, 0, 0,
- pmm.mask, ShapeSet, w, h);
- }
+ EShapeCombineMask(win, ShapeBounding, 0, 0,
+ pmm.mask, ShapeSet);
+ else if (pmm.mask)
+ EShapeCombineMaskTiled(win, ShapeBounding, 0, 0,
+ pmm.mask, ShapeSet, w, h);
}
FreePmapMask(&pmm);
@@ -1219,10 +1219,7 @@
if ((is->unloadable) || (Conf.memory_paranoia))
{
imlib_context_set_image(is->im);
- if (decache)
- imlib_free_image_and_decache();
- else
- imlib_free_image();
+ imlib_free_image();
is->im = NULL;
}
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -3 -r1.110 -r1.111
--- x.c 15 Oct 2005 20:27:32 -0000 1.110
+++ x.c 16 Oct 2005 16:27:48 -0000 1.111
@@ -1290,6 +1290,21 @@
ExShapePropagate(xid);
}
+Pixmap
+ECreatePixmapCopy(Pixmap src, unsigned int w, unsigned int h,
+ unsigned int depth)
+{
+ Pixmap pmap;
+ GC gc;
+
+ pmap = ECreatePixmap(src, w, h, depth);
+ gc = ECreateGC(src, 0, NULL);
+ XCopyArea(disp, src, pmap, gc, 0, 0, w, h, 0, 0);
+ EFreeGC(gc);
+
+ return pmap;
+}
+
GC
ECreateGC(Drawable d, unsigned long mask, XGCValues * val)
{
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/xwin.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- xwin.h 26 Sep 2005 17:32:10 -0000 1.6
+++ xwin.h 16 Oct 2005 16:27:48 -0000 1.7
@@ -90,8 +90,6 @@
#define ELowerWindow(win) XLowerWindow(disp, win)
#define EClearWindow(win) XClearWindow(disp, win)
#define EClearArea(win, x, y, w, h, exp) XClearArea(disp, win, x, y, w, h, exp)
-#define ECreatePixmap(draw, w, h, dep) XCreatePixmap(disp, draw, w, h, dep)
-#define EFreePixmap(pmap) XFreePixmap(disp, pmap)
void EShapeCombineMask(Window win, int dest, int x, int y,
Pixmap pmap, int op);
@@ -108,6 +106,11 @@
void EShapePropagate(Window win);
Pixmap EWindowGetShapePixmap(Window win);
+#define ECreatePixmap(draw, w, h, depth) XCreatePixmap(disp, draw, w, h, depth)
+#define EFreePixmap(pmap) XFreePixmap(disp, pmap)
+Pixmap ECreatePixmapCopy(Pixmap src, unsigned int w,
+ unsigned int h, unsigned int depth);
+
GC ECreateGC(Drawable d, unsigned long mask, XGCValues * val);
int EFreeGC(GC gc);
-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs