- fixed the usedcolor array's base type.

The usedcolors array which counts the number of pixels in a given color in a font used bytes as storage, so any color that just happened to have a count that is a multiple of 256 the color was considered not present.
This commit is contained in:
Christoph Oelckers 2019-02-22 18:19:26 +01:00
parent 3d4b5ae8a3
commit e06aa28620
5 changed files with 8 additions and 9 deletions

View file

@ -471,7 +471,7 @@ FFont *FFont::FindFont (FName name)
//
//==========================================================================
void RecordTextureColors (FImageSource *pic, uint8_t *usedcolors)
void RecordTextureColors (FImageSource *pic, uint32_t *usedcolors)
{
int x;
@ -524,7 +524,7 @@ static int compare (const void *arg1, const void *arg2)
//
//==========================================================================
int FFont::SimpleTranslation (uint8_t *colorsused, uint8_t *translation, uint8_t *reverse, TArray<double> &Luminosity)
int FFont::SimpleTranslation (uint32_t *colorsused, uint8_t *translation, uint8_t *reverse, TArray<double> &Luminosity)
{
double min, max, diver;
int i, j;
@ -889,10 +889,10 @@ int FFont::StringWidth(const uint8_t *string) const
void FFont::LoadTranslations()
{
unsigned int count = LastChar - FirstChar + 1;
uint8_t usedcolors[256], identity[256];
uint32_t usedcolors[256] = {};
uint8_t identity[256];
TArray<double> Luminosity;
memset (usedcolors, 0, 256);
for (unsigned int i = 0; i < count; i++)
{
if (Chars[i].TranslatedPic)

View file

@ -39,6 +39,6 @@ extern uint16_t upperforlower[65536];
class FImageSource;
void RecordTextureColors (FImageSource *pic, uint8_t *usedcolors);
void RecordTextureColors (FImageSource *pic, uint32_t *usedcolors);
bool myislower(int code);
int stripaccent(int code);

View file

@ -153,12 +153,12 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FTexture **l
void FSpecialFont::LoadTranslations()
{
int count = LastChar - FirstChar + 1;
uint8_t usedcolors[256], identity[256];
uint32_t usedcolors[256] = {};
uint8_t identity[256];
TArray<double> Luminosity;
int TotalColors;
int i, j;
memset (usedcolors, 0, 256);
for (i = 0; i < count; i++)
{
if (Chars[i].TranslatedPic)

View file

@ -63,7 +63,6 @@
#define DEFAULT_LOG_COLOR PalEntry(223,223,223)
// TYPES -------------------------------------------------------------------
void RecordTextureColors (FImageSource *pic, uint8_t *colorsused);
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------

View file

@ -114,7 +114,7 @@ protected:
const void *ranges, int total_colors, const PalEntry *palette);
void FixXMoves();
static int SimpleTranslation (uint8_t *colorsused, uint8_t *translation,
static int SimpleTranslation (uint32_t *colorsused, uint8_t *translation,
uint8_t *identity, TArray<double> &Luminosity);
void ReadSheetFont(TArray<FolderEntry> &folderdata, int width, int height, const DVector2 &Scale);