diff --git a/tests/make_png/Makefile b/tests/make_png/Makefile index 0944cdf45..70187bf38 100644 --- a/tests/make_png/Makefile +++ b/tests/make_png/Makefile @@ -25,3 +25,4 @@ clean: + diff --git a/tests/make_png/bitmap.c b/tests/make_png/bitmap.c index c5eef77ea..6e1ff6df2 100644 --- a/tests/make_png/bitmap.c +++ b/tests/make_png/bitmap.c @@ -624,3 +624,19 @@ IMAGE* Append_Rows(IMAGE* small, IMAGE* big){ return result; } + +int Image_Diff( IMAGE* base, IMAGE* test){ + + int diff = 0; + + int max_width = MAX(base->width, test->width); + int min_width = MIN(base->width, test->width); + + int max_height = MAX(base->height, test->height); + int min_height = MIN(base->height, test->height); + + diff = (max_width - min_width) * max_height; + diff += (max_height - min_height) * min_width; + + return diff; +} diff --git a/tests/make_png/bitmap.h b/tests/make_png/bitmap.h index 95b97ceab..51e05cdec 100644 --- a/tests/make_png/bitmap.h +++ b/tests/make_png/bitmap.h @@ -21,6 +21,7 @@ #define BITS_PER_PIXEL_RGBA 32 #define MAX(a, b) ((a) > (b) ? (a) : (b)) +#define MIN(a, b) ((a) < (b) ? (a) : (b)) typedef struct { /* To store 32bit Hash */ FT_UInt32 hash; @@ -89,3 +90,5 @@ int First_Row(IMAGE* input); IMAGE* Append_Columns(IMAGE* small, IMAGE* big); /* Appening white columns with image alignment */ IMAGE* Append_Rows(IMAGE* small, IMAGE* big); +/* calculating the Pixel Differences */ +int Image_Diff( IMAGE* base, IMAGE* test); diff --git a/tests/make_png/images/README b/tests/make_png/images/README index c769f13e6..96f91f238 100644 --- a/tests/make_png/images/README +++ b/tests/make_png/images/README @@ -1 +1,2 @@ -This folder includes all the images generated \ No newline at end of file +This folder includes all the images generated + diff --git a/tests/make_png/make_sprite.c b/tests/make_png/make_sprite.c index 5ae7bc8dd..ceb95b5ca 100644 --- a/tests/make_png/make_sprite.c +++ b/tests/make_png/make_sprite.c @@ -448,6 +448,8 @@ int main(int argc, char const *argv[]) test_png = Append_Columns(test_png, base_png); } + pixel_diff += Image_Diff( base_png, test_png); + Add_effect( base_png, test_png, after_effect_1, 1); pixel_diff = Add_effect( base_png, test_png, after_effect_2,2); @@ -505,4 +507,4 @@ int main(int argc, char const *argv[]) dlclose(test_handle); return 0; -} \ No newline at end of file +} diff --git a/tests/make_png/murmur3.c b/tests/make_png/murmur3.c index 6698c09d5..be58a7664 100644 --- a/tests/make_png/murmur3.c +++ b/tests/make_png/murmur3.c @@ -304,4 +304,3 @@ void MurmurHash3_x64_128 ( const void * key, const int len, } /*------------------------------------------------------------------*/ - diff --git a/tests/make_png/script.js b/tests/make_png/script.js index 0198cf9ea..274538fbb 100644 --- a/tests/make_png/script.js +++ b/tests/make_png/script.js @@ -19,4 +19,4 @@ function sort_t(tbody, col, asc){ arr[i] = ""+arr[i].join("")+""; } tbody.innerHTML = ""+arr.join("")+""; -} \ No newline at end of file +} diff --git a/tests/make_png/style.css b/tests/make_png/style.css index 9f6d83169..281b5806b 100644 --- a/tests/make_png/style.css +++ b/tests/make_png/style.css @@ -35,3 +35,4 @@ th { #hash{ font-size: 12px; } +