~ubuntu-branches/ubuntu/maverick/blender/maverick

« back to all changes in this revision

Viewing changes to source/blender/imbuf/intern/dds/ColorBlock.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Khashayar Naderehvandi, Khashayar Naderehvandi, Alessio Treglia
  • Date: 2009-01-22 16:53:59 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090122165359-v0996tn7fbit64ni
Tags: 2.48a+dfsg-1ubuntu1
[ Khashayar Naderehvandi ]
* Merge from debian experimental (LP: #320045), Ubuntu remaining changes:
  - Add patch correcting header file locations.
  - Add libvorbis-dev and libgsm1-dev to Build-Depends.
  - Use avcodec_decode_audio2() in source/blender/src/hddaudio.c

[ Alessio Treglia ]
* Add missing previous changelog entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
53
53
{
54
54
}
55
55
 
 
56
/// Init the color block from an array of colors.
 
57
ColorBlock::ColorBlock(const uint * linearImage)
 
58
{
 
59
        for(uint i = 0; i < 16; i++) {
 
60
                color(i) = Color32(linearImage[i]);
 
61
        }
 
62
}
 
63
 
56
64
/// Init the color block with the contents of the given block.
57
65
ColorBlock::ColorBlock(const ColorBlock & block)
58
66
{
125
133
/// Returns true if the block has a single color.
126
134
bool ColorBlock::isSingleColor() const
127
135
{
 
136
        Color32 mask(0xFF, 0xFF, 0xFF, 0x00);
 
137
        uint u = m_color[0].u & mask.u;
 
138
        
128
139
        for(int i = 1; i < 16; i++)
129
140
        {
130
 
                if (m_color[0] != m_color[i])
 
141
                if (u != (m_color[i].u & mask.u))
 
142
                {
 
143
                        return false;
 
144
                }
 
145
        }
 
146
        
 
147
        return true;
 
148
}
 
149
 
 
150
/// Returns true if the block has a single color, ignoring transparent pixels.
 
151
bool ColorBlock::isSingleColorNoAlpha() const
 
152
{
 
153
        Color32 c;
 
154
        int i;
 
155
        for(i = 0; i < 16; i++)
 
156
        {
 
157
                if (m_color[i].a != 0) c = m_color[i];
 
158
        }
 
159
 
 
160
        Color32 mask(0xFF, 0xFF, 0xFF, 0x00);
 
161
        uint u = c.u & mask.u;
 
162
 
 
163
        for(; i < 16; i++)
 
164
        {
 
165
                if (u != (m_color[i].u & mask.u))
131
166
                {
132
167
                        return false;
133
168
                }