DirectFB - Home of the pragmatist Roadmap


[directfb-dev] A question about src/misc/gfx_utils.c
Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[directfb-dev] A question about src/misc/gfx_utils.c



Hello,
I cannot understand function dfb_scale_linear_32 in gfx_utils.c. Could
anybody please give me some information on how it works? And I have a
question about following pieces of code (from DirectFB 0.9.15:

void dfb_scale_linear_32( void *dst, __u32 *src, int sw, int sh,
int dw, int dh, int dpitch,
DFBSurfacePixelFormat dst_format,
CorePalette *palette )
{
...
...
(__u8 *)outbuf =
dst + i * (DFB_BYTES_PER_PIXEL (dst_format) * dw + dskip);
(__u8 *)outbuf_end = outbuf + DFB_BYTES_PER_PIXEL (dst_format) * dw;
x = scaled_x_offset;
x_start = x >> SCALE_SHIFT;
dest_x = 0;

while (x_start < 0 && outbuf < outbuf_end) {
scale_pixel( run_weights + ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS))
& SUBSAMPLE_MASK) * (filter.n_x * filter.n_y),
filter.n_x, filter.n_y, outbuf, line_bufs,
x >> SCALE_SHIFT, sw, dst_format, palette );

x += x_step;
x_start = x >> SCALE_SHIFT;
dest_x++;
(__u8 *)outbuf += DFB_BYTES_PER_PIXEL (dst_format);
}

new_outbuf = scale_line (run_weights, filter.n_x, filter.n_y, outbuf,
outbuf_end, line_bufs, x >> SCALE_SHIFT,
x_step, sw, dst_format, palette);

dest_x += (new_outbuf - outbuf) / DFB_BYTES_PER_PIXEL (dst_format);
x = dest_x * x_step + scaled_x_offset;
outbuf = new_outbuf;

while (outbuf < outbuf_end) {
scale_pixel( run_weights + ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS))
& SUBSAMPLE_MASK) * (filter.n_x * filter.n_y),
filter.n_x, filter.n_y, outbuf, line_bufs,
x >> SCALE_SHIFT, sw, dst_format, palette);

x += x_step;
(__u8 *)outbuf += DFB_BYTES_PER_PIXEL (dst_format);
}

y += y_step;
}
...
}

Questions:
1) Should just let outbuf equal to dpitch * i?
2) After call new_outbuf = scale_line (...); new_outbuf should equal to
outbuf_end according to the source code of scale_line. Then the last
while (outbuf < outbuf_end) {...} loop should have no effect?!

Regards
James Su




-- 
Info:  To unsubscribe send a mail to listar@directfb.org with 
"unsubscribe directfb-dev" as subject.



Home | Main Index | Thread Index


directfb.org / Development / Old Archives