FreeRDP
rdtk_engine.c
1 
19 #include <winpr/assert.h>
20 
21 #include <rdtk/config.h>
22 
23 #include "rdtk_font.h"
24 #include "rdtk_nine_patch.h"
25 #include "rdtk_button.h"
26 #include "rdtk_text_field.h"
27 
28 #include "rdtk_engine.h"
29 
30 rdtkEngine* rdtk_engine_new(void)
31 {
32  rdtkEngine* engine = (rdtkEngine*)calloc(1, sizeof(rdtkEngine));
33 
34  if (!engine)
35  return NULL;
36 
37  if (rdtk_font_engine_init(engine) < 0)
38  goto fail;
39  if (rdtk_nine_patch_engine_init(engine) < 0)
40  goto fail;
41  if (rdtk_button_engine_init(engine) < 0)
42  goto fail;
43  if (rdtk_text_field_engine_init(engine) < 0)
44  goto fail;
45 
46  return engine;
47 
48 fail:
49  rdtk_engine_free(engine);
50  return NULL;
51 }
52 
53 void rdtk_engine_free(rdtkEngine* engine)
54 {
55  if (!engine)
56  return;
57 
58  rdtk_font_engine_uninit(engine);
59  rdtk_nine_patch_engine_uninit(engine);
60  rdtk_button_engine_uninit(engine);
61  rdtk_text_field_engine_uninit(engine);
62 
63  free(engine);
64 }