From 9011f0c80a33c658c81cdbb44d8e9c5e3fe6822e Mon Sep 17 00:00:00 2001 From: lecoanet Date: Wed, 19 Oct 2005 11:07:00 +0000 Subject: Added some code to do high precision timing in the main drawing function Repair(). Tkzinc now test whether the tagOrIdOrTransform given to translate is not the empty string (cf zinc-anim and D Etienne). --- generic/tkZinc.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'generic') diff --git a/generic/tkZinc.c b/generic/tkZinc.c index 99018d7..6e8cabb 100644 --- a/generic/tkZinc.c +++ b/generic/tkZinc.c @@ -6123,7 +6123,12 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. ZnBool abs = False; if ((argc != 5) && (argc != 6)) { - Tcl_WrongNumArgs(interp, 1, args, "translate tagOrIdorTransform xAmount yAmount ?abs?"); + Tcl_WrongNumArgs(interp, 1, args, "translate tagOrIdOrTransform xAmount yAmount ?abs?"); + goto error; + } + str = Tcl_GetString(args[2]); + if (strlen(str) == 0) { + Tcl_AppendResult(interp, " must provide a valid tagOrIdOrTransform", NULL); goto error; } entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2])); @@ -8319,6 +8324,16 @@ Update(ZnWInfo *wi) * ********************************************************************************** */ +#if defined (_WIN32) +#define START \ + QueryPerformanceCounter(&start) + +#define STOP_PRINT(text) \ + QueryPerformanceCounter(&stop); \ + printf(text##" : %g ms\n", \ + ((double) (stop.QuadPart - start.QuadPart)) * 1000.0 / ((double) sw_freq.QuadPart)) +#endif + static void Repair(ZnWInfo *wi) { @@ -8332,7 +8347,10 @@ Repair(ZnWInfo *wi) #endif int int_width = Tk_Width(wi->win); int int_height = Tk_Height(wi->win); - + //LARGE_INTEGER start, stop, sw_freq; + + //QueryPerformanceFrequency(&sw_freq); + //START; /*SET(wi->flags, ZN_CONFIGURE_EVENT);*/ if (wi->render) { #ifdef GL @@ -8524,12 +8542,14 @@ Repair(ZnWInfo *wi) } ZnGLReleaseContext(ce); + //STOP_PRINT("Total GL"); #endif } else { XRectangle r, rs[4]; ZnBBox merge; + //START; ClampDamageArea(wi); /* m * Merge the damaged area with the exposed area. @@ -8642,6 +8662,7 @@ m * Merge the damaged area with the exposed area. rs[3].height = int_height; XFillRectangles(wi->dpy, Tk_WindowId(wi->win), wi->gc, rs, 4); } + //STOP_PRINT("Total GDI"); } } -- cgit v1.1