求解位图缩放代码
static void copyrow2(unsigned short *src, int src_w, unsigned short *dst, int dst_w) {
int i;
int pos, inc;
unsigned short pixel = 0;
pos = 0x10000;
inc = (src_w << 16) / dst_w;
for (i = dst_w; i > 0; --i) {
while (pos >= 0x10000) {
pixel = *src++;
pos -= 0x10000;
}
*dst++ = pixel;
pos += inc;
}
}
static void scretch2(unsigned short* src, int sw, int sh, int sstr, int srx, int sry, int srw, int srh,
unsigned short* dst, int dw, int dh, int dstr, int drx, int dry, int drw, int drh) {
int pos, inc;
int dst_max_row;
int src_row, dst_row;
unsigned short *srcp, *dstp;
pos = 0x10000;
inc = (srh << 16) / drh;
src_row = sry;
dst_row = dry;
for (dst_max_row = dst_row + drh; dst_row < dst_max_row; ++dst_row ) {
while (pos >= 0x10000) {
srcp = src + src_row * sstr + srx;
++src_row;
pos -= 0x10000;
}
dstp = dst + dst_row * dstr + drx;
copyrow2(srcp, srw, dstp, drw);
pos += inc;
}
}
哪位大神来帮我看看这段位图缩放代码 我实在看不懂 求解 帮我解释一下 拜托了