90
90
// c.u |= (c.u >> 6) & 0x000300;
91
91
// color_array[1].u = c.u;
93
if( col0.u > col1.u ) {
93
if ( col0.u > col1.u ) {
94
94
// Four-color block: derive the other two colors.
95
95
color_array[2].r = (2 * color_array[0].r + color_array[1].r) / 3;
96
96
color_array[2].g = (2 * color_array[0].g + color_array[1].g) / 3;
135
135
color_array[1].b = (3 * col1.b * 22) / 8;
136
136
color_array[1].a = 0xFF;
138
int gdiff = color_array[1].g - color_array[0].g;
138
int gdiff = color_array[1].g - color_array[0].g;
140
if( col0.u > col1.u ) {
140
if ( col0.u > col1.u ) {
141
141
// Four-color block: derive the other two colors.
142
color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8;
143
color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256;
144
color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8;
142
color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8;
143
color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256;
144
color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8;
145
145
color_array[2].a = 0xFF;
147
color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8;
148
color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256;
149
color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8;
147
color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8;
148
color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256;
149
color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8;
150
150
color_array[3].a = 0xFF;
155
155
// Three-color block: derive the other color.
156
color_array[2].r = ((col0.r + col1.r) * 33) / 8;
157
color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
158
color_array[2].b = ((col0.b + col1.b) * 33) / 8;
156
color_array[2].r = ((col0.r + col1.r) * 33) / 8;
157
color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256;
158
color_array[2].b = ((col0.b + col1.b) * 33) / 8;
159
159
color_array[2].a = 0xFF;
161
161
// Set all components to 0 to match DXT specs.
227
227
evaluatePalette(color_array);
229
229
// Write color block.
230
for( uint j = 0; j < 4; j++ ) {
231
for( uint i = 0; i < 4; i++ ) {
230
for ( uint j = 0; j < 4; j++ ) {
231
for ( uint i = 0; i < 4; i++ ) {
232
232
uint idx = (row[j] >> (2 * i)) & 3;
233
233
block->color(i, j) = color_array[idx];
242
242
evaluatePaletteNV5x(color_array);
244
244
// Write color block.
245
for( uint j = 0; j < 4; j++ ) {
246
for( uint i = 0; i < 4; i++ ) {
245
for ( uint j = 0; j < 4; j++ ) {
246
for ( uint i = 0; i < 4; i++ ) {
247
247
uint idx = (row[j] >> (2 * i)) & 3;
248
248
block->color(i, j) = color_array[idx];
496
496
uint8 index_array[16];
497
497
alpha.indices(index_array);
499
for(uint i = 0; i < 16; i++) {
499
for (uint i = 0; i < 16; i++) {
500
500
Color32 & c = block->color(i);
501
501
c.b = c.g = c.r = alpha_array[index_array[i]];
525
525
x.evaluatePalette(alpha_array);
526
526
x.indices(index_array);
528
for(uint i = 0; i < 16; i++) {
528
for (uint i = 0; i < 16; i++) {
529
529
Color32 & c = block->color(i);
530
530
c.r = alpha_array[index_array[i]];
533
533
y.evaluatePalette(alpha_array);
534
534
y.indices(index_array);
536
for(uint i = 0; i < 16; i++) {
536
for (uint i = 0; i < 16; i++) {
537
537
Color32 & c = block->color(i);
538
538
c.g = alpha_array[index_array[i]];
587
587
evaluatePalette(color_array);
589
589
// Write color block.
590
for( uint j = 0; j < 4; j++ ) {
591
for( uint i = 0; i < 4; i++ ) {
590
for ( uint j = 0; j < 4; j++ ) {
591
for ( uint i = 0; i < 4; i++ ) {
592
592
uint idx = (row[j] >> (2 * i)) & 3;
593
593
block->color(i, j) = color_array[idx];