00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "pent_include.h"
00020 #include "BilinearScalerInternal.h"
00021 #include "Manips.h"
00022
00023
00024 namespace Pentagram {
00025
00026 template<class uintX, class Manip, class uintS>
00027 bool BilinearScalerInternal_X1Y12(Texture *tex, sint32 sx, sint32 sy, sint32 sw, sint32 sh,
00028 uint8* pixel, sint32 dw, sint32 dh, sint32 pitch, bool clamp_src)
00029 {
00030
00031 uintS *texel = reinterpret_cast<uintS*>(tex->buffer) + (sy * tex->width + sx);
00032 int tpitch = tex->width;
00033 uintS *tline_end = texel + (sw);
00034 uintS *tex_end = texel + (sh-5)*tex->width;
00035 int tex_diff = (tex->width*5) - sw;
00036
00037 uint8 a[4], b[4], c[4], d[4], e[4], l[4];
00038 uint8 cols[6][4];
00039
00040 bool clip_y = true;
00041 if (sh+sy < tex->height && clamp_src == false)
00042 {
00043 clip_y = false;
00044 tex_end = texel + (sh)*tex->width;
00045 }
00046
00047
00048 do {
00049
00050 do {
00051 Read6(a,b,c,d,e,l);
00052 texel++;
00053
00054 X1xY12xDoCols();
00055 X1xY12xInnerLoop();
00056 pixel -= pitch*6-sizeof(uintX);
00057
00058 } while (texel != tline_end);
00059
00060 pixel += pitch*6-sizeof(uintX)*(dw);
00061 texel += tex_diff;
00062 tline_end += tpitch*5;
00063
00064 } while (texel != tex_end);
00065
00066
00067
00068
00069
00070
00071
00072 if (clip_y) {
00073
00074 do {
00075 Read6_Clipped(a,b,c,d,e,l);
00076 texel++;
00077
00078 X1xY12xDoCols();
00079 X1xY12xInnerLoop();
00080 pixel -= pitch*6-sizeof(uintX);
00081
00082 } while (texel != tline_end);
00083 }
00084
00085 return true;
00086 }
00087
00088 InstantiateBilinearScalerFunc(BilinearScalerInternal_X1Y12);
00089
00090 };
00091