mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-07-01 13:56:06 -04:00
Replace unsigned int, and char with uint and uchar.
This commit is contained in:
@ -129,11 +129,11 @@ static bool InitPaletteList(const string& filename)
|
||||
/// <param name="rgb">The RGB buffer</param>
|
||||
/// <param name="width">The width of the image in pixels</param>
|
||||
/// <param name="height">The height of the image in pixels</param>
|
||||
static void RgbaToRgb(vector<unsigned char>& rgba, vector<unsigned char>& rgb, size_t width, size_t height)
|
||||
static void RgbaToRgb(vector<byte>& rgba, vector<byte>& rgb, size_t width, size_t height)
|
||||
{
|
||||
rgb.resize(width * height * 3);
|
||||
|
||||
for (unsigned int i = 0, j = 0; i < (width * height * 4); i += 4, j += 3)
|
||||
for (uint i = 0, j = 0; i < (width * height * 4); i += 4, j += 3)
|
||||
{
|
||||
rgb[j] = rgba[i];
|
||||
rgb[j + 1] = rgba[i + 1];
|
||||
@ -149,9 +149,9 @@ static void RgbaToRgb(vector<unsigned char>& rgba, vector<unsigned char>& rgb, s
|
||||
/// <param name="memAvailable">Amount of memory available on the system</param>
|
||||
/// <param name="useMem">The maximum amount of memory to use. Use max if 0.</param>
|
||||
/// <returns>The number of strips to use</returns>
|
||||
static unsigned int CalcStrips(double memRequired, double memAvailable, double useMem)
|
||||
static uint CalcStrips(double memRequired, double memAvailable, double useMem)
|
||||
{
|
||||
unsigned int strips;
|
||||
uint strips;
|
||||
|
||||
if (useMem > 0)
|
||||
memAvailable = useMem;
|
||||
@ -161,7 +161,7 @@ static unsigned int CalcStrips(double memRequired, double memAvailable, double u
|
||||
if (memAvailable >= memRequired)
|
||||
return 1;
|
||||
|
||||
strips = (unsigned int)ceil(memRequired / memAvailable);
|
||||
strips = (uint)ceil(memRequired / memAvailable);
|
||||
|
||||
return strips;
|
||||
}
|
||||
@ -239,7 +239,7 @@ static T NextLowestEvenDiv(T numerator, T denominator)
|
||||
/// <param name="errorReport">The error report for holding errors if anything goes wrong</param>
|
||||
/// <returns>A pointer to the created renderer if successful, else false.</returns>
|
||||
template <typename T, typename bucketT>
|
||||
static Renderer<T, bucketT>* CreateRenderer(eRendererType renderType, unsigned int platform, unsigned int device, bool shared, GLuint texId, EmberReport& errorReport)
|
||||
static Renderer<T, bucketT>* CreateRenderer(eRendererType renderType, uint platform, uint device, bool shared, GLuint texId, EmberReport& errorReport)
|
||||
{
|
||||
string s;
|
||||
unique_ptr<Renderer<T, bucketT>> renderer;
|
||||
@ -275,7 +275,7 @@ static Renderer<T, bucketT>* CreateRenderer(eRendererType renderType, unsigned i
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static bool StripsRender(RendererBase* renderer, Ember<T>& ember, vector<unsigned char>& finalImage, double time, size_t strips, bool yAxisUp,
|
||||
static bool StripsRender(RendererBase* renderer, Ember<T>& ember, vector<byte>& finalImage, double time, size_t strips, bool yAxisUp,
|
||||
std::function<void(size_t strip)> perStripStart,
|
||||
std::function<void(size_t strip)> perStripFinish,
|
||||
std::function<void(size_t strip)> perStripError,
|
||||
|
@ -126,7 +126,7 @@ class EmberOptions;
|
||||
|
||||
/// <summary>
|
||||
/// A single option.
|
||||
/// Template argument expected to be bool, int, unsigned int, double or string.
|
||||
/// Template argument expected to be bool, int, uint, double or string.
|
||||
/// </summary>
|
||||
template <typename T>
|
||||
class EmberOptionEntry
|
||||
@ -217,7 +217,7 @@ private:
|
||||
break
|
||||
|
||||
//Uint.
|
||||
#define Eou EmberOptionEntry<unsigned int>
|
||||
#define Eou EmberOptionEntry<uint>
|
||||
#define INITUINTOPTION(member, option) \
|
||||
member = option; \
|
||||
m_UintArgs.push_back(&member)
|
||||
@ -431,7 +431,7 @@ public:
|
||||
PARSEINTOPTION(OPT_SYMMETRY, Symmetry);//Int args
|
||||
PARSEINTOPTION(OPT_SHEEP_GEN, SheepGen);
|
||||
PARSEINTOPTION(OPT_SHEEP_ID, SheepId);
|
||||
PARSEUINTOPTION(OPT_OPENCL_PLATFORM, Platform);//Unsigned int args.
|
||||
PARSEUINTOPTION(OPT_OPENCL_PLATFORM, Platform);//uint args.
|
||||
PARSEUINTOPTION(OPT_OPENCL_DEVICE, Device);
|
||||
PARSEUINTOPTION(OPT_SEED, Seed);
|
||||
PARSEUINTOPTION(OPT_NTHREADS, ThreadCount);
|
||||
@ -645,27 +645,27 @@ public:
|
||||
EmberOptionEntry<int> Symmetry;//Value int.
|
||||
EmberOptionEntry<int> SheepGen;
|
||||
EmberOptionEntry<int> SheepId;
|
||||
EmberOptionEntry<unsigned int> Platform;//Value unsigned int.
|
||||
EmberOptionEntry<unsigned int> Device;
|
||||
EmberOptionEntry<unsigned int> Seed;
|
||||
EmberOptionEntry<unsigned int> ThreadCount;
|
||||
EmberOptionEntry<unsigned int> Strips;
|
||||
EmberOptionEntry<unsigned int> Supersample;
|
||||
EmberOptionEntry<unsigned int> BitsPerChannel;
|
||||
EmberOptionEntry<unsigned int> SubBatchSize;
|
||||
EmberOptionEntry<unsigned int> Bits;
|
||||
EmberOptionEntry<unsigned int> PrintEditDepth;
|
||||
EmberOptionEntry<unsigned int> JpegQuality;
|
||||
EmberOptionEntry<unsigned int> FirstFrame;
|
||||
EmberOptionEntry<unsigned int> LastFrame;
|
||||
EmberOptionEntry<unsigned int> Frame;
|
||||
EmberOptionEntry<unsigned int> Time;
|
||||
EmberOptionEntry<unsigned int> Dtime;
|
||||
EmberOptionEntry<unsigned int> Frames;
|
||||
EmberOptionEntry<unsigned int> Loops;
|
||||
EmberOptionEntry<unsigned int> Repeat;
|
||||
EmberOptionEntry<unsigned int> Tries;
|
||||
EmberOptionEntry<unsigned int> MaxXforms;
|
||||
EmberOptionEntry<uint> Platform;//Value uint.
|
||||
EmberOptionEntry<uint> Device;
|
||||
EmberOptionEntry<uint> Seed;
|
||||
EmberOptionEntry<uint> ThreadCount;
|
||||
EmberOptionEntry<uint> Strips;
|
||||
EmberOptionEntry<uint> Supersample;
|
||||
EmberOptionEntry<uint> BitsPerChannel;
|
||||
EmberOptionEntry<uint> SubBatchSize;
|
||||
EmberOptionEntry<uint> Bits;
|
||||
EmberOptionEntry<uint> PrintEditDepth;
|
||||
EmberOptionEntry<uint> JpegQuality;
|
||||
EmberOptionEntry<uint> FirstFrame;
|
||||
EmberOptionEntry<uint> LastFrame;
|
||||
EmberOptionEntry<uint> Frame;
|
||||
EmberOptionEntry<uint> Time;
|
||||
EmberOptionEntry<uint> Dtime;
|
||||
EmberOptionEntry<uint> Frames;
|
||||
EmberOptionEntry<uint> Loops;
|
||||
EmberOptionEntry<uint> Repeat;
|
||||
EmberOptionEntry<uint> Tries;
|
||||
EmberOptionEntry<uint> MaxXforms;
|
||||
|
||||
EmberOptionEntry<double> SizeScale;//Value double.
|
||||
EmberOptionEntry<double> QualityScale;
|
||||
@ -711,7 +711,7 @@ public:
|
||||
private:
|
||||
vector<EmberOptionEntry<bool>*> m_BoolArgs;
|
||||
vector<EmberOptionEntry<int>*> m_IntArgs;
|
||||
vector<EmberOptionEntry<unsigned int>*> m_UintArgs;
|
||||
vector<EmberOptionEntry<uint>*> m_UintArgs;
|
||||
vector<EmberOptionEntry<double>*> m_DoubleArgs;
|
||||
vector<EmberOptionEntry<string>*> m_StringArgs;
|
||||
};
|
||||
|
@ -12,7 +12,7 @@
|
||||
/// <param name="width">Width of the image in pixels</param>
|
||||
/// <param name="height">Height of the image in pixels</param>
|
||||
/// <returns>True if success, else false</returns>
|
||||
static bool WritePpm(const char* filename, unsigned char* image, size_t width, size_t height)
|
||||
static bool WritePpm(const char* filename, byte* image, size_t width, size_t height)
|
||||
{
|
||||
bool b = false;
|
||||
size_t size = width * height * 3;
|
||||
@ -44,7 +44,7 @@ static bool WritePpm(const char* filename, unsigned char* image, size_t width, s
|
||||
/// <param name="url">Url of the author</param>
|
||||
/// <param name="nick">Nickname of the author</param>
|
||||
/// <returns>True if success, else false</returns>
|
||||
static bool WriteJpeg(const char* filename, unsigned char* image, size_t width, size_t height, int quality, bool enableComments, EmberImageComments& comments, string id, string url, string nick)
|
||||
static bool WriteJpeg(const char* filename, byte* image, size_t width, size_t height, int quality, bool enableComments, EmberImageComments& comments, string id, string url, string nick)
|
||||
{
|
||||
bool b = false;
|
||||
FILE* file;
|
||||
@ -79,36 +79,36 @@ static bool WriteJpeg(const char* filename, unsigned char* image, size_t width,
|
||||
//Write comments to jpeg.
|
||||
if (enableComments)
|
||||
{
|
||||
jpeg_write_marker(&info, JPEG_COM, (unsigned char*)verString, (int)strlen(verString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (byte*)verString, (int)strlen(verString));
|
||||
|
||||
if (nick != "")
|
||||
{
|
||||
snprintf_s(nickString, 64, "flam3_nickname: %s", nick.c_str());
|
||||
jpeg_write_marker(&info, JPEG_COM, (unsigned char*)nickString, (int)strlen(nickString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (byte*)nickString, (int)strlen(nickString));
|
||||
}
|
||||
|
||||
if (url != "")
|
||||
{
|
||||
snprintf_s(urlString, 128, "flam3_url: %s", url.c_str());
|
||||
jpeg_write_marker(&info, JPEG_COM, (unsigned char*)urlString, (int)strlen(urlString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (byte*)urlString, (int)strlen(urlString));
|
||||
}
|
||||
|
||||
if (id != "")
|
||||
{
|
||||
snprintf_s(idString, 128, "flam3_id: %s", id.c_str());
|
||||
jpeg_write_marker(&info, JPEG_COM, (unsigned char*)idString, (int)strlen(idString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (byte*)idString, (int)strlen(idString));
|
||||
}
|
||||
|
||||
jpeg_write_marker(&info, JPEG_COM, (unsigned char*)bvString, (int)strlen(bvString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (unsigned char*)niString, (int)strlen(niString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (unsigned char*)rtString, (int)strlen(rtString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (unsigned char*)genomeString, (int)strlen(genomeString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (byte*)bvString, (int)strlen(bvString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (byte*)niString, (int)strlen(niString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (byte*)rtString, (int)strlen(rtString));
|
||||
jpeg_write_marker(&info, JPEG_COM, (byte*)genomeString, (int)strlen(genomeString));
|
||||
}
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
{
|
||||
JSAMPROW row_pointer[1];
|
||||
row_pointer[0] = (unsigned char*)image + (3 * width * i);
|
||||
row_pointer[0] = (byte*)image + (3 * width * i);
|
||||
jpeg_write_scanlines(&info, row_pointer, 1);
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ static bool WriteJpeg(const char* filename, unsigned char* image, size_t width,
|
||||
/// <param name="url">Url of the author</param>
|
||||
/// <param name="nick">Nickname of the author</param>
|
||||
/// <returns>True if success, else false</returns>
|
||||
static bool WritePng(const char* filename, unsigned char* image, size_t width, size_t height, size_t bytesPerChannel, bool enableComments, EmberImageComments& comments, string id, string url, string nick)
|
||||
static bool WritePng(const char* filename, byte* image, size_t width, size_t height, size_t bytesPerChannel, bool enableComments, EmberImageComments& comments, string id, string url, string nick)
|
||||
{
|
||||
bool b = false;
|
||||
FILE* file;
|
||||
@ -146,8 +146,8 @@ static bool WritePng(const char* filename, unsigned char* image, size_t width, s
|
||||
png_infop info_ptr;
|
||||
png_text text[PNG_COMMENT_MAX];
|
||||
size_t i;
|
||||
unsigned short testbe = 1;
|
||||
vector<unsigned char*> rows(height);
|
||||
uint16 testbe = 1;
|
||||
vector<byte*> rows(height);
|
||||
|
||||
text[0].compression = PNG_TEXT_COMPRESSION_NONE;
|
||||
text[0].key = (png_charp)"flam3_version";
|
||||
@ -182,7 +182,7 @@ static bool WritePng(const char* filename, unsigned char* image, size_t width, s
|
||||
text[7].text = (png_charp)comments.m_Genome.c_str();
|
||||
|
||||
for (i = 0; i < height; i++)
|
||||
rows[i] = (unsigned char*)image + i * width * 4 * bytesPerChannel;
|
||||
rows[i] = (byte*)image + i * width * 4 * bytesPerChannel;
|
||||
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
@ -232,7 +232,7 @@ static bool WritePng(const char* filename, unsigned char* image, size_t width, s
|
||||
/// <param name="height">The height.</param>
|
||||
/// <param name="newSize">The size of the new buffer created</param>
|
||||
/// <returns>The converted buffer if successful, else NULL.</returns>
|
||||
static unsigned char* ConvertRGBToBMPBuffer(unsigned char* buffer, size_t width, size_t height, size_t& newSize)
|
||||
static byte* ConvertRGBToBMPBuffer(byte* buffer, size_t width, size_t height, size_t& newSize)
|
||||
{
|
||||
if (buffer == nullptr || width == 0 || height == 0)
|
||||
return nullptr;
|
||||
@ -245,7 +245,7 @@ static unsigned char* ConvertRGBToBMPBuffer(unsigned char* buffer, size_t width,
|
||||
size_t psw = scanlinebytes + padding;
|
||||
|
||||
newSize = height * psw;
|
||||
unsigned char* newBuf = new unsigned char[newSize];
|
||||
byte* newBuf = new byte[newSize];
|
||||
|
||||
if (newBuf)
|
||||
{
|
||||
@ -286,7 +286,7 @@ static unsigned char* ConvertRGBToBMPBuffer(unsigned char* buffer, size_t width,
|
||||
/// <param name="height">Height of the image in pixels</param>
|
||||
/// <param name="paddedSize">Padded size, greater than or equal to total image size.</param>
|
||||
/// <returns>True if success, else false</returns>
|
||||
static bool SaveBmp(const char* filename, unsigned char* image, size_t width, size_t height, size_t paddedSize)
|
||||
static bool SaveBmp(const char* filename, byte* image, size_t width, size_t height, size_t paddedSize)
|
||||
{
|
||||
#ifdef WIN32
|
||||
BITMAPFILEHEADER bmfh;
|
||||
@ -351,11 +351,11 @@ static bool SaveBmp(const char* filename, unsigned char* image, size_t width, si
|
||||
/// <param name="width">Width of the image in pixels</param>
|
||||
/// <param name="height">Height of the image in pixels</param>
|
||||
/// <returns>True if success, else false</returns>
|
||||
static bool WriteBmp(const char* filename, unsigned char* image, size_t width, size_t height)
|
||||
static bool WriteBmp(const char* filename, byte* image, size_t width, size_t height)
|
||||
{
|
||||
bool b = false;
|
||||
size_t newSize;
|
||||
unique_ptr<unsigned char> bgrBuf(ConvertRGBToBMPBuffer(image, width, height, newSize));
|
||||
unique_ptr<byte> bgrBuf(ConvertRGBToBMPBuffer(image, width, height, newSize));
|
||||
|
||||
if (bgrBuf.get())
|
||||
b = SaveBmp(filename, bgrBuf.get(), width, height, newSize);
|
||||
|
@ -176,7 +176,7 @@ enum SG_Error {
|
||||
# endif
|
||||
# define sg_strcmp ::_mbscmp
|
||||
# define sg_strcasecmp ::_mbsicmp
|
||||
# define SOCHAR_T unsigned char
|
||||
# define SOCHAR_T byte
|
||||
#else
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
@ -309,7 +309,7 @@ struct SimpleGlobBase
|
||||
{
|
||||
SimpleGlobBase() : m_hFind(INVALID_HANDLE_VALUE) { }
|
||||
|
||||
int FindFirstFileS(const char * a_pszFileSpec, unsigned int) {
|
||||
int FindFirstFileS(const char * a_pszFileSpec, uint) {
|
||||
m_hFind = FindFirstFileA(a_pszFileSpec, &m_oFindDataA);
|
||||
if (m_hFind != INVALID_HANDLE_VALUE) {
|
||||
return SG_SUCCESS;
|
||||
@ -320,7 +320,7 @@ struct SimpleGlobBase
|
||||
}
|
||||
return SG_ERR_FAILURE;
|
||||
}
|
||||
int FindFirstFileS(const wchar_t * a_pszFileSpec, unsigned int) {
|
||||
int FindFirstFileS(const wchar_t * a_pszFileSpec, uint) {
|
||||
m_hFind = FindFirstFileW(a_pszFileSpec, &m_oFindDataW);
|
||||
if (m_hFind != INVALID_HANDLE_VALUE) {
|
||||
return SG_SUCCESS;
|
||||
@ -405,7 +405,7 @@ struct SimpleGlobBase
|
||||
}
|
||||
}
|
||||
|
||||
int FindFirstFileS(const char * a_pszFileSpec, unsigned int a_uiFlags) {
|
||||
int FindFirstFileS(const char * a_pszFileSpec, uint a_uiFlags) {
|
||||
int nFlags = GLOB_MARK | GLOB_NOSORT;
|
||||
if (a_uiFlags & SG_GLOB_ERR) nFlags |= GLOB_ERR;
|
||||
if (a_uiFlags & SG_GLOB_TILDE) nFlags |= GLOB_TILDE;
|
||||
@ -419,7 +419,7 @@ struct SimpleGlobBase
|
||||
}
|
||||
|
||||
#if SG_HAVE_ICU
|
||||
int FindFirstFileS(const UChar * a_pszFileSpec, unsigned int a_uiFlags) {
|
||||
int FindFirstFileS(const UChar * a_pszFileSpec, uint a_uiFlags) {
|
||||
char buf[PATH_MAX] = { 0 };
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
u_strToUTF8(buf, sizeof(buf), nullptr, a_pszFileSpec, -1, &status);
|
||||
@ -531,7 +531,7 @@ public:
|
||||
argv[0] ... argv[a_nReservedSlots-1] will be left empty for
|
||||
the caller to fill in.
|
||||
*/
|
||||
CSimpleGlobTempl(unsigned int a_uiFlags = 0, int a_nReservedSlots = 0);
|
||||
CSimpleGlobTempl(uint a_uiFlags = 0, int a_nReservedSlots = 0);
|
||||
|
||||
/*! @brief Deallocate all memory buffers. */
|
||||
~CSimpleGlobTempl();
|
||||
@ -548,7 +548,7 @@ public:
|
||||
argv[0] ... argv[a_nReservedSlots-1] will be left empty for
|
||||
the caller to fill in.
|
||||
*/
|
||||
int Init(unsigned int a_uiFlags = 0, int a_nReservedSlots = 0);
|
||||
int Init(uint a_uiFlags = 0, int a_nReservedSlots = 0);
|
||||
|
||||
/*! @brief Add a new filespec to the glob.
|
||||
|
||||
@ -624,7 +624,7 @@ private:
|
||||
static int fileSortCompare(const void *a1, const void *a2);
|
||||
|
||||
private:
|
||||
unsigned int m_uiFlags;
|
||||
uint m_uiFlags;
|
||||
ARG_ARRAY_TYPE m_nArgArrayType; //!< argv is indexes or pointers
|
||||
SOCHAR ** m_rgpArgs; //!< argv
|
||||
int m_nReservedSlots; //!< # client slots in argv array
|
||||
@ -642,7 +642,7 @@ private:
|
||||
|
||||
template<class SOCHAR>
|
||||
CSimpleGlobTempl<SOCHAR>::CSimpleGlobTempl(
|
||||
unsigned int a_uiFlags,
|
||||
uint a_uiFlags,
|
||||
int a_nReservedSlots
|
||||
)
|
||||
{
|
||||
@ -664,7 +664,7 @@ CSimpleGlobTempl<SOCHAR>::~CSimpleGlobTempl()
|
||||
template<class SOCHAR>
|
||||
int
|
||||
CSimpleGlobTempl<SOCHAR>::Init(
|
||||
unsigned int a_uiFlags,
|
||||
uint a_uiFlags,
|
||||
int a_nReservedSlots
|
||||
)
|
||||
{
|
||||
|
Reference in New Issue
Block a user