forked from old/legacy-imlib2
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;
|
||||
int y, h, hh, jump;
|
||||
static Display *disp = NULL;
|
||||
static int last_depth = 0;
|
||||
static GC gc = 0;
|
||||
static GC gcm = 0;
|
||||
XGCValues gcv;
|
||||
|
@ -459,25 +460,28 @@ __imlib_RenderImage(Display * d, ImlibImage * im,
|
|||
__imlib_FreeScaleInfo(scaleinfo);
|
||||
if (back)
|
||||
free(back);
|
||||
/* if we changed diplays since last time... free old gc's */
|
||||
if (disp != d)
|
||||
/* if we changed diplays or depth since last time... free old gc */
|
||||
if ((gc) && ((last_depth != depth) || (disp != d)))
|
||||
{
|
||||
if (gc)
|
||||
XFreeGC(disp, gc);
|
||||
if (gcm)
|
||||
XFreeGC(disp, gcm);
|
||||
XFreeGC(disp, gc);
|
||||
gc = 0;
|
||||
gcm = 0;
|
||||
}
|
||||
/* if we didnt have a gc... create it */
|
||||
if (!gc)
|
||||
{
|
||||
disp = d;
|
||||
last_depth = depth;
|
||||
gcv.graphics_exposures = False;
|
||||
gc = XCreateGC(d, w, GCGraphicsExposures, &gcv);
|
||||
}
|
||||
if (m)
|
||||
{
|
||||
/* if we changed diplays since last time... free old gc */
|
||||
if ((gcm) && (disp != d))
|
||||
{
|
||||
XFreeGC(disp, gcm);
|
||||
gcm = 0;
|
||||
}
|
||||
if (!gcm)
|
||||
{
|
||||
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 */
|
||||
/* as long as its not used */
|
||||
if ( (list_xim[i]->bits_per_pixel == depth) ||
|
||||
((list_xim[i]->bits_per_pixel == 32) && (depth == 24)) )
|
||||
if (list_xim[i]->depth == depth)
|
||||
depth_ok = 1;
|
||||
if ( depth_ok &&
|
||||
(list_xim[i]->width >= w) &&
|
||||
|
|
Loading…
Reference in New Issue