Cleaned up some duplicated pixel format-related code in Font files.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-12-29 02:45:27 -04:00
parent 4a3889ae48
commit 8aa6725039
15 changed files with 88 additions and 105 deletions
+4 -16
View File
@@ -27,6 +27,7 @@
#include "common/Exception.h"
#include "common/StringMap.h"
#include "common/int.h"
#include "common/pixelformat.h"
// stdlib
#include <string>
@@ -57,14 +58,7 @@ public:
static love::Type type;
enum Format
{
FORMAT_LUMINANCE_ALPHA,
FORMAT_RGBA,
FORMAT_MAX_ENUM
};
GlyphData(uint32 glyph, GlyphMetrics glyphMetrics, Format f);
GlyphData(uint32 glyph, GlyphMetrics glyphMetrics, PixelFormat f);
virtual ~GlyphData();
// Implements Data.
@@ -139,10 +133,7 @@ public:
/**
* Gets the format of the glyph data.
**/
Format getFormat() const;
static bool getConstant(const char *in, Format &out);
static bool getConstant(Format in, const char *&out);
PixelFormat getFormat() const;
private:
@@ -156,10 +147,7 @@ private:
uint8 *data;
// The format the data's in.
Format format;
static StringMap<Format, FORMAT_MAX_ENUM>::Entry formatEntries[];
static StringMap<Format, FORMAT_MAX_ENUM> formats;
PixelFormat format;
}; // GlyphData