Changes in uspace/lib/gui/canvas.c [e31ea20d:10cb47e] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gui/canvas.c
re31ea20d r10cb47e 58 58 source_init(&source); 59 59 source_set_transform(&source, transform); 60 source_set_texture(&source, canvas->surface, false); 60 source_set_texture(&source, canvas->surface, 61 PIXELMAP_EXTEND_TRANSPARENT_BLACK); 61 62 62 63 drawctx_t drawctx; … … 105 106 static void canvas_handle_keyboard_event(widget_t *widget, kbd_event_t event) 106 107 { 107 /* No-op */ 108 canvas_t *canvas = (canvas_t *) widget; 109 110 sig_send(&canvas->keyboard_event, &event); 108 111 } 109 112 110 113 static void canvas_handle_position_event(widget_t *widget, pos_event_t event) 111 114 { 112 /* No-op */ 115 canvas_t *canvas = (canvas_t *) widget; 116 pos_event_t tevent; 117 118 tevent = event; 119 tevent.hpos -= widget->hpos; 120 tevent.vpos -= widget->vpos; 121 122 sig_send(&canvas->position_event, &tevent); 113 123 } 114 124 115 bool init_canvas(canvas_t *canvas, widget_t *parent, sysarg_t width,116 sysarg_t height, surface_t *surface)125 bool init_canvas(canvas_t *canvas, widget_t *parent, const void *data, 126 sysarg_t width, sysarg_t height, surface_t *surface) 117 127 { 118 widget_init(&canvas->widget, parent );128 widget_init(&canvas->widget, parent, data); 119 129 120 130 canvas->widget.width = width; … … 142 152 } 143 153 144 canvas_t *create_canvas(widget_t *parent, sysarg_t width, sysarg_t height, 145 surface_t *surface) 154 bool update_canvas(canvas_t *canvas, surface_t *surface) 155 { 156 if (surface != NULL) 157 canvas->surface = surface; 158 159 canvas_repaint(&canvas->widget); 160 return true; 161 } 162 163 canvas_t *create_canvas(widget_t *parent, const void *data, sysarg_t width, 164 sysarg_t height, surface_t *surface) 146 165 { 147 166 canvas_t *canvas = (canvas_t *) malloc(sizeof(canvas_t)); … … 149 168 return NULL; 150 169 151 if (init_canvas(canvas, parent, width, height, surface))170 if (init_canvas(canvas, parent, data, width, height, surface)) 152 171 return canvas; 153 172
Note:
See TracChangeset
for help on using the changeset viewer.