[gimp-dds] / tags / release-2.0.4 / imath.h Repository:
ViewVC logotype

View of /tags/release-2.0.4/imath.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 106 - (download) (as text) (annotate)
Thu May 8 01:29:25 2008 UTC (18 months, 2 weeks ago) by cocidius
File size: 1310 byte(s)
Release 2.0.4 tag
    1 /*
    2    DDS GIMP plugin
    3 
    4    Copyright (C) 2004-2008 Shawn Kirst <skirst@insightbb.com>,
    5    with parts (C) 2003 Arne Reuter <homepage@arnereuter.de> where specified.
    6 
    7    This program is free software; you can redistribute it and/or
    8    modify it under the terms of the GNU General Public
    9    License as published by the Free Software Foundation; either
   10    version 2 of the License, or (at your option) any later version.
   11 
   12    This program is distributed in the hope that it will be useful,
   13    but WITHOUT ANY WARRANTY; without even the implied warranty of
   14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   15    General Public License for more details.
   16 
   17    You should have received a copy of the GNU General Public License
   18    along with this program; see the file COPYING.  If not, write to
   19    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   20    Boston, MA 02111-1307, USA.
   21 */
   22 
   23 #ifndef IMATH_H
   24 #define IMATH_H
   25 
   26 static inline int mul8bit(int a, int b)
   27 {
   28    int t = a * b + 128;
   29    return((t + (t >> 8)) >> 8);
   30 }
   31 
   32 static inline int blerp(int a, int b, int x)
   33 {
   34    return(a + mul8bit(b - a, x));
   35 }
   36 
   37 static inline int icerp(int a, int b, int c, int d, int x)
   38 {
   39    int p = (d - c) - (a - b);
   40    int q = (a - b) - p;
   41    int r = c - a;
   42    return((x * (x * (x * p + (q << 7)) + (r << 14)) + (b << 21)) >> 21);
   43 }
   44 
   45 #endif

ViewVC Help
Powered by ViewVC 1.0.4