1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-11 17:37:23 +00:00

"Cosmetics" Introduce a memcpy function doing both transparent

and non-transparent copy.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21938 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2007-01-16 07:01:53 +00:00
parent 9c56f01564
commit e6c460e462

View File

@ -43,6 +43,25 @@ static int gif_check_file(demuxer_t *demuxer)
return 0; return 0;
} }
static void memcpy_transp_pic(uint8_t *dst, uint8_t *src, int w, int h,
int dstride, int sstride, int transp, uint8_t trans_col) {
if (transp) {
dstride -= w;
sstride -= w;
while (h-- > 0) {
int wleft = w;
while (wleft-- > 0) {
if (*src != trans_col)
*dst = *src;
dst++; src++;
}
dst += dstride;
src += sstride;
}
} else
memcpy_pic(dst, src, w, h, dstride, sstride);
}
static int demux_gif_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds) static int demux_gif_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
{ {
gif_priv_t *priv = demuxer->priv; gif_priv_t *priv = demuxer->priv;
@ -148,21 +167,8 @@ static int demux_gif_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
priv->palette[(y * 4) + 3] = 0; priv->palette[(y * 4) + 3] = 0;
} }
if (transparency) { memcpy_transp_pic(dest, buf, w, h, priv->w, gif->Image.Width,
uint8_t *dpos = dest, *spos = buf; transparency, transparent_col);
int hleft = h;
while (hleft-- > 0) {
int wleft = w;
while (wleft-- > 0) {
if (*spos != transparent_col)
*dpos = *spos;
dpos++; spos++;
}
dpos += priv->w - w;
spos += gif->Image.Width - w;
}
} else
memcpy_pic(dest, buf, w, h, priv->w, gif->Image.Width);
if (refmode == 1) memcpy(priv->refimg, dp->buffer, priv->w * priv->h); if (refmode == 1) memcpy(priv->refimg, dp->buffer, priv->w * priv->h);
if (refmode == 2 && priv->useref) { if (refmode == 2 && priv->useref) {