Move Color.h from modules/graphics/ to common/

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-08-01 23:53:44 -03:00
parent c11a4250e8
commit b129d49a6c
15 changed files with 41 additions and 49 deletions
-7
View File
@@ -38,13 +38,6 @@ namespace love
namespace image
{
// Pixel format structure.
struct pixel
{
// Red, green, blue, alpha.
unsigned char r, g, b, a;
};
union Pixel
{
uint8 rgba8[4];
+4 -1
View File
@@ -21,6 +21,7 @@
// LOVE
#include "STBHandler.h"
#include "image/ImageData.h"
#include "common/Color.h"
static void loveSTBIAssert(bool test, const char *teststr)
{
@@ -49,6 +50,8 @@ namespace image
namespace magpie
{
static_assert(sizeof(Color) == 4, "sizeof(Color) must equal 4 bytes!");
bool STBHandler::canDecode(love::filesystem::FileData *data)
{
int w = 0;
@@ -144,7 +147,7 @@ FormatHandler::EncodedImage STBHandler::encode(const DecodedImage &img, EncodedF
memcpy(encimg.data + headerlen, img.data, img.width * img.height * bpp);
// convert the pixels from RGBA to BGRA.
pixel *encodedpixels = (pixel *) (encimg.data + headerlen);
Color *encodedpixels = (Color *) (encimg.data + headerlen);
for (int y = 0; y < img.height; y++)
{
for (int x = 0; x < img.width; x++)