Unify pixel format enums for ImageData, CompressedImageData, and Canvas into a single PixelFormat enum.

Replace love.graphics.getRawImageFormats and love.graphics.getCompressedImageFormats with love.graphics.getImageFormats.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2016-11-27 22:53:23 -04:00
parent cbba8c40a6
commit 0a3adc0839
50 changed files with 1042 additions and 1006 deletions
+3 -53
View File
@@ -25,6 +25,7 @@
#include "common/Data.h"
#include "common/StringMap.h"
#include "common/int.h"
#include "common/pixelformat.h"
// STL
#include <vector>
@@ -43,49 +44,6 @@ class CompressedImageData : public Data
{
public:
// Recognized compressed image data formats.
enum Format
{
FORMAT_UNKNOWN,
FORMAT_DXT1,
FORMAT_DXT3,
FORMAT_DXT5,
FORMAT_BC4,
FORMAT_BC4s,
FORMAT_BC5,
FORMAT_BC5s,
FORMAT_BC6H,
FORMAT_BC6Hs,
FORMAT_BC7,
FORMAT_PVR1_RGB2,
FORMAT_PVR1_RGB4,
FORMAT_PVR1_RGBA2,
FORMAT_PVR1_RGBA4,
FORMAT_ETC1,
FORMAT_ETC2_RGB,
FORMAT_ETC2_RGBA,
FORMAT_ETC2_RGBA1,
FORMAT_EAC_R,
FORMAT_EAC_Rs,
FORMAT_EAC_RG,
FORMAT_EAC_RGs,
FORMAT_ASTC_4x4,
FORMAT_ASTC_5x4,
FORMAT_ASTC_5x5,
FORMAT_ASTC_6x5,
FORMAT_ASTC_6x6,
FORMAT_ASTC_8x5,
FORMAT_ASTC_8x6,
FORMAT_ASTC_8x8,
FORMAT_ASTC_10x5,
FORMAT_ASTC_10x6,
FORMAT_ASTC_10x8,
FORMAT_ASTC_10x10,
FORMAT_ASTC_12x10,
FORMAT_ASTC_12x12,
FORMAT_MAX_ENUM
};
// Compressed image data can have multiple mipmap levels, each represented
// by a sub-image.
struct SubImage
@@ -131,16 +89,13 @@ public:
/**
* Gets the format of the compressed data.
**/
Format getFormat() const;
PixelFormat getFormat() const;
bool isSRGB() const;
static bool getConstant(const char *in, Format &out);
static bool getConstant(Format in, const char *&out);
protected:
Format format;
PixelFormat format;
bool sRGB;
@@ -153,11 +108,6 @@ protected:
void checkMipmapLevelExists(int miplevel) const;
private:
static StringMap<Format, FORMAT_MAX_ENUM>::Entry formatEntries[];
static StringMap<Format, FORMAT_MAX_ENUM> formats;
}; // CompressedImageData
} // image