Blender  V2.93
MultiTest.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
17  * All rights reserved.
18  */
19 
20 /* Developers Note:
21  *
22  * This test currently only creates windows and draws a 'dot' under the cursor on LMB,
23  * quits when Q is pressed.
24  *
25  * More work is needed for logging drawing to work properly.
26  *
27  * - Use GPU_matrix API.
28  * - Replace old OpenGL calls to glColor, etc with 'imm' API.
29  * - Investigate BLF font flushing (UI_widgetbase_draw_cache_flush) which is currently disabled.
30  */
31 
32 #ifdef _MSC_VER
33 # pragma warning(disable : 4244 4305)
34 #endif
35 
36 #include <math.h>
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <string.h>
40 
41 #include "GL.h"
42 #include <GL/glew.h>
43 
44 #include "MEM_guardedalloc.h"
45 
46 #include "GHOST_C-api.h"
47 
48 #include "BLF_api.h"
49 
50 #include "Basic.h"
51 #include "EventToBuf.h"
52 #include "ScrollBar.h"
53 #include "Util.h"
54 
55 #include "WindowData.h"
56 
57 /* GPU API. */
58 #include "GPU_context.h"
59 #include "GPU_immediate.h"
60 #include "GPU_init_exit.h"
61 
62 extern int datatoc_bfont_ttf_size;
63 extern char datatoc_bfont_ttf[];
64 
65 typedef struct _LoggerWindow LoggerWindow;
66 typedef struct _MultiTestApp MultiTestApp;
67 
68 void loggerwindow_log(LoggerWindow *lw, char *line);
69 
73 GHOST_SystemHandle multitestapp_get_system(MultiTestApp *app);
75 
76 
77 
78 void rect_bevel_side(int rect[2][2], int side, float *lt, float *dk, const float col[3], int width)
79 {
80  int ltidx = (side / 2) % 4;
81  int dkidx = (ltidx + 1 + (side & 1)) % 4;
82  int i, corner;
83 
84  glBegin(GL_LINES);
85  for (i = 0; i < width; i++) {
86  float ltf = pow(lt[i], 1.0 / 2.2), dkf = pow(dk[i], 1.0 / 2.2);
87  float stf = (dkidx > ltidx) ? dkf : ltf;
88  int lx = rect[1][0] - i - 1;
89  int ly = rect[0][1] + i;
90 
91  glColor3f(col[0] * stf, col[1] * stf, col[2] * stf);
92  for (corner = 0; corner < 4; corner++) {
93  int x = (corner == 0 || corner == 1) ? (rect[0][0] + i) : (rect[1][0] - i - 1);
94  int y = (corner == 0 || corner == 3) ? (rect[0][1] + i) : (rect[1][1] - i - 1);
95 
96  if (ltidx == corner)
97  glColor3f(col[0] * ltf, col[1] * ltf, col[2] * ltf);
98  if (dkidx == corner)
99  glColor3f(col[0] * dkf, col[1] * dkf, col[2] * dkf);
100 
101  glVertex2i(lx, ly);
102  glVertex2i(lx = x, ly = y);
103  }
104  }
105  glEnd();
106 
107  glColor3fv(col);
108  glRecti(rect[0][0] + width, rect[0][1] + width, rect[1][0] - width, rect[1][1] - width);
109 }
110 
111 void rect_bevel_smooth(int rect[2][2], int width)
112 {
113  float *lt = malloc(sizeof(*lt) * width);
114  float *dk = malloc(sizeof(*dk) * width);
115  float col[4];
116  int i;
117 
118  for (i = 0; i < width; i++) {
119  float v = width - 1 ? ((float)i / (width - 1)) : 0;
120  lt[i] = 1.2 + (1.0 - 1.2) * v;
121  dk[i] = 0.2 + (1.0 - 0.2) * v;
122  }
123 
124  glGetFloatv(GL_CURRENT_COLOR, col);
125 
126  rect_bevel_side(rect, 3, lt, dk, col, width);
127 
128  free(lt);
129  free(dk);
130 }
131 
132 /*
133  * MainWindow
134  */
135 
136 typedef struct {
138 
139  GHOST_WindowHandle win;
141 
142  int size[2];
143 
144  int lmouse[2], lmbut[3];
145 
146  int tmouse[2];
147 } MainWindow;
148 
149 static void mainwindow_log(MainWindow *mw, char *str)
150 {
152 }
153 
155 {
158 
159  if (mw->lmbut[0]) {
160  glClearColor(0.5, 0.5, 0.5, 1);
161  }
162  else {
163  glClearColor(1, 1, 1, 1);
164  }
165  glClear(GL_COLOR_BUFFER_BIT);
166 
167  glColor3f(0.5, 0.6, 0.8);
168  glRecti(mw->tmouse[0] - 5, mw->tmouse[1] - 5, mw->tmouse[0] + 5, mw->tmouse[1] + 5);
169 
171 }
172 
174 {
175  GHOST_RectangleHandle bounds = GHOST_GetClientBounds(mw->win);
176 
179 
182 
183  glViewport(0, 0, mw->size[0], mw->size[1]);
184 
185  glMatrixMode(GL_PROJECTION);
186  glLoadIdentity();
187  glOrtho(0, mw->size[0], 0, mw->size[1], -1, 1);
188  glTranslatef(0.375, 0.375, 0.0);
189 
190  glMatrixMode(GL_MODELVIEW);
191  glLoadIdentity();
192 }
193 
194 static void mainwindow_do_key(MainWindow *mw, GHOST_TKey key, int press)
195 {
196  switch (key) {
197  case GHOST_kKeyC:
198  if (press)
201  break;
203  if (press)
205  break;
207  if (press)
209  break;
210  case GHOST_kKeyE:
211  if (press)
213  break;
214  case GHOST_kKeyQ:
215  if (press)
216  multitestapp_exit(mw->app);
217  break;
218  case GHOST_kKeyT:
219  if (press)
220  mainwindow_log(mw, "TextTest~|`hello`\"world\",<>/");
221  break;
222  case GHOST_kKeyR:
223  if (press) {
224  int i;
225 
226  mainwindow_log(mw, "Invalidating window 10 times");
227  for (i = 0; i < 10; i++)
229  }
230  break;
231  case GHOST_kKeyF11:
232  if (press) {
234  }
235  break;
236  }
237 }
238 
239 static void mainwindow_do_move(MainWindow *mw, int x, int y)
240 {
241  mw->lmouse[0] = x, mw->lmouse[1] = y;
242 
243  if (mw->lmbut[0]) {
244  mw->tmouse[0] = x, mw->tmouse[1] = y;
246  }
247 }
248 
249 static void mainwindow_do_button(MainWindow *mw, int which, int press)
250 {
251  if (which == GHOST_kButtonMaskLeft) {
252  mw->lmbut[0] = press;
253  mw->tmouse[0] = mw->lmouse[0], mw->tmouse[1] = mw->lmouse[1];
255  }
256  else if (which == GHOST_kButtonMaskLeft) {
257  mw->lmbut[1] = press;
258  }
259  else if (which == GHOST_kButtonMaskLeft) {
260  mw->lmbut[2] = press;
261  }
262 }
263 
264 static void mainwindow_handle(void *priv, GHOST_EventHandle evt)
265 {
266  MainWindow *mw = priv;
268  char buf[256];
269 
270  event_to_buf(evt, buf);
271  mainwindow_log(mw, buf);
272 
273  switch (type) {
274  case GHOST_kEventCursorMove: {
276  int x, y;
277  GHOST_ScreenToClient(mw->win, cd->x, cd->y, &x, &y);
278  mainwindow_do_move(mw, x, mw->size[1] - y - 1);
279  break;
280  }
282  case GHOST_kEventButtonUp: {
285  break;
286  }
287  case GHOST_kEventKeyDown:
288  case GHOST_kEventKeyUp: {
291  break;
292  }
293 
295  mainwindow_do_draw(mw);
296  break;
299  break;
300  }
301 }
302 
303 
304 
305 static void mainwindow_timer_proc(GHOST_TimerTaskHandle task, GHOST_TUns64 time)
306 {
308  char buf[64];
309 
310  sprintf(buf, "timer: %6.2f", (double)((GHOST_TInt64)time) / 1000);
311  mainwindow_log(mw, buf);
312 }
313 
315 {
316  GHOST_SystemHandle sys = multitestapp_get_system(app);
317  GHOST_WindowHandle win;
318  GHOST_GLSettings glSettings = {0};
319 
320  win = GHOST_CreateWindow(sys,
321  NULL,
322  "MultiTest:Main",
323  40,
324  40,
325  400,
326  400,
328  false,
330  glSettings);
331 
332  if (win) {
333  MainWindow *mw = MEM_callocN(sizeof(*mw), "mainwindow_new");
334 
335  mw->gpu_context = GPU_context_create(win);
336  GPU_init();
337 
338  mw->app = app;
339  mw->win = win;
340 
342 
343  GHOST_InstallTimer(sys, 1000, 10000, mainwindow_timer_proc, mw);
344 
345  return mw;
346  }
347  else {
348  return NULL;
349  }
350 }
351 
353 {
354  GHOST_SystemHandle sys = multitestapp_get_system(mw->app);
355 
357  GHOST_DisposeWindow(sys, mw->win);
358  MEM_freeN(mw);
359 }
360 
361 /*
362  * LoggerWindow
363  */
364 
367 
368  GHOST_WindowHandle win;
370 
371  int font;
373 
374  int size[2];
375 
377  int textarea[2][2];
379 
380  char **loglines;
382 
383  int lmbut[3];
384  int lmouse[2];
385 };
386 
387 #define SCROLLBAR_PAD 2
388 #define SCROLLBAR_WIDTH 14
389 #define TEXTAREA_PAD 2
391 {
392  int nscroll[2][2];
393 
394  nscroll[0][0] = SCROLLBAR_PAD;
395  nscroll[0][1] = SCROLLBAR_PAD;
396  nscroll[1][0] = nscroll[0][0] + SCROLLBAR_WIDTH;
397  nscroll[1][1] = lw->size[1] - SCROLLBAR_PAD - 1;
398 
399  lw->textarea[0][0] = nscroll[1][0] + TEXTAREA_PAD;
400  lw->textarea[0][1] = TEXTAREA_PAD;
401  lw->textarea[1][0] = lw->size[0] - TEXTAREA_PAD - 1;
402  lw->textarea[1][1] = lw->size[1] - TEXTAREA_PAD - 1;
403 
404  lw->ndisplines = (lw->textarea[1][1] - lw->textarea[0][1]) / lw->fontheight;
405 
406  scrollbar_set_thumbpct(lw->scroll, (float)lw->ndisplines / lw->nloglines);
407  scrollbar_set_rect(lw->scroll, nscroll);
408 }
409 
411 {
412  glViewport(0, 0, lw->size[0], lw->size[1]);
413 
414  glMatrixMode(GL_PROJECTION);
415  glLoadIdentity();
416  glOrtho(0, lw->size[0], 0, lw->size[1], -1, 1);
417  glTranslatef(0.375, 0.375, 0.0);
418 
419  glMatrixMode(GL_MODELVIEW);
420  glLoadIdentity();
421 }
422 
424 {
425  GHOST_RectangleHandle bounds = GHOST_GetClientBounds(lw->win);
426 
429 
432 
435 }
436 
438 {
439  int i, ndisplines, startline;
440  int sb_rect[2][2], sb_thumb[2][2];
441 
444 
445  glClearColor(1, 1, 1, 1);
446  glClear(GL_COLOR_BUFFER_BIT);
447 
448  glColor3f(0.8, 0.8, 0.8);
449  rect_bevel_smooth(lw->textarea, 4);
450 
451  scrollbar_get_rect(lw->scroll, sb_rect);
452  scrollbar_get_thumb(lw->scroll, sb_thumb);
453 
454  glColor3f(0.6, 0.6, 0.6);
455  rect_bevel_smooth(sb_rect, 1);
456 
457  if (scrollbar_is_scrolling(lw->scroll)) {
458  glColor3f(0.6, 0.7, 0.5);
459  }
460  else {
461  glColor3f(0.9, 0.9, 0.92);
462  }
463  rect_bevel_smooth(sb_thumb, 1);
464 
465  startline = scrollbar_get_thumbpos(lw->scroll) * (lw->nloglines - 1);
466  ndisplines = min_i(lw->ndisplines, lw->nloglines - startline);
467 
468  glColor3f(0, 0, 0);
469  for (i = 0; i < ndisplines; i++) {
470  /* stored in reverse order */
471  char *line = lw->loglines[(lw->nloglines - 1) - (i + startline)];
472  int x_pos = lw->textarea[0][0] + 4;
473  int y_pos = lw->textarea[0][1] + 4 + i * lw->fontheight;
474 
475  BLF_position(lw->font, x_pos, y_pos, 0.0);
476  BLF_draw(lw->font, line, 256); // XXX
477  }
478 
480 
481  immDeactivate();
482 }
483 
484 static void loggerwindow_do_move(LoggerWindow *lw, int x, int y)
485 {
486  lw->lmouse[0] = x, lw->lmouse[1] = y;
487 
488  if (scrollbar_is_scrolling(lw->scroll)) {
491  }
492 }
493 
494 static void loggerwindow_do_button(LoggerWindow *lw, int which, int press)
495 {
496  if (which == GHOST_kButtonMaskLeft) {
497  lw->lmbut[0] = press;
498 
499  if (press) {
500  if (scrollbar_contains_pt(lw->scroll, lw->lmouse)) {
504  }
505  }
506  else {
507  if (scrollbar_is_scrolling(lw->scroll)) {
511  }
512  }
513  }
514  else if (which == GHOST_kButtonMaskMiddle) {
515  lw->lmbut[1] = press;
516  }
517  else if (which == GHOST_kButtonMaskRight) {
518  lw->lmbut[2] = press;
519  }
520 }
521 
522 static void loggerwindow_do_key(LoggerWindow *lw, GHOST_TKey key, int press)
523 {
524  switch (key) {
525  case GHOST_kKeyQ:
526  if (press)
527  multitestapp_exit(lw->app);
528  break;
529  }
530 }
531 
532 static void loggerwindow_handle(void *priv, GHOST_EventHandle evt)
533 {
534  LoggerWindow *lw = priv;
536 
537  switch (type) {
538  case GHOST_kEventCursorMove: {
540  int x, y;
541  GHOST_ScreenToClient(lw->win, cd->x, cd->y, &x, &y);
542  loggerwindow_do_move(lw, x, lw->size[1] - y - 1);
543  break;
544  }
546  case GHOST_kEventButtonUp: {
549  break;
550  }
551  case GHOST_kEventKeyDown:
552  case GHOST_kEventKeyUp: {
555  break;
556  }
557 
560  break;
563  break;
564  }
565 }
566 
567 
568 
570 {
571  GHOST_GLSettings glSettings = {0};
572  GHOST_SystemHandle sys = multitestapp_get_system(app);
573  GHOST_TUns32 screensize[2];
574  GHOST_WindowHandle win;
575 
576  GHOST_GetMainDisplayDimensions(sys, &screensize[0], &screensize[1]);
577  win = GHOST_CreateWindow(sys,
578  NULL,
579  "MultiTest:Logger",
580  40,
581  screensize[1] - 432,
582  800,
583  300,
585  false,
587  glSettings);
588 
589  if (win) {
590  LoggerWindow *lw = MEM_callocN(sizeof(*lw), "loggerwindow_new");
591 
592  lw->gpu_context = GPU_context_create(win);
593  GPU_init();
594 
595  int bbox[2][2];
596  lw->app = app;
597  lw->win = win;
598 
599  lw->font = BLF_load_default(false);
600  BLF_size(lw->font, 11, 72);
601  lw->fontheight = BLF_height(lw->font, "A_", 2);
602 
603  lw->nloglines = lw->logsize = 0;
604  lw->loglines = MEM_mallocN(sizeof(*lw->loglines) * lw->nloglines, "loglines");
605 
606  lw->scroll = scrollbar_new(2, 40);
607 
609 
611 
612  return lw;
613  }
614  else {
615  return NULL;
616  }
617 }
618 
619 void loggerwindow_log(LoggerWindow *lw, char *line)
620 {
621  if (lw->nloglines == lw->logsize) {
622  lw->loglines = memdbl(lw->loglines, &lw->logsize, sizeof(*lw->loglines));
623  }
624 
625  lw->loglines[lw->nloglines++] = string_dup(line);
626  scrollbar_set_thumbpct(lw->scroll, (float)lw->ndisplines / lw->nloglines);
627 
629 }
630 
632 {
633  GHOST_SystemHandle sys = multitestapp_get_system(lw->app);
634  int i;
635 
636  for (i = 0; i < lw->nloglines; i++) {
637  MEM_freeN(lw->loglines[i]);
638  }
639  MEM_freeN(lw->loglines);
640 
642  GHOST_DisposeWindow(sys, lw->win);
643  MEM_freeN(lw);
644 }
645 
646 /*
647  * ExtraWindow
648  */
649 
650 typedef struct {
652 
653  GHOST_WindowHandle win;
655 
656  int size[2];
657 } ExtraWindow;
658 
660 {
663 
664  glClearColor(1, 1, 1, 1);
665  glClear(GL_COLOR_BUFFER_BIT);
666 
667  glColor3f(0.8, 0.8, 0.8);
668  glRecti(10, 10, ew->size[0] - 10, ew->size[1] - 10);
669 
671 }
672 
674 {
675  GHOST_RectangleHandle bounds = GHOST_GetClientBounds(ew->win);
676 
679 
682 
683  glViewport(0, 0, ew->size[0], ew->size[1]);
684 
685  glMatrixMode(GL_PROJECTION);
686  glLoadIdentity();
687  glOrtho(0, ew->size[0], 0, ew->size[1], -1, 1);
688  glTranslatef(0.375, 0.375, 0.0);
689 
690  glMatrixMode(GL_MODELVIEW);
691  glLoadIdentity();
692 }
693 
694 static void extrawindow_do_key(ExtraWindow *ew, GHOST_TKey key, int press)
695 {
696  switch (key) {
697  case GHOST_kKeyE:
698  if (press)
700  break;
701  }
702 }
703 
705 {
706  GHOST_TUns8 bitmap[16][2];
707  GHOST_TUns8 mask[16][2];
708  double ftime = (double)((GHOST_TInt64)time) / 1000;
709  float angle = fmod(ftime, 1.0) * 3.1415 * 2;
710  int i;
711 
712  memset(&bitmap, 0, sizeof(bitmap));
713  memset(&mask, 0, sizeof(mask));
714 
715  bitmap[0][0] |= mask[0][0] |= 0xF;
716  bitmap[1][0] |= mask[1][0] |= 0xF;
717  bitmap[2][0] |= mask[2][0] |= 0xF;
718  bitmap[3][0] |= mask[3][0] |= 0xF;
719 
720  for (i = 0; i < 7; i++) {
721  int x = 7 + cos(angle) * i;
722  int y = 7 + sin(angle) * i;
723 
724  mask[y][x / 8] |= (1 << (x % 8));
725  }
726  for (i = 0; i < 64; i++) {
727  float v = (i / 63.0) * 3.1415 * 2;
728  int x = 7 + cos(v) * 7;
729  int y = 7 + sin(v) * 7;
730 
731  mask[y][x / 8] |= (1 << (x % 8));
732  }
733 
734  GHOST_SetCustomCursorShape(ew->win, &bitmap[0][0], &mask[0][0], 16, 16, 0, 0, true);
735 }
736 
737 static void extrawindow_handle(void *priv, GHOST_EventHandle evt)
738 {
739  ExtraWindow *ew = priv;
741  char buf[256];
742 
743  event_to_buf(evt, buf);
745 
746  switch (type) {
747  case GHOST_kEventKeyDown:
748  case GHOST_kEventKeyUp: {
751  break;
752  }
753 
754  case GHOST_kEventCursorMove: {
756  break;
757  }
758 
761  break;
764  break;
767  break;
768  }
769 }
770 
771 
772 
774 {
775  GHOST_GLSettings glSettings = {0};
776  GHOST_SystemHandle sys = multitestapp_get_system(app);
777  GHOST_WindowHandle win;
778 
779  win = GHOST_CreateWindow(sys,
780  NULL,
781  "MultiTest:Extra",
782  500,
783  40,
784  400,
785  400,
787  false,
789  glSettings);
790 
791  if (win) {
792  ExtraWindow *ew = MEM_callocN(sizeof(*ew), "mainwindow_new");
793 
794  ew->gpu_context = GPU_context_create(win);
795  GPU_init();
796 
797  ew->app = app;
798  ew->win = win;
799 
801 
802  return ew;
803  }
804  else {
805  return NULL;
806  }
807 }
808 
810 {
811  GHOST_SystemHandle sys = multitestapp_get_system(ew->app);
812 
814  GHOST_DisposeWindow(sys, ew->win);
815  MEM_freeN(ew);
816 }
817 
818 /*
819  * MultiTestApp
820  */
821 
823  GHOST_SystemHandle sys;
827 
828  int exit;
829 };
830 
831 static int multitest_event_handler(GHOST_EventHandle evt, GHOST_TUserDataPtr data)
832 {
833  MultiTestApp *app = data;
834  GHOST_WindowHandle win;
835 
836  win = GHOST_GetEventWindow(evt);
837  if (win && !GHOST_ValidWindow(app->sys, win)) {
838  loggerwindow_log(app->logger, "WARNING: bad event, non-valid window\n");
839  return 1;
840  }
841 
842  if (win) {
844 
845  windowdata_handle(wb, evt);
846  }
847  else {
849 
850  /* GHOST_kEventQuit are the only 'system' events,
851  * that is, events without a window.
852  */
853  switch (type) {
855  app->exit = 1;
856  break;
857 
858  default:
859  fatal("Unhandled system event: %d (%s)\n", type, eventtype_to_string(type));
860  break;
861  }
862  }
863 
864  return 1;
865 }
866 
867 
868 
870 {
871  MultiTestApp *app = MEM_mallocN(sizeof(*app), "multitestapp_new");
872  GHOST_EventConsumerHandle consumer = GHOST_CreateEventConsumer(multitest_event_handler, app);
873 
874  app->sys = GHOST_CreateSystem();
875  if (!app->sys)
876  fatal("Unable to create ghost system");
877 
878  if (!GHOST_AddEventConsumer(app->sys, consumer))
879  fatal("Unable to add multitest event consumer ");
880 
881  app->main = mainwindow_new(app);
882  if (!app->main)
883  fatal("Unable to create main window");
884 
885  app->logger = loggerwindow_new(app);
886  if (!app->logger)
887  fatal("Unable to create logger window");
888 
889  app->extra = NULL;
890  app->exit = 0;
891 
892  return app;
893 }
894 
896 {
897  return app->logger;
898 }
899 
900 GHOST_SystemHandle multitestapp_get_system(MultiTestApp *app)
901 {
902  return app->sys;
903 }
904 
906 {
907  extrawindow_free(app->extra);
908  app->extra = NULL;
909 }
910 
912 {
913  if (app->extra) {
915  }
916  else {
917  app->extra = extrawindow_new(app);
918  }
919 }
920 
922 {
923  app->exit = 1;
924 }
925 
927 {
928  while (!app->exit) {
929  GHOST_ProcessEvents(app->sys, 1);
931  }
932 }
933 
935 {
936  BLF_exit();
937  GPU_exit();
938 
939  mainwindow_free(app->main);
941  GHOST_DisposeSystem(app->sys);
942  MEM_freeN(app);
943 }
944 
945 /***/
946 
947 int main(int argc, char **argv)
948 {
949  MultiTestApp *app;
950 
951  BLF_init();
952 
953  app = multitestapp_new();
954 
955  multitestapp_run(app);
956  multitestapp_free(app);
957 
958  return 0;
959 }
typedef float(TangentPoint)[2]
int BLF_init(void)
Definition: blf.c:81
void BLF_draw(int fontid, const char *str, size_t len) ATTR_NONNULL(2)
Definition: blf.c:542
float BLF_height(int fontid, const char *str, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition: blf.c:752
void BLF_exit(void)
Definition: blf.c:92
void BLF_size(int fontid, int size, int dpi)
Definition: blf.c:367
int BLF_load_default(const bool unique)
void BLF_position(int fontid, float x, float y, float z)
Definition: blf.c:312
void BLI_kdtree_nd_() free(KDTree *tree)
Definition: kdtree_impl.h:116
int min_i(int a, int b)
Definition: Basic.c:22
typedef double(DMatrix)[4][4]
void event_to_buf(GHOST_EventHandle evt, char buf[128])
Definition: EventToBuf.c:203
char * eventtype_to_string(GHOST_TEventType type)
Definition: EventToBuf.c:29
GHOST C-API function and type declarations.
int GHOST_ProcessEvents(GHOST_SystemHandle systemhandle, int waitForEvent)
GHOST_TSuccess GHOST_SetWindowOrder(GHOST_WindowHandle windowhandle, GHOST_TWindowOrder order)
GHOST_TUserDataPtr GHOST_GetWindowUserData(GHOST_WindowHandle windowhandle)
GHOST_TInt32 GHOST_GetHeightRectangle(GHOST_RectangleHandle rectanglehandle)
void GHOST_ScreenToClient(GHOST_WindowHandle windowhandle, GHOST_TInt32 inX, GHOST_TInt32 inY, GHOST_TInt32 *outX, GHOST_TInt32 *outY)
GHOST_SystemHandle GHOST_CreateSystem(void)
Definition: GHOST_C-api.cpp:40
GHOST_TSuccess GHOST_AddEventConsumer(GHOST_SystemHandle systemhandle, GHOST_EventConsumerHandle consumerhandle)
void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr userdata)
GHOST_TSuccess GHOST_SetCursorVisibility(GHOST_WindowHandle windowhandle, int visible)
GHOST_WindowHandle GHOST_CreateWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle parent_windowhandle, const char *title, GHOST_TInt32 left, GHOST_TInt32 top, GHOST_TUns32 width, GHOST_TUns32 height, GHOST_TWindowState state, bool is_dialog, GHOST_TDrawingContextType type, GHOST_GLSettings glSettings)
GHOST_TSuccess GHOST_SetCursorShape(GHOST_WindowHandle windowhandle, GHOST_TStandardCursor cursorshape)
GHOST_TUserDataPtr GHOST_GetTimerTaskUserData(GHOST_TimerTaskHandle timertaskhandle)
GHOST_TSuccess GHOST_InvalidateWindow(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_DisposeWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle)
GHOST_TInt32 GHOST_GetWidthRectangle(GHOST_RectangleHandle rectanglehandle)
GHOST_TSuccess GHOST_SwapWindowBuffers(GHOST_WindowHandle windowhandle)
GHOST_TEventDataPtr GHOST_GetEventData(GHOST_EventHandle eventhandle)
GHOST_TSuccess GHOST_SetCustomCursorShape(GHOST_WindowHandle windowhandle, GHOST_TUns8 *bitmap, GHOST_TUns8 *mask, int sizex, int sizey, int hotX, int hotY, GHOST_TUns8 canInvertColor)
GHOST_TSuccess GHOST_ActivateWindowDrawingContext(GHOST_WindowHandle windowhandle)
GHOST_TEventType GHOST_GetEventType(GHOST_EventHandle eventhandle)
GHOST_WindowHandle GHOST_GetEventWindow(GHOST_EventHandle eventhandle)
GHOST_TimerTaskHandle GHOST_InstallTimer(GHOST_SystemHandle systemhandle, GHOST_TUns64 delay, GHOST_TUns64 interval, GHOST_TimerProcPtr timerProc, GHOST_TUserDataPtr userData)
Definition: GHOST_C-api.cpp:93
void GHOST_DispatchEvents(GHOST_SystemHandle systemhandle)
void GHOST_GetMainDisplayDimensions(GHOST_SystemHandle systemhandle, GHOST_TUns32 *width, GHOST_TUns32 *height)
GHOST_EventConsumerHandle GHOST_CreateEventConsumer(GHOST_EventCallbackProcPtr eventCallback, GHOST_TUserDataPtr userdata)
Definition: GHOST_C-api.cpp:74
GHOST_TUns64 GHOST_GetEventTime(GHOST_EventHandle eventhandle)
GHOST_RectangleHandle GHOST_GetClientBounds(GHOST_WindowHandle windowhandle)
GHOST_TSuccess GHOST_DisposeSystem(GHOST_SystemHandle systemhandle)
Definition: GHOST_C-api.cpp:55
int GHOST_ValidWindow(GHOST_SystemHandle systemhandle, GHOST_WindowHandle windowhandle)
@ GHOST_kWindowStateNormal
Definition: GHOST_Types.h:145
void * GHOST_TUserDataPtr
Definition: GHOST_Types.h:89
GHOST_TStandardCursor
Definition: GHOST_Types.h:222
@ GHOST_kStandardCursorUpDown
Definition: GHOST_Types.h:251
@ GHOST_kStandardCursorDefault
Definition: GHOST_Types.h:224
@ GHOST_kStandardCursorNumCursors
Definition: GHOST_Types.h:264
unsigned int GHOST_TUns32
Definition: GHOST_Types.h:64
unsigned long long GHOST_TUns64
Definition: GHOST_Types.h:86
GHOST_TEventType
Definition: GHOST_Types.h:177
@ GHOST_kEventWindowClose
Definition: GHOST_Types.h:197
@ GHOST_kEventWindowSize
Definition: GHOST_Types.h:201
@ GHOST_kEventCursorMove
Definition: GHOST_Types.h:180
@ GHOST_kEventButtonUp
Mouse button event.
Definition: GHOST_Types.h:182
@ GHOST_kEventWindowUpdate
Definition: GHOST_Types.h:200
@ GHOST_kEventButtonDown
Mouse move event.
Definition: GHOST_Types.h:181
@ GHOST_kEventKeyDown
Trackpad event.
Definition: GHOST_Types.h:191
@ GHOST_kEventKeyUp
Definition: GHOST_Types.h:192
@ GHOST_kEventQuitRequest
Definition: GHOST_Types.h:195
GHOST_TKey
Definition: GHOST_Types.h:267
@ GHOST_kKeyT
Definition: GHOST_Types.h:319
@ GHOST_kKeyC
Definition: GHOST_Types.h:302
@ GHOST_kKeyF11
Definition: GHOST_Types.h:390
@ GHOST_kKeyR
Definition: GHOST_Types.h:317
@ GHOST_kKeyQ
Definition: GHOST_Types.h:316
@ GHOST_kKeyLeftBracket
Definition: GHOST_Types.h:327
@ GHOST_kKeyRightBracket
Definition: GHOST_Types.h:328
@ GHOST_kKeyE
Definition: GHOST_Types.h:304
@ GHOST_kDrawingContextTypeOpenGL
Definition: GHOST_Types.h:158
@ GHOST_kButtonMaskRight
Definition: GHOST_Types.h:168
@ GHOST_kButtonMaskLeft
Definition: GHOST_Types.h:166
@ GHOST_kButtonMaskMiddle
Definition: GHOST_Types.h:167
@ GHOST_kWindowOrderBottom
Definition: GHOST_Types.h:154
unsigned char GHOST_TUns8
Definition: GHOST_Types.h:60
long long GHOST_TInt64
Definition: GHOST_Types.h:85
struct GPUContext GPUContext
Definition: GPU_context.h:44
GPUContext * GPU_context_create(void *ghost_window)
Definition: gpu_context.cc:99
void GPU_context_active_set(GPUContext *)
Definition: gpu_context.cc:121
void GPU_init(void)
Definition: gpu_init_exit.c:43
void GPU_exit(void)
Definition: gpu_init_exit.c:62
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Read Guarded memory(de)allocation.
static void loggerwindow_recalc_regions(LoggerWindow *lw)
Definition: MultiTest.c:390
ExtraWindow * extrawindow_new(MultiTestApp *app)
Definition: MultiTest.c:773
static int multitest_event_handler(GHOST_EventHandle evt, GHOST_TUserDataPtr data)
Definition: MultiTest.c:831
static void loggerwindow_setup_window_gl(LoggerWindow *lw)
Definition: MultiTest.c:410
void multitestapp_toggle_extra_window(MultiTestApp *app)
Definition: MultiTest.c:911
MainWindow * mainwindow_new(MultiTestApp *app)
Definition: MultiTest.c:314
static void mainwindow_do_button(MainWindow *mw, int which, int press)
Definition: MultiTest.c:249
void loggerwindow_free(LoggerWindow *lw)
Definition: MultiTest.c:631
static void loggerwindow_do_move(LoggerWindow *lw, int x, int y)
Definition: MultiTest.c:484
char datatoc_bfont_ttf[]
#define TEXTAREA_PAD
Definition: MultiTest.c:389
GHOST_SystemHandle multitestapp_get_system(MultiTestApp *app)
Definition: MultiTest.c:900
static void mainwindow_do_move(MainWindow *mw, int x, int y)
Definition: MultiTest.c:239
int main(int argc, char **argv)
Definition: MultiTest.c:947
static void mainwindow_timer_proc(GHOST_TimerTaskHandle task, GHOST_TUns64 time)
Definition: MultiTest.c:305
static void loggerwindow_handle(void *priv, GHOST_EventHandle evt)
Definition: MultiTest.c:532
static void loggerwindow_do_reshape(LoggerWindow *lw)
Definition: MultiTest.c:423
LoggerWindow * loggerwindow_new(MultiTestApp *app)
Definition: MultiTest.c:569
int datatoc_bfont_ttf_size
void multitestapp_free(MultiTestApp *app)
Definition: MultiTest.c:934
void multitestapp_free_extrawindow(MultiTestApp *app)
Definition: MultiTest.c:905
MultiTestApp * multitestapp_new(void)
Definition: MultiTest.c:869
void mainwindow_free(MainWindow *mw)
Definition: MultiTest.c:352
static void extrawindow_do_draw(ExtraWindow *ew)
Definition: MultiTest.c:659
static void mainwindow_do_key(MainWindow *mw, GHOST_TKey key, int press)
Definition: MultiTest.c:194
static void loggerwindow_do_key(LoggerWindow *lw, GHOST_TKey key, int press)
Definition: MultiTest.c:522
#define SCROLLBAR_WIDTH
Definition: MultiTest.c:388
static void extrawindow_spin_cursor(ExtraWindow *ew, GHOST_TUns64 time)
Definition: MultiTest.c:704
void extrawindow_free(ExtraWindow *ew)
Definition: MultiTest.c:809
void rect_bevel_smooth(int rect[2][2], int width)
Definition: MultiTest.c:111
static void loggerwindow_do_button(LoggerWindow *lw, int which, int press)
Definition: MultiTest.c:494
void rect_bevel_side(int rect[2][2], int side, float *lt, float *dk, const float col[3], int width)
Definition: MultiTest.c:78
void multitestapp_exit(MultiTestApp *app)
Definition: MultiTest.c:921
void multitestapp_run(MultiTestApp *app)
Definition: MultiTest.c:926
LoggerWindow * multitestapp_get_logger(MultiTestApp *app)
Definition: MultiTest.c:895
static void mainwindow_log(MainWindow *mw, char *str)
Definition: MultiTest.c:149
static void extrawindow_handle(void *priv, GHOST_EventHandle evt)
Definition: MultiTest.c:737
void loggerwindow_log(LoggerWindow *lw, char *line)
Definition: MultiTest.c:619
static void extrawindow_do_reshape(ExtraWindow *ew)
Definition: MultiTest.c:673
static void mainwindow_handle(void *priv, GHOST_EventHandle evt)
Definition: MultiTest.c:264
#define SCROLLBAR_PAD
Definition: MultiTest.c:387
static void mainwindow_do_reshape(MainWindow *mw)
Definition: MultiTest.c:173
static void loggerwindow_do_draw(LoggerWindow *lw)
Definition: MultiTest.c:437
static void mainwindow_do_draw(MainWindow *mw)
Definition: MultiTest.c:154
static void extrawindow_do_key(ExtraWindow *ew, GHOST_TKey key, int press)
Definition: MultiTest.c:694
void scrollbar_keep_scrolling(ScrollBar *sb, int yco)
Definition: ScrollBar.c:110
void scrollbar_start_scrolling(ScrollBar *sb, int yco)
Definition: ScrollBar.c:96
int scrollbar_is_scrolling(ScrollBar *sb)
Definition: ScrollBar.c:87
ScrollBar * scrollbar_new(int inset, int minthumb)
Definition: ScrollBar.c:66
float scrollbar_get_thumbpos(ScrollBar *sb)
Definition: ScrollBar.c:139
void scrollbar_get_rect(ScrollBar *sb, int rect_r[2][2])
Definition: ScrollBar.c:143
void scrollbar_get_thumb(ScrollBar *sb, int thumb_r[2][2])
Definition: ScrollBar.c:75
void scrollbar_set_rect(ScrollBar *sb, int rect[2][2])
Definition: ScrollBar.c:130
int scrollbar_contains_pt(ScrollBar *sb, int pt[2])
Definition: ScrollBar.c:91
void scrollbar_set_thumbpct(ScrollBar *sb, float pct)
Definition: ScrollBar.c:122
void scrollbar_stop_scrolling(ScrollBar *sb)
Definition: ScrollBar.c:116
void * memdbl(void *mem, int *size_pr, int item_size)
Definition: Util.c:30
void fatal(char *fmt,...)
Definition: Util.c:53
char * string_dup(char *str)
Definition: Util.c:43
void windowdata_free(WindowData *wb)
Definition: WindowData.c:47
WindowData * windowdata_new(void *data, WindowDataHandler handler)
Definition: WindowData.c:33
void windowdata_handle(WindowData *wb, GHOST_EventHandle evt)
Definition: WindowData.c:42
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
Definition: btDbvt.cpp:299
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
double time
#define str(s)
#define glColor3f
Definition: gl-deprecated.h:56
#define glBegin
Definition: gl-deprecated.h:34
#define glTranslatef
#define glOrtho
#define glMatrixMode
#define glVertex2i
#define glRecti
#define glColor3fv
Definition: gl-deprecated.h:58
#define glEnd
#define glLoadIdentity
uint col
void immDeactivate()
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
INLINE Rall1d< T, V, S > cos(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:319
INLINE Rall1d< T, V, S > pow(const Rall1d< T, V, S > &arg, double m)
Definition: rall1d.h:359
INLINE Rall1d< T, V, S > sin(const Rall1d< T, V, S > &arg)
Definition: rall1d.h:311
struct blender::compositor::@172::@174 task
MultiTestApp * app
Definition: MultiTest.c:651
GHOST_WindowHandle win
Definition: MultiTest.c:653
int size[2]
Definition: MultiTest.c:656
GPUContext * gpu_context
Definition: MultiTest.c:654
GHOST_TButtonMask button
Definition: GHOST_Types.h:443
GPUContext * gpu_context
Definition: MultiTest.c:140
int size[2]
Definition: MultiTest.c:142
int tmouse[2]
Definition: MultiTest.c:146
int lmbut[3]
Definition: MultiTest.c:144
int lmouse[2]
Definition: MultiTest.c:144
MultiTestApp * app
Definition: MultiTest.c:137
GHOST_WindowHandle win
Definition: MultiTest.c:139
int lmouse[2]
Definition: MultiTest.c:384
ScrollBar * scroll
Definition: MultiTest.c:378
int textarea[2][2]
Definition: MultiTest.c:377
int size[2]
Definition: MultiTest.c:374
GHOST_WindowHandle win
Definition: MultiTest.c:368
int lmbut[3]
Definition: MultiTest.c:383
char ** loglines
Definition: MultiTest.c:380
MultiTestApp * app
Definition: MultiTest.c:366
GPUContext * gpu_context
Definition: MultiTest.c:369
GHOST_SystemHandle sys
Definition: MultiTest.c:823
ExtraWindow * extra
Definition: MultiTest.c:826
MainWindow * main
Definition: MultiTest.c:824
LoggerWindow * logger
Definition: MultiTest.c:825
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)