bool BilinearScalerInternal_X1Y12(Texture *tex, sint32 sx, sint32 sy, sint32 sw, sint32 sh, 
						uint8* pixel, sint32 dw, sint32 dh, sint32 pitch, bool clamp_src)
{
	// Source buffer pointers
	uintS *texel = reinterpret_cast<uintS*>(tex->buffer) + (sy * tex->width + sx);
	int tpitch = tex->width;
	uintS *tline_end = texel + (sw);
	uintS *tex_end = texel + (sh-5)*tex->width;
	int tex_diff = (tex->width*5) - sw;

	uint8 a[4], b[4], c[4], d[4], e[4], l[4];
	uint8 cols[6][4];

	bool clip_y = true;
	if (sh+sy < tex->height && clamp_src == false)
	{
		clip_y = false;
		tex_end = texel + (sh)*tex->width;
	}

	// Src Loop Y
	do {
		// Src Loop X
		do {
			Read6(a,b,c,d,e,l);
			texel++;

			X1xY12xDoCols();
			X1xY12xInnerLoop();
			pixel -= pitch*6-sizeof(uintX);

		} while (texel != tline_end);

		pixel += pitch*6-sizeof(uintX)*(dw);
		texel += tex_diff;
		tline_end += tpitch*5;

	} while (texel != tex_end);


	//
	// Final Rows - Clipping
	//

	// Src Loop Y
	if (clip_y) {
		// Src Loop X
		do {
			Read6_Clipped(a,b,c,d,e,l);
			texel++;

			X1xY12xDoCols();
			X1xY12xInnerLoop();
			pixel -= pitch*6-sizeof(uintX);

		} while (texel != tline_end);
	}

	return true;
}
Example #2
0
LONG Read(ULONG BlockAdr,
              UWORD TransferLen, void *buffer)
{{{
  if (BlockAdr > cMaxBlockAdr)
    return Read10(BlockAdr, TransferLen, buffer);
  else
    return Read6(BlockAdr, TransferLen, buffer);
}}}