aboutsummaryrefslogtreecommitdiff
path: root/tools/depends/native/TexturePacker/src
diff options
context:
space:
mode:
authorh.udo <hudokkow@gmail.com>2018-06-08 12:23:10 +0100
committerh.udo <hudokkow@gmail.com>2018-06-12 13:06:19 +0100
commit5c6e3a8b9bec8a594695fe5808bb384f6645bcec (patch)
tree6b54545a47606b5c6543df01504ef2ed9e09eede /tools/depends/native/TexturePacker/src
parente8d74c663841eddaa70946bee298a15c2454de20 (diff)
[tools] nuke whitespace
Diffstat (limited to 'tools/depends/native/TexturePacker/src')
-rw-r--r--tools/depends/native/TexturePacker/src/SimpleFS.h4
-rw-r--r--tools/depends/native/TexturePacker/src/TexturePacker.cpp8
-rw-r--r--tools/depends/native/TexturePacker/src/cmdlineargs.h8
-rw-r--r--tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp4
-rw-r--r--tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp4
-rw-r--r--tools/depends/native/TexturePacker/src/decoder/GifHelper.h2
-rw-r--r--tools/depends/native/TexturePacker/src/decoder/IDecoder.h2
-rw-r--r--tools/depends/native/TexturePacker/src/decoder/JPGDecoder.cpp26
-rw-r--r--tools/depends/native/TexturePacker/src/decoder/PNGDecoder.cpp62
-rw-r--r--tools/depends/native/TexturePacker/src/md5.h2
10 files changed, 61 insertions, 61 deletions
diff --git a/tools/depends/native/TexturePacker/src/SimpleFS.h b/tools/depends/native/TexturePacker/src/SimpleFS.h
index bbda2b50a8..5448373b02 100644
--- a/tools/depends/native/TexturePacker/src/SimpleFS.h
+++ b/tools/depends/native/TexturePacker/src/SimpleFS.h
@@ -31,7 +31,7 @@ public:
{
m_file = NULL;
}
-
+
~CFile()
{
Close();
@@ -70,7 +70,7 @@ public:
return size;
return 0;
}
-
+
FILE *getFP()
{
return m_file;
diff --git a/tools/depends/native/TexturePacker/src/TexturePacker.cpp b/tools/depends/native/TexturePacker/src/TexturePacker.cpp
index 4c45b704d6..1efadd6eb2 100644
--- a/tools/depends/native/TexturePacker/src/TexturePacker.cpp
+++ b/tools/depends/native/TexturePacker/src/TexturePacker.cpp
@@ -84,7 +84,7 @@ void CreateSkeletonHeaderImpl(CXBTFWriter& xbtfWriter, std::string fullPath, std
{
while ((dp = readdir(dirp)) != NULL)
{
- if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
+ if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
{
continue;
}
@@ -201,12 +201,12 @@ CXBTFFrame createXBTFFrame(RGBAImage &image, CXBTFWriter& writer, double maxMSE,
int width, height;
unsigned int format = 0;
unsigned char* argb = (unsigned char*)image.pixels;
-
+
width = image.width;
height = image.height;
bool hasAlpha = HasAlpha(argb, width, height);
- CXBTFFrame frame;
+ CXBTFFrame frame;
format = XB_FMT_A8R8G8B8;
frame = appendContent(writer, width, height, argb, (width * height * 4), format, hasAlpha, flags);
@@ -239,7 +239,7 @@ static bool checkDupe(struct MD5Context* ctx,
map<string,unsigned int>::iterator it = hashes.find(hex);
if (it != hashes.end())
{
- dupes[pos] = it->second;
+ dupes[pos] = it->second;
return true;
}
diff --git a/tools/depends/native/TexturePacker/src/cmdlineargs.h b/tools/depends/native/TexturePacker/src/cmdlineargs.h
index d836f535e5..d0b9d03d34 100644
--- a/tools/depends/native/TexturePacker/src/cmdlineargs.h
+++ b/tools/depends/native/TexturePacker/src/cmdlineargs.h
@@ -41,7 +41,7 @@ public:
if (m_cmdline)
{
strcpy (m_cmdline, cmdline);
- ParseCmdLine();
+ ParseCmdLine();
} else {
#ifdef TARGET_POSIX
delete[] cmdline;
@@ -110,7 +110,7 @@ private:
bInQuotes = (*pargs == QUOTE); // see if this token is quoted
if (bInQuotes) // skip leading quote
- pargs++;
+ pargs++;
push_back (pargs); // store position of current token
@@ -121,7 +121,7 @@ private:
if (bInQuotes)
{
// find next quote followed by a space or terminator
- while (*pargs &&
+ while (*pargs &&
!(*pargs == QUOTE && (isspace (pargs[1]) || pargs[1] == TERM)))
pargs++;
if (*pargs)
@@ -134,7 +134,7 @@ private:
else
{
// skip to next non-whitespace character
- while (*pargs && !isspace (*pargs))
+ while (*pargs && !isspace (*pargs))
pargs++;
if (*pargs && isspace (*pargs)) // end of token
{
diff --git a/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp b/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp
index f970793d02..7e5179b0cc 100644
--- a/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp
+++ b/tools/depends/native/TexturePacker/src/decoder/GIFDecoder.cpp
@@ -45,7 +45,7 @@ bool GIFDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
for (unsigned int i = 0; i < extractedFrames.size(); i++)
{
DecodedFrame frame;
-
+
frame.rgbaImage.pixels = (char *)new char[frameSize];
memcpy(frame.rgbaImage.pixels, extractedFrames[i]->m_pImage, frameSize);
frame.rgbaImage.height = height;
@@ -53,7 +53,7 @@ bool GIFDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
frame.rgbaImage.bbp = 32;
frame.rgbaImage.pitch = pitch;
frame.delay = extractedFrames[i]->m_delay;
-
+
frames.frameList.push_back(frame);
}
}
diff --git a/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp b/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp
index 9ced4ec5bc..0f6c2865d9 100644
--- a/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp
+++ b/tools/depends/native/TexturePacker/src/decoder/GifHelper.cpp
@@ -221,7 +221,7 @@ bool GifHelper::LoadGif(const char* file)
{
fprintf(stderr, "Gif::LoadGif(): Could not extract any frame. File %s\n", m_filename.c_str());
return false;
- }
+ }
else if (extractedFrames < (int)m_numFrames)
{
fprintf(stderr, "Gif::LoadGif(): Could only extract %d/%d frames. File %s\n", extractedFrames, m_numFrames, m_filename.c_str());
@@ -420,7 +420,7 @@ bool GifHelper::PrepareTemplate(GifFrame &frame)
case DISPOSE_PREVIOUS:
{
- /*
+ /*
* This disposal method makes no sense for the first frame
* Since browsers etc. handle that too, we'll fall back to DISPOSE_DO_NOT
*/
diff --git a/tools/depends/native/TexturePacker/src/decoder/GifHelper.h b/tools/depends/native/TexturePacker/src/decoder/GifHelper.h
index b5dfbc5f76..5281df5b71 100644
--- a/tools/depends/native/TexturePacker/src/decoder/GifHelper.h
+++ b/tools/depends/native/TexturePacker/src/decoder/GifHelper.h
@@ -17,7 +17,7 @@
* <http://www.gnu.org/licenses/>.
*
*/
-
+
#pragma once
#include "gif_lib.h"
diff --git a/tools/depends/native/TexturePacker/src/decoder/IDecoder.h b/tools/depends/native/TexturePacker/src/decoder/IDecoder.h
index 6ae8982e86..b197296d9b 100644
--- a/tools/depends/native/TexturePacker/src/decoder/IDecoder.h
+++ b/tools/depends/native/TexturePacker/src/decoder/IDecoder.h
@@ -27,7 +27,7 @@ class RGBAImage
{
public:
RGBAImage() : pixels(NULL), width(0), height(0), bbp(0), pitch(0) {}
-
+
char *pixels;//image data
int width;// width
int height;// height
diff --git a/tools/depends/native/TexturePacker/src/decoder/JPGDecoder.cpp b/tools/depends/native/TexturePacker/src/decoder/JPGDecoder.cpp
index b0f18bed68..4022dc719f 100644
--- a/tools/depends/native/TexturePacker/src/decoder/JPGDecoder.cpp
+++ b/tools/depends/native/TexturePacker/src/decoder/JPGDecoder.cpp
@@ -68,33 +68,33 @@ bool JPGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
delete arq;
return false;
}
-
+
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
-
+
int ImageSize;
-
+
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
-
+
jpeg_stdio_src(&cinfo, arq->getFP());
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
-
+
// Image Size is calculated as (width * height * bytes per pixel = 4
ImageSize = cinfo.image_width * cinfo.image_height * 4;
-
+
frames.user = NULL;
DecodedFrame frame;
-
+
frame.rgbaImage.pixels = (char *)new char[ImageSize];
-
+
unsigned char *scanlinebuff = new unsigned char[3 * cinfo.image_width];
unsigned char *dst = (unsigned char *)frame.rgbaImage.pixels;
while (cinfo.output_scanline < cinfo.output_height)
{
jpeg_read_scanlines(&cinfo,&scanlinebuff,1);
-
+
unsigned char *src2 = scanlinebuff;
unsigned char *dst2 = dst;
for (unsigned int x = 0; x < cinfo.image_width; x++, src2 += 3)
@@ -107,16 +107,16 @@ bool JPGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
dst += cinfo.image_width * 4;
}
delete [] scanlinebuff;
-
+
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
-
+
frame.rgbaImage.height = cinfo.image_height;
frame.rgbaImage.width = cinfo.image_width;
frame.rgbaImage.bbp = 32;
frame.rgbaImage.pitch = 4 * cinfo.image_width;
frames.frameList.push_back(frame);
-
+
delete arq;
return true;
}
@@ -127,7 +127,7 @@ void JPGDecoder::FreeDecodedFrames(DecodedFrames &frames)
{
delete [] frames.frameList[i].rgbaImage.pixels;
}
-
+
frames.clear();
}
diff --git a/tools/depends/native/TexturePacker/src/decoder/PNGDecoder.cpp b/tools/depends/native/TexturePacker/src/decoder/PNGDecoder.cpp
index f2d10eb5d2..96ca0b461f 100644
--- a/tools/depends/native/TexturePacker/src/decoder/PNGDecoder.cpp
+++ b/tools/depends/native/TexturePacker/src/decoder/PNGDecoder.cpp
@@ -51,11 +51,11 @@ bool PNGDecoder::CanDecode(const std::string &filename)
#define PNG_BYTES_TO_CHECK 4
CFile fp;
char buf[PNG_BYTES_TO_CHECK];
-
+
/* Open the prospective PNG file. */
if (!fp.Open(filename))
return false;
-
+
/* Read in some of the signature bytes */
if (fp.Read(buf, PNG_BYTES_TO_CHECK) != PNG_BYTES_TO_CHECK)
{
@@ -72,30 +72,30 @@ bool PNGDecoder::CanDecode(const std::string &filename)
bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
{
png_byte header[8];
-
+
CFile fp;
if (!fp.Open(filename))
{
perror(filename.c_str());
return false;
}
-
+
// read the header
fp.Read(header, 8);
-
+
if (png_sig_cmp(header, 0, 8))
{
fprintf(stderr, "error: %s is not a PNG.\n", filename.c_str());
return false;
}
-
+
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr)
{
fprintf(stderr, "error: png_create_read_struct returned 0.\n");
return false;
}
-
+
// create png info struct
png_infop info_ptr = png_create_info_struct(png_ptr);
if (!info_ptr)
@@ -104,7 +104,7 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL);
return false;
}
-
+
// create png info struct
png_infop end_info = png_create_info_struct(png_ptr);
if (!end_info)
@@ -113,36 +113,36 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL);
return false;
}
-
+
// the code in this if statement gets called if libpng encounters an error
if (setjmp(png_jmpbuf(png_ptr))) {
fprintf(stderr, "error from libpng\n");
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
return false;
}
-
+
// init png reading
png_init_io(png_ptr, fp.getFP());
-
+
// let libpng know you already read the first 8 bytes
png_set_sig_bytes(png_ptr, 8);
-
+
// read all the info up to the image data
png_read_info(png_ptr, info_ptr);
-
+
// variables to pass to get info
int bit_depth, color_type;
png_uint_32 temp_width, temp_height;
-
+
// get info about png
png_get_IHDR(png_ptr, info_ptr, &temp_width, &temp_height, &bit_depth, &color_type,
NULL, NULL, NULL);
-
+
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
{
png_set_tRNS_to_alpha(png_ptr);
}
-
+
//set it to 32bit pixeldepth
png_color_8 sig_bit;
sig_bit.red = 32;
@@ -151,12 +151,12 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
// if the image has an alpha channel then
sig_bit.alpha = 32;
png_set_sBIT(png_ptr, info_ptr, &sig_bit);
-
-
+
+
/* Add filler (or alpha) byte (before/after each RGB triplet) */
png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
-
-
+
+
if (color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_RGB_ALPHA)
png_set_bgr(png_ptr);
@@ -164,10 +164,10 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
// convert indexed color to rgb
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(png_ptr);
-
+
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
//png_set_swap_alpha(png_ptr);
-
+
//libsquish only eats 32bit RGBA, must convert grayscale into this format
if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
@@ -178,13 +178,13 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
// Update the png info struct.
png_read_update_info(png_ptr, info_ptr);
-
+
// Row size in bytes.
int rowbytes = png_get_rowbytes(png_ptr, info_ptr);
-
+
// glTexImage2d requires rows to be 4-byte aligned
// rowbytes += 3 - ((rowbytes-1) % 4);
-
+
// Allocate the image_data as a big block, to be given to opengl
png_byte * image_data;
image_data = (png_byte*)new png_byte[rowbytes * temp_height * sizeof(png_byte)+15];
@@ -194,7 +194,7 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
return false;
}
-
+
// row_pointers is for pointing to image_data for reading the png with libpng
png_bytep * row_pointers = (png_bytep*) new png_bytep[temp_height * sizeof(png_bytep)];
if (row_pointers == NULL)
@@ -204,19 +204,19 @@ bool PNGDecoder::LoadFile(const std::string &filename, DecodedFrames &frames)
delete [] image_data;
return false;
}
-
+
// set the individual row_pointers to point at the correct offsets of image_data
for (unsigned int i = 0; i < temp_height; i++)
{
row_pointers[i] = image_data + i * rowbytes;
}
-
+
// read the png into image_data through row_pointers
png_read_image(png_ptr, row_pointers);
-
+
frames.user = NULL;
DecodedFrame frame;
-
+
frame.rgbaImage.pixels = (char *)image_data;
frame.rgbaImage.height = temp_height;
frame.rgbaImage.width = temp_width;
@@ -235,7 +235,7 @@ void PNGDecoder::FreeDecodedFrames(DecodedFrames &frames)
{
delete [] frames.frameList[i].rgbaImage.pixels;
}
-
+
frames.clear();
}
diff --git a/tools/depends/native/TexturePacker/src/md5.h b/tools/depends/native/TexturePacker/src/md5.h
index 6a1554765a..5e753c8767 100644
--- a/tools/depends/native/TexturePacker/src/md5.h
+++ b/tools/depends/native/TexturePacker/src/md5.h
@@ -25,7 +25,7 @@
#include <cstring> /* for memcpy() */
#include <cstdint>
-struct MD5Context
+struct MD5Context
{
uint32_t buf[4];
uint32_t bytes[2];