summaryrefslogtreecommitdiffstatshomepage
path: root/src/tools/regrep.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/regrep.cpp')
-rw-r--r--src/tools/regrep.cpp52
1 files changed, 24 insertions, 28 deletions
diff --git a/src/tools/regrep.cpp b/src/tools/regrep.cpp
index f45351272a7..49637c2eb16 100644
--- a/src/tools/regrep.cpp
+++ b/src/tools/regrep.cpp
@@ -607,7 +607,6 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st
summary_file *buckethead[BUCKET_COUNT], **buckettailptr[BUCKET_COUNT];
summary_file *curfile;
std::string title("MAME Regressions");
- std::string tempname;
int listnum, bucknum;
util::core_file::ptr indexfile;
int count = 0, total;
@@ -686,7 +685,7 @@ static void output_report(std::string &dirname, std::string &tempheader, std::st
*buckettailptr[bucknum] = nullptr;
/* output header */
- tempname = string_format("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html");
+ std::string tempname = string_format("%s" PATH_SEPARATOR "%s", dirname.c_str(), "index.html");
indexfile = create_file_and_output_header(tempname, tempheader, title);
if (!indexfile)
{
@@ -721,10 +720,9 @@ static int compare_screenshots(summary_file *curfile)
bitmap_argb32 bitmaps[MAX_COMPARES];
int unique[MAX_COMPARES];
int numunique = 0;
- int listnum;
/* iterate over all files and load their bitmaps */
- for (listnum = 0; listnum < list_count; listnum++)
+ for (int listnum = 0; listnum < list_count; listnum++)
if (curfile->status[listnum] == STATUS_SUCCESS)
{
std::string fullname;
@@ -750,12 +748,13 @@ static int compare_screenshots(summary_file *curfile)
/* if that worked, load the file */
if (filerr == osd_file::error::NONE)
{
- png_read_bitmap(*file, bitmaps[listnum]);
+ util::png_read_bitmap(*file, bitmaps[listnum]);
file.reset();
}
}
/* now find all the different bitmap types */
+ int listnum;
for (listnum = 0; listnum < list_count; listnum++)
{
curfile->matchbitmap[listnum] = 0xff;
@@ -774,8 +773,8 @@ static int compare_screenshots(summary_file *curfile)
/* compare scanline by scanline */
for (int y = 0; y < this_bitmap.height() && !bitmaps_differ; y++)
{
- uint32_t *base = &base_bitmap.pix32(y);
- uint32_t *curr = &this_bitmap.pix32(y);
+ uint32_t const *base = &base_bitmap.pix(y);
+ uint32_t const *curr = &this_bitmap.pix(y);
/* scan the scanline */
int x;
@@ -831,14 +830,12 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir,
bitmap_argb32 bitmaps[MAX_COMPARES];
std::string srcimgname;
std::string dstfilename;
- std::string tempname;
bitmap_argb32 finalbitmap;
int width, height, maxwidth;
int bitmapcount = 0;
- int listnum, bmnum;
util::core_file::ptr file;
osd_file::error filerr;
- png_error pngerr;
+ util::png_error pngerr;
int error = -1;
int starty;
@@ -847,10 +844,10 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir,
srcimgname = string_format("snap" PATH_SEPARATOR "%s" PATH_SEPARATOR "final.png", curfile->name);
/* open and load all unique bitmaps */
- for (listnum = 0; listnum < list_count; listnum++)
+ for (int listnum = 0; listnum < list_count; listnum++)
if (curfile->matchbitmap[listnum] == listnum)
{
- tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str());
+ std::string tempname = string_format("%s" PATH_SEPARATOR "%s", lists[listnum].dir, srcimgname.c_str());
/* open the source image */
filerr = util::core_file::open(tempname, OPEN_FLAG_READ, file);
@@ -858,9 +855,9 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir,
goto error;
/* load the source image */
- pngerr = png_read_bitmap(*file, bitmaps[bitmapcount++]);
+ pngerr = util::png_read_bitmap(*file, bitmaps[bitmapcount++]);
file.reset();
- if (pngerr != PNGERR_NONE)
+ if (pngerr != util::png_error::NONE)
goto error;
}
@@ -871,7 +868,7 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir,
/* determine the size of the final bitmap */
height = width = 0;
maxwidth = bitmaps[0].width();
- for (bmnum = 1; bmnum < bitmapcount; bmnum++)
+ for (int bmnum = 1; bmnum < bitmapcount; bmnum++)
{
int curwidth;
@@ -891,24 +888,23 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir,
/* now copy and compare each set of bitmaps */
starty = 0;
- for (bmnum = 1; bmnum < bitmapcount; bmnum++)
+ for (int bmnum = 1; bmnum < bitmapcount; bmnum++)
{
- bitmap_argb32 &bitmap1 = bitmaps[0];
- bitmap_argb32 &bitmap2 = bitmaps[bmnum];
+ bitmap_argb32 const &bitmap1 = bitmaps[0];
+ bitmap_argb32 const &bitmap2 = bitmaps[bmnum];
int curheight = std::max(bitmap1.height(), bitmap2.height());
- int x, y;
/* iterate over rows in these bitmaps */
- for (y = 0; y < curheight; y++)
+ for (int y = 0; y < curheight; y++)
{
- uint32_t *src1 = (y < bitmap1.height()) ? &bitmap1.pix32(y) : nullptr;
- uint32_t *src2 = (y < bitmap2.height()) ? &bitmap2.pix32(y) : nullptr;
- uint32_t *dst1 = &finalbitmap.pix32(starty + y, 0);
- uint32_t *dst2 = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE);
- uint32_t *dstdiff = &finalbitmap.pix32(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE);
+ uint32_t const *src1 = (y < bitmap1.height()) ? &bitmap1.pix(y) : nullptr;
+ uint32_t const *src2 = (y < bitmap2.height()) ? &bitmap2.pix(y) : nullptr;
+ uint32_t *dst1 = &finalbitmap.pix(starty + y, 0);
+ uint32_t *dst2 = &finalbitmap.pix(starty + y, bitmap1.width() + BITMAP_SPACE);
+ uint32_t *dstdiff = &finalbitmap.pix(starty + y, bitmap1.width() + BITMAP_SPACE + maxwidth + BITMAP_SPACE);
/* now iterate over columns */
- for (x = 0; x < maxwidth; x++)
+ for (int x = 0; x < maxwidth; x++)
{
int pix1 = -1, pix2 = -2;
@@ -928,9 +924,9 @@ static int generate_png_diff(const summary_file *curfile, std::string &destdir,
filerr = util::core_file::open(dstfilename, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, file);
if (filerr != osd_file::error::NONE)
goto error;
- pngerr = png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr);
+ pngerr = util::png_write_bitmap(*file, nullptr, finalbitmap, 0, nullptr);
file.reset();
- if (pngerr != PNGERR_NONE)
+ if (pngerr != util::png_error::NONE)
goto error;
/* if we get here, we are error free */