1*2f083884Ss.makeev_local /* -----------------------------------------------------------------------------
2*2f083884Ss.makeev_local
3*2f083884Ss.makeev_local Copyright (c) 2006 Simon Brown [email protected]
4*2f083884Ss.makeev_local
5*2f083884Ss.makeev_local Permission is hereby granted, free of charge, to any person obtaining
6*2f083884Ss.makeev_local a copy of this software and associated documentation files (the
7*2f083884Ss.makeev_local "Software"), to deal in the Software without restriction, including
8*2f083884Ss.makeev_local without limitation the rights to use, copy, modify, merge, publish,
9*2f083884Ss.makeev_local distribute, sublicense, and/or sell copies of the Software, and to
10*2f083884Ss.makeev_local permit persons to whom the Software is furnished to do so, subject to
11*2f083884Ss.makeev_local the following conditions:
12*2f083884Ss.makeev_local
13*2f083884Ss.makeev_local The above copyright notice and this permission notice shall be included
14*2f083884Ss.makeev_local in all copies or substantial portions of the Software.
15*2f083884Ss.makeev_local
16*2f083884Ss.makeev_local THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17*2f083884Ss.makeev_local OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18*2f083884Ss.makeev_local MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19*2f083884Ss.makeev_local IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20*2f083884Ss.makeev_local CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21*2f083884Ss.makeev_local TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22*2f083884Ss.makeev_local SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23*2f083884Ss.makeev_local
24*2f083884Ss.makeev_local -------------------------------------------------------------------------- */
25*2f083884Ss.makeev_local
26*2f083884Ss.makeev_local #include "colourfit.h"
27*2f083884Ss.makeev_local #include "colourset.h"
28*2f083884Ss.makeev_local
29*2f083884Ss.makeev_local namespace squish {
30*2f083884Ss.makeev_local
ColourFit(ColourSet const * colours,int flags)31*2f083884Ss.makeev_local ColourFit::ColourFit( ColourSet const* colours, int flags )
32*2f083884Ss.makeev_local : m_colours( colours ),
33*2f083884Ss.makeev_local m_flags( flags )
34*2f083884Ss.makeev_local {
35*2f083884Ss.makeev_local }
36*2f083884Ss.makeev_local
Compress(void * block)37*2f083884Ss.makeev_local void ColourFit::Compress( void* block )
38*2f083884Ss.makeev_local {
39*2f083884Ss.makeev_local bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 );
40*2f083884Ss.makeev_local if( isDxt1 )
41*2f083884Ss.makeev_local {
42*2f083884Ss.makeev_local Compress3( block );
43*2f083884Ss.makeev_local if( !m_colours->IsTransparent() )
44*2f083884Ss.makeev_local Compress4( block );
45*2f083884Ss.makeev_local }
46*2f083884Ss.makeev_local else
47*2f083884Ss.makeev_local Compress4( block );
48*2f083884Ss.makeev_local }
49*2f083884Ss.makeev_local
50*2f083884Ss.makeev_local } // namespace squish
51