BilinearScalerInternal_X1Y12.cpp

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2005 The Pentagram Team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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         // Source buffer pointers
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         // Src Loop Y
00048         do {
00049                 // Src Loop X
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         // Final Rows - Clipping
00069         //
00070 
00071         // Src Loop Y
00072         if (clip_y) {
00073                 // Src Loop X
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 

Generated on Fri Jul 27 22:27:10 2007 for pentagram by  doxygen 1.4.7