Remove whitespace lines

This commit is contained in:
Joshua Granick
2018-07-18 17:32:51 -07:00
parent d3269a79ad
commit 78e99bf1d9
447 changed files with 36856 additions and 36888 deletions

View File

@@ -9,18 +9,18 @@
namespace lime {
class ColorMatrix {
public:
ColorMatrix ();
ColorMatrix (value colorMatrix);
ColorMatrix (ArrayBufferView* colorMatrix);
~ColorMatrix ();
float GetAlphaMultiplier ();
float GetAlphaOffset ();
void GetAlphaTable (unsigned char* table);
@@ -34,17 +34,17 @@ namespace lime {
float GetRedMultiplier ();
float GetRedOffset ();
void GetRedTable (unsigned char* table);
float data[20];
private:
void GetDataTable (unsigned char* table, float multiplier, float offset);
};
}

View File

@@ -6,10 +6,10 @@
namespace lime {
struct Matrix3 {
hl_type* t;
double a;
double b;
@@ -17,17 +17,17 @@ namespace lime {
double d;
double tx;
double ty;
Matrix3 (double a, double b, double c, double d, double tx, double ty);
Matrix3 (value matrix3);
void SetTo (double a, double b, double c, double d, double tx, double ty);
value Value ();
value Value (value matrix3);
};
}

View File

@@ -6,27 +6,27 @@
namespace lime {
struct Rectangle {
hl_type* t;
double height;
double width;
double x;
double y;
Rectangle (double x, double y, double width, double height);
Rectangle (value rect);
void Contract (double x, double y, double width, double height);
void SetTo (double x, double y, double width, double height);
value Value ();
value Value (value rect);
};
}

View File

@@ -6,25 +6,25 @@
namespace lime {
struct Vector2 {
hl_type* t;
double length;
double x;
double y;
Vector2 (double x, double y);
Vector2 (value vec);
void SetTo (double x, double y);
value Value ();
value Value (value vec);
};
}

View File

@@ -9,212 +9,212 @@
namespace lime {
int __alpha16[0xFF + 1];
int __clamp[0xFF + 0xFF + 1];
static int a16;
static double unmult;
int initValues () {
for (int i = 0; i < 256; i++) {
__alpha16[i] = (int) ceil ((float)(i + 1) * ((1 << 16) / 0xFF));
__alpha16[i] = (int) ceil ((float)(i + 1) * ((1 << 16) / 0xFF));
}
for (int i = 0; i < 0xFF; i++) {
__clamp[i] = i;
}
for (int i = 0xFF; i < (0xFF + 0xFF + 1); i++) {
__clamp[i] = 0xFF;
}
return 0;
}
static int initValues_ = initValues ();
struct RGBA {
public:
inline RGBA () {
r = 0;
g = 0;
b = 0;
a = 0;
}
inline RGBA (int32_t rgba) {
r = (rgba >> 24) & 0xFF;
g = (rgba >> 16) & 0xFF;
b = (rgba >> 8) & 0xFF;
a = rgba & 0xFF;
}
inline RGBA (unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
Set (r, g, b, a);
}
inline int32_t Get () {
int32_t value = ((r & 0xFF) << 24) | ((g & 0xFF) << 16) | ((b & 0xFF) << 8) | (a & 0xFF);
return value;
}
inline void MultiplyAlpha () {
if (a == 0) {
Set (0, 0, 0, 0);
} else if (a != 0xFF) {
a16 = __alpha16[a];
Set ((r * a16) >> 16, (g * a16) >> 16, (b * a16) >> 16, a);
}
}
inline void UnmultiplyAlpha () {
if (a != 0 && a != 0xFF) {
unmult = 255.0 / a;
Set (__clamp[(int)(r * unmult)], __clamp[(int)(g * unmult)], __clamp[(int)(b * unmult)], a);
}
}
inline void ReadUInt8 (const unsigned char* data, int offset, PixelFormat format, bool premultiplied, Endian endian) {
switch (format) {
case BGRA32:
if (endian == LIME_LITTLE_ENDIAN)
Set (data[offset + 1], data[offset + 2], data[offset + 3], data[offset]);
else
Set (data[offset + 2], data[offset + 1], data[offset], data[offset + 3]);
break;
case RGBA32:
if (endian == LIME_LITTLE_ENDIAN)
Set (data[offset + 3], data[offset + 2], data[offset + 1], data[offset]);
else
Set (data[offset], data[offset + 1], data[offset + 2], data[offset + 3]);
break;
case ARGB32:
if (endian == LIME_LITTLE_ENDIAN)
Set (data[offset + 2], data[offset + 1], data[offset], data[offset + 3]);
else
Set (data[offset + 1], data[offset + 2], data[offset + 3], data[offset]);
break;
}
if (premultiplied) {
UnmultiplyAlpha ();
}
}
inline void Set (unsigned char r, unsigned char g, unsigned char b, unsigned char a) {
this->r = r;
this->g = g;
this->b = b;
this->a = a;
}
inline void WriteUInt8 (unsigned char* data, int offset, PixelFormat format, bool premultiplied) {
if (premultiplied) {
MultiplyAlpha ();
}
switch (format) {
case BGRA32:
data[offset] = b;
data[offset + 1] = g;
data[offset + 2] = r;
data[offset + 3] = a;
break;
case RGBA32:
data[offset] = r;
data[offset + 1] = g;
data[offset + 2] = b;
data[offset + 3] = a;
break;
case ARGB32:
data[offset] = a;
data[offset + 1] = r;
data[offset + 2] = g;
data[offset + 3] = b;
break;
}
}
inline bool operator == (RGBA& rgba) {
return (a == rgba.a && r == rgba.r && g == rgba.g && b == rgba.b);
}
unsigned char r;
unsigned char g;
unsigned char b;
unsigned char a;
};
}