n_pt_persp.c: Adding performance output

This commit is contained in:
Bill Kendrick 2024-01-14 12:55:33 -08:00
parent 9534b5b959
commit a7d792fa64

View file

@ -19,7 +19,6 @@
December 12, 2023 - January 14, 2024 December 12, 2023 - January 14, 2024
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <libintl.h> #include <libintl.h>
@ -28,6 +27,9 @@
#include "SDL_image.h" #include "SDL_image.h"
#include "SDL_mixer.h" #include "SDL_mixer.h"
// #define DEBUG
#define PERF
#define SNAP 10 #define SNAP 10
/* All _possible_ tools */ /* All _possible_ tools */
@ -68,8 +70,6 @@ enum
NUM_TOOLS NUM_TOOLS
}; };
// #define DEBUG
#ifdef DEBUG #ifdef DEBUG
char * tool_debug_names[NUM_TOOLS] = { char * tool_debug_names[NUM_TOOLS] = {
/* 1-point perspective */ /* 1-point perspective */
@ -763,6 +763,10 @@ void n_pt_persp_drag(magic_api * api, int which,
{ {
int i, x1, y1, x2, y2; int i, x1, y1, x2, y2;
float slope; float slope;
#ifdef PERF
Uint64 tick;
tick = SDL_GetPerformanceCounter();
#endif
snap_to(which, &old_x, &old_y); snap_to(which, &old_x, &old_y);
snap_to(which, &x, &y); snap_to(which, &x, &y);
@ -1070,6 +1074,10 @@ void n_pt_persp_drag(magic_api * api, int which,
#endif #endif
n_pt_persp_vanish_pt_moved(api, which, canvas, update_rect); n_pt_persp_vanish_pt_moved(api, which, canvas, update_rect);
} }
#ifdef PERF
printf("%0.5f\n", (float) (SDL_GetPerformanceCounter() - tick) / (float) SDL_GetPerformanceFrequency());
#endif
} }
void n_pt_persp_work(magic_api * api, int tool, void n_pt_persp_work(magic_api * api, int tool,