forked from old/legacy-imlib2
Fix y-upscaling in imlib_create_scaled_image_from_drawable()
This commit is contained in:
parent
add72b4023
commit
6e27c1e2c3
|
@ -846,12 +846,13 @@ __imlib_GrabDrawableScaledToRGBA(DATA32 * data, int nu_x_dst, int nu_y_dst,
|
|||
{
|
||||
int rc;
|
||||
int tmpmask = 0;
|
||||
int i, xx;
|
||||
int h_tmp, i, xx;
|
||||
XGCValues gcv;
|
||||
GC gc = 0, mgc = 0;
|
||||
Pixmap psc, msc;
|
||||
|
||||
psc = XCreatePixmap(d, p, w_dst, h_src, depth);
|
||||
h_tmp = h_dst > h_src ? h_dst : h_src;
|
||||
psc = XCreatePixmap(d, p, w_dst, h_tmp, depth);
|
||||
|
||||
gcv.foreground = 0;
|
||||
gcv.subwindow_mode = IncludeInferiors;
|
||||
|
@ -897,7 +898,7 @@ __imlib_GrabDrawableScaledToRGBA(DATA32 * data, int nu_x_dst, int nu_y_dst,
|
|||
{
|
||||
if (*pdomask)
|
||||
{
|
||||
msc = XCreatePixmap(d, p, w_dst, h_src, 1);
|
||||
msc = XCreatePixmap(d, p, w_dst, h_tmp, 1);
|
||||
if (!mgc)
|
||||
mgc =
|
||||
XCreateGC(d, msc, GCForeground | GCGraphicsExposures, &gcv);
|
||||
|
@ -912,16 +913,33 @@ __imlib_GrabDrawableScaledToRGBA(DATA32 * data, int nu_x_dst, int nu_y_dst,
|
|||
if (msc != None)
|
||||
XCopyArea(d, m, msc, mgc, xx, 0, 1, h_src, i, 0);
|
||||
}
|
||||
for (i = 0; i < h_dst; i++)
|
||||
if (h_dst > h_src)
|
||||
{
|
||||
xx = (h_src * i) / h_dst;
|
||||
XCopyArea(d, psc, psc, gc, 0, xx, w_dst, 1, 0, i);
|
||||
if (msc != None)
|
||||
XCopyArea(d, msc, msc, mgc, 0, xx, w_dst, 1, 0, i);
|
||||
for (i = h_dst - 1; i > 0; i--)
|
||||
{
|
||||
xx = (h_src * i) / h_dst;
|
||||
if (xx == i)
|
||||
continue; /* Don't copy onto self */
|
||||
XCopyArea(d, psc, psc, gc, 0, xx, w_dst, 1, 0, i);
|
||||
if (msc != None)
|
||||
XCopyArea(d, msc, msc, mgc, 0, xx, w_dst, 1, 0, i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < h_dst; i++)
|
||||
{
|
||||
xx = (h_src * i) / h_dst;
|
||||
if (xx == i)
|
||||
continue; /* Don't copy onto self */
|
||||
XCopyArea(d, psc, psc, gc, 0, xx, w_dst, 1, 0, i);
|
||||
if (msc != None)
|
||||
XCopyArea(d, msc, msc, mgc, 0, xx, w_dst, 1, 0, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rc = __imlib_GrabDrawableToRGBA(data, 0, 0, w_dst, h_src, d, psc, msc,
|
||||
rc = __imlib_GrabDrawableToRGBA(data, 0, 0, w_dst, h_dst, d, psc, msc,
|
||||
v, cm, depth, 0, 0, w_dst, h_dst,
|
||||
pdomask, grab);
|
||||
|
||||
|
|
|
@ -131,14 +131,8 @@ _test_grab_1(int w, int h, int x0, int y0)
|
|||
|
||||
xs = xd.scale > 0 ? xd.scale * x0 : x0;
|
||||
ws = xd.scale > 0 ? xd.scale * w : w;
|
||||
#if 0
|
||||
// FIXME - y scaling doesn't work
|
||||
ys = xd.scale > 0 ? xd.scale * y0 : y0;
|
||||
hs = xd.scale > 0 ? xd.scale * h : h;
|
||||
#else
|
||||
ys = y0;
|
||||
hs = h;
|
||||
#endif
|
||||
|
||||
if (xd.scale == 0)
|
||||
im = imlib_create_image_from_drawable(None, x0, y0, w, h, 0);
|
||||
|
|
Loading…
Reference in New Issue