Skip to content

Commit

Permalink
Revert BitBlt to Avs2.6a5-implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
pylorak committed Dec 23, 2013
1 parent 13d1967 commit 2d3cb6c
Showing 1 changed file with 18 additions and 29 deletions.
47 changes: 18 additions & 29 deletions avs_core/core/bitblt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,40 +256,29 @@ static void asm_BitBlt_ISSE(BYTE* dstp, int dst_pitch, const BYTE* srcp, int src

#endif //X86_32

void BitBlt(BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height) {

// "row_size" is the number of data bytes in a row.
// "pitch" is the distance in bytes between two rows.
// Therefore, by definition, "pitch" is at least as great as "row_size".
assert(dst_pitch >= row_size);
assert(src_pitch >= row_size);

void BitBlt(BYTE* dstp, int dst_pitch, const BYTE* srcp, int src_pitch, int row_size, int height)
{
if ( (!height) || (!row_size) ) return;

if ( ((src_pitch == dst_pitch) && (dst_pitch == row_size)) || (height == 1) )
{ // we can copy the whole buffer in one go

#ifdef X86_32
if (GetCPUFlags() & CPUF_INTEGER_SSE)
memcpy_amd(dstp, srcp, src_pitch*height); // SSE
else
#endif
memcpy(dstp, srcp, src_pitch*height); // fallback
}
else
{ // we must convert between the different pitch values

#ifdef X86_32
if (GetCPUFlags() & CPUF_INTEGER_SSE)
if (GetCPUFlags() & CPUF_INTEGER_SSE)
{
if (height == 1 || (src_pitch == dst_pitch && dst_pitch == row_size)) {
memcpy_amd(dstp, srcp, row_size*height);
} else {
asm_BitBlt_ISSE(dstp,dst_pitch,srcp,src_pitch,row_size,height);
else
}
return;
}
#endif
{
for (int y=height; y>0; --y) {
memcpy(dstp, srcp, row_size);
dstp += dst_pitch;
srcp += src_pitch;
}

if (height == 1 || (dst_pitch == src_pitch && src_pitch == row_size)) {
memcpy(dstp, srcp, row_size*height);
} else {
for (int y = height; y > 0; --y) {
memcpy(dstp, srcp, row_size);
dstp += dst_pitch;
srcp += src_pitch;
}
}
}

0 comments on commit 2d3cb6c

Please sign in to comment.