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_X2Y24(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-1);
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], f[4], g[4], h[4], i[4], j[4], k[4], l[4];
00038 uint8 cols[2][12][4];
00039
00040 bool clip_x = true;
00041 if (sw+sx < tex->width && clamp_src == false)
00042 {
00043 clip_x = false;
00044 tline_end = texel + (sw+1);
00045 tex_diff--;
00046 }
00047
00048 bool clip_y = true;
00049 if (sh+sy < tex->height && clamp_src == false)
00050 {
00051 clip_y = false;
00052 tex_end = texel + (sh)*tex->width;
00053 }
00054
00055
00056
00057 do {
00058 Read6(a,b,c,d,e,l);
00059 texel++;
00060
00061 X2xY24xDoColsA();
00062
00063
00064 do {
00065 Read6(f,g,h,i,j,k);
00066 texel++;
00067
00068 X2xY24xDoColsB();
00069 X2xY24xInnerLoop(0,1);
00070 pixel -= pitch*12-sizeof(uintX)*2;
00071
00072 Read6(a,b,c,d,e,l);
00073 texel++;
00074
00075 X2xY24xDoColsA();
00076 X2xY24xInnerLoop(1,0);
00077 pixel -= pitch*12-sizeof(uintX)*2;
00078 } while (texel != tline_end);
00079
00080
00081 if (clip_x) {
00082 Read6(f,g,h,i,j,k);
00083 texel++;
00084
00085 X2xY24xDoColsB();
00086 X2xY24xInnerLoop(0,1);
00087 pixel -= pitch*12-sizeof(uintX)*2;
00088
00089 X2xY24xInnerLoop(1,1);
00090 pixel -= pitch*12-sizeof(uintX)*2;
00091 }
00092
00093 pixel += pitch*12-sizeof(uintX)*(dw);
00094 texel += tex_diff;
00095 tline_end += tpitch*5;
00096 } while (texel != tex_end);
00097
00098
00099
00100
00101
00102
00103
00104 if (clip_y) {
00105 Read6_Clipped(a,b,c,d,e,l);
00106 texel++;
00107
00108 X2xY24xDoColsA();
00109
00110
00111 do {
00112 Read6_Clipped(f,g,h,i,j,k);
00113 texel++;
00114
00115 X2xY24xDoColsB();
00116 X2xY24xInnerLoop(0,1);
00117 pixel -= pitch*12-sizeof(uintX)*2;
00118
00119 Read6_Clipped(a,b,c,d,e,l);
00120 texel++;
00121
00122 X2xY24xDoColsA();
00123 X2xY24xInnerLoop(1,0);
00124 pixel -= pitch*12-sizeof(uintX)*2;
00125 } while (texel != tline_end);
00126
00127
00128 if (clip_x) {
00129 Read6_Clipped(f,g,h,i,j,k);
00130 texel++;
00131
00132 X2xY24xDoColsB();
00133
00134 X2xY24xInnerLoop(0,1);
00135 pixel -= pitch*12-sizeof(uintX)*2;
00136
00137 X2xY24xInnerLoop(1,1);
00138 pixel -= pitch*12-sizeof(uintX)*2;
00139 };
00140 }
00141
00142 return true;
00143 }
00144
00145 InstantiateBilinearScalerFunc(BilinearScalerInternal_X2Y24);
00146
00147 };
00148