Fix pixmap and gc caching when rendering to drawables with different depths.
SVN revision: 22769
This commit is contained in:
parent
0819b731e5
commit
fbef280324
|
@ -249,6 +249,7 @@ __imlib_RenderImage(Display * d, ImlibImage * im,
|
||||||
DATA32 *buf = NULL, *pointer = NULL, *back = NULL;
|
DATA32 *buf = NULL, *pointer = NULL, *back = NULL;
|
||||||
int y, h, hh, jump;
|
int y, h, hh, jump;
|
||||||
static Display *disp = NULL;
|
static Display *disp = NULL;
|
||||||
|
static int last_depth = 0;
|
||||||
static GC gc = 0;
|
static GC gc = 0;
|
||||||
static GC gcm = 0;
|
static GC gcm = 0;
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
|
@ -459,25 +460,28 @@ __imlib_RenderImage(Display * d, ImlibImage * im,
|
||||||
__imlib_FreeScaleInfo(scaleinfo);
|
__imlib_FreeScaleInfo(scaleinfo);
|
||||||
if (back)
|
if (back)
|
||||||
free(back);
|
free(back);
|
||||||
/* if we changed diplays since last time... free old gc's */
|
/* if we changed diplays or depth since last time... free old gc */
|
||||||
if (disp != d)
|
if ((gc) && ((last_depth != depth) || (disp != d)))
|
||||||
{
|
{
|
||||||
if (gc)
|
|
||||||
XFreeGC(disp, gc);
|
XFreeGC(disp, gc);
|
||||||
if (gcm)
|
|
||||||
XFreeGC(disp, gcm);
|
|
||||||
gc = 0;
|
gc = 0;
|
||||||
gcm = 0;
|
|
||||||
}
|
}
|
||||||
/* if we didnt have a gc... create it */
|
/* if we didnt have a gc... create it */
|
||||||
if (!gc)
|
if (!gc)
|
||||||
{
|
{
|
||||||
disp = d;
|
disp = d;
|
||||||
|
last_depth = depth;
|
||||||
gcv.graphics_exposures = False;
|
gcv.graphics_exposures = False;
|
||||||
gc = XCreateGC(d, w, GCGraphicsExposures, &gcv);
|
gc = XCreateGC(d, w, GCGraphicsExposures, &gcv);
|
||||||
}
|
}
|
||||||
if (m)
|
if (m)
|
||||||
{
|
{
|
||||||
|
/* if we changed diplays since last time... free old gc */
|
||||||
|
if ((gcm) && (disp != d))
|
||||||
|
{
|
||||||
|
XFreeGC(disp, gcm);
|
||||||
|
gcm = 0;
|
||||||
|
}
|
||||||
if (!gcm)
|
if (!gcm)
|
||||||
{
|
{
|
||||||
gcv.graphics_exposures = False;
|
gcv.graphics_exposures = False;
|
||||||
|
|
|
@ -180,8 +180,7 @@ __imlib_ProduceXImage(Display * d, Visual * v, int depth, int w, int h,
|
||||||
|
|
||||||
/* if the image has the same depth, width and height - recycle it */
|
/* if the image has the same depth, width and height - recycle it */
|
||||||
/* as long as its not used */
|
/* as long as its not used */
|
||||||
if ( (list_xim[i]->bits_per_pixel == depth) ||
|
if (list_xim[i]->depth == depth)
|
||||||
((list_xim[i]->bits_per_pixel == 32) && (depth == 24)) )
|
|
||||||
depth_ok = 1;
|
depth_ok = 1;
|
||||||
if ( depth_ok &&
|
if ( depth_ok &&
|
||||||
(list_xim[i]->width >= w) &&
|
(list_xim[i]->width >= w) &&
|
||||||
|
|
Loading…
Reference in New Issue