Fix tabs.

This commit is contained in:
castano 2011-01-19 07:25:49 +00:00
parent 5324156cc4
commit 4fc1952539

View File

@ -480,10 +480,11 @@ void ColorSet::setColors(const float * data, uint img_w, uint img_h, uint img_x,
{ {
for (uint x = 0; x < w; x++, i++) for (uint x = 0; x < w; x++, i++)
{ {
colors[i].x = r[x + img_x, y + img_y]; uint idx = x + img_x + (y + img_y) * img_w;
colors[i].y = g[x + img_x, y + img_y]; colors[i].x = r[idx];
colors[i].z = b[x + img_x, y + img_y]; colors[i].y = g[idx];
colors[i].w = a[x + img_x, y + img_y]; colors[i].z = b[idx];
colors[i].w = a[idx];
} }
} }
} }
@ -531,8 +532,8 @@ void ColorSet::createMinimalSet(bool ignoreTransparent)
// allocate a new point // allocate a new point
if (j == i) if (j == i)
{ {
colors[n] = C[i]; colors[n] = C[i];
weights[n] = W[i]; weights[n] = W[i];
remap[idx] = n; remap[idx] = n;
n++; n++;
break; break;
@ -542,16 +543,16 @@ void ColorSet::createMinimalSet(bool ignoreTransparent)
bool colorMatch = (C[i].x == C[j].x) && (C[i].w == C[j].w) && (C[i].z == C[j].z); bool colorMatch = (C[i].x == C[j].x) && (C[i].w == C[j].w) && (C[i].z == C[j].z);
//bool alphaMatch = (C[i].w == C[j].w); //bool alphaMatch = (C[i].w == C[j].w);
if (colorMatch) if (colorMatch)
{ {
// get the index of the match // get the index of the match
int index = remap[j]; int index = remap[j];
// map to this point and increase the weight // map to this point and increase the weight
weights[index] += W[i]; weights[index] += W[i];
remap[idx] = index; remap[idx] = index;
break; break;
} }
} }
} }
} }