Changes in uspace/app/fontviewer/fontviewer.c [38d150e:09d13c8e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/fontviewer/fontviewer.c
r38d150e r09d13c8e 38 38 #include <stdlib.h> 39 39 #include <stdbool.h> 40 #include <str_error.h> 40 41 #include <window.h> 41 42 #include <canvas.h> … … 62 63 char *font_path = NULL; 63 64 64 static int draw(void);65 static errno_t draw(void); 65 66 66 67 static void on_keyboard_event(widget_t *widget, void *data) … … 95 96 } 96 97 97 int rc = draw();98 errno_t rc = draw(); 98 99 if (rc != EOK) { 99 printf("Failed drawing: % d.\n", rc);100 printf("Failed drawing: %s.\n", str_error(rc)); 100 101 exit(1); 101 102 } … … 103 104 } 104 105 105 static int create_font(font_t **font, uint16_t points)106 static errno_t create_font(font_t **font, uint16_t points) 106 107 { 107 108 if (font_path == NULL) { … … 138 139 139 140 static int text(drawctx_t *, font_t *, source_t *, surface_coord_t x, 140 surface_coord_t , const char *, ...) PRINTF_ATTRIBUTE(6, 7);141 surface_coord_t , const char *, ...) _HELENOS_PRINTF_ATTRIBUTE(6, 7); 141 142 static int text(drawctx_t *drawctx, font_t *font, source_t *source, 142 143 surface_coord_t x, surface_coord_t y, const char *fmt, ...) … … 148 149 va_end(args); 149 150 150 if (ret <= 0) 151 return ret; 152 153 drawctx_set_source(drawctx, source); 154 drawctx_set_font(drawctx, font); 155 drawctx_print(drawctx, str, x, y); 156 157 free(str); 151 if (ret >= 0) { 152 drawctx_set_source(drawctx, source); 153 drawctx_set_font(drawctx, font); 154 drawctx_print(drawctx, str, x, y); 155 156 free(str); 157 } 158 158 159 159 return ret; … … 161 161 162 162 163 static int draw(void)163 static errno_t draw(void) 164 164 { 165 165 source_t background = rgb(255, 255, 255); … … 174 174 175 175 font_t *font; 176 int rc = create_font(&font, points);176 errno_t rc = create_font(&font, points); 177 177 if (rc != EOK) { 178 178 printf("Failed creating font\n"); … … 274 274 height = WINDOW_HEIGHT; 275 275 276 int rc = draw();276 errno_t rc = draw(); 277 277 if (rc != EOK) { 278 printf("Failed drawing: % d.\n", rc);278 printf("Failed drawing: %s.\n", str_error(rc)); 279 279 return 2; 280 280 }
Note:
See TracChangeset
for help on using the changeset viewer.