Changeset a35b458 in mainline for uspace/lib/gui/canvas.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/gui/canvas.c
r3061bc1 ra35b458 45 45 { 46 46 canvas_t *canvas = (canvas_t *) widget; 47 47 48 48 surface_t *surface = window_claim(canvas->widget.window); 49 49 if (!surface) { 50 50 window_yield(canvas->widget.window); 51 51 } 52 52 53 53 transform_t transform; 54 54 transform_identity(&transform); 55 55 transform_translate(&transform, widget->hpos, widget->vpos); 56 56 57 57 source_t source; 58 58 source_init(&source); … … 60 60 source_set_texture(&source, canvas->surface, 61 61 PIXELMAP_EXTEND_TRANSPARENT_BLACK); 62 62 63 63 drawctx_t drawctx; 64 64 drawctx_init(&drawctx, surface); 65 65 66 66 drawctx_set_source(&drawctx, &source); 67 67 drawctx_transfer(&drawctx, widget->hpos, widget->vpos, widget->width, 68 68 widget->height); 69 69 70 70 window_yield(canvas->widget.window); 71 71 } … … 79 79 { 80 80 canvas_t *canvas = (canvas_t *) widget; 81 81 82 82 deinit_canvas(canvas); 83 83 free(canvas); … … 93 93 { 94 94 canvas_t *canvas = (canvas_t *) widget; 95 95 96 96 widget_modify(widget, hpos, vpos, canvas->width, canvas->height); 97 97 paint_internal(widget); … … 107 107 { 108 108 canvas_t *canvas = (canvas_t *) widget; 109 109 110 110 sig_send(&canvas->keyboard_event, &event); 111 111 } … … 115 115 canvas_t *canvas = (canvas_t *) widget; 116 116 pos_event_t tevent; 117 117 118 118 tevent = event; 119 119 tevent.hpos -= widget->hpos; 120 120 tevent.vpos -= widget->vpos; 121 121 122 122 sig_send(&canvas->position_event, &tevent); 123 123 } … … 127 127 { 128 128 widget_init(&canvas->widget, parent, data); 129 129 130 130 canvas->widget.width = width; 131 131 canvas->widget.height = height; 132 132 133 133 canvas->widget.width_min = width; 134 134 canvas->widget.height_min = height; … … 137 137 canvas->widget.width_max = width; 138 138 canvas->widget.height_max = height; 139 139 140 140 canvas->widget.destroy = canvas_destroy; 141 141 canvas->widget.reconfigure = canvas_reconfigure; … … 144 144 canvas->widget.handle_keyboard_event = canvas_handle_keyboard_event; 145 145 canvas->widget.handle_position_event = canvas_handle_position_event; 146 146 147 147 canvas->width = width; 148 148 canvas->height = height; 149 149 canvas->surface = surface; 150 150 151 151 return true; 152 152 } … … 156 156 if (surface != NULL) 157 157 canvas->surface = surface; 158 158 159 159 canvas_repaint(&canvas->widget); 160 160 return true; … … 167 167 if (!canvas) 168 168 return NULL; 169 169 170 170 if (init_canvas(canvas, parent, data, width, height, surface)) 171 171 return canvas; 172 172 173 173 free(canvas); 174 174 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.