Changeset 15d0046 in mainline for uspace/lib/c/include/io
- Timestamp:
- 2014-09-12T13:22:33Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9b20126
- Parents:
- 8db09e4 (diff), 105d8d6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib/c/include/io
- Files:
-
- 1 added
- 2 edited
- 1 moved
-
chardev.h (moved) (moved from uspace/drv/char/xtkbd/chardev.h ) (1 diff)
-
chardev_srv.h (added)
-
input.h (modified) (2 diffs)
-
pixelmap.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/io/chardev.h
r8db09e4 r15d0046 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 /** @addtogroup drvkbd28 /** @addtogroup libc 29 29 * @{ 30 30 */ 31 /** @file32 * @brief ps/2 mouse driver.33 */34 31 35 #ifndef _CHARDEV_H_36 #define _CHARDEV_H_32 #ifndef LIBC_IO_CHARDEV_H_ 33 #define LIBC_IO_CHARDEV_H_ 37 34 38 35 #include <libarch/types.h> -
uspace/lib/c/include/io/input.h
r8db09e4 r15d0046 49 49 50 50 typedef struct input_ev_ops { 51 int (*active)(input_t *); 52 int (*deactive)(input_t *); 51 53 int (*key)(input_t *, kbd_event_type_t, keycode_t, keymod_t, wchar_t); 52 54 int (*move)(input_t *, int, int); … … 57 59 extern int input_open(async_sess_t *, input_ev_ops_t *, void *, input_t **); 58 60 extern void input_close(input_t *); 59 extern int input_yield(input_t *); 60 extern int input_reclaim(input_t *); 61 extern int input_activate(input_t *); 61 62 62 63 #endif -
uspace/lib/c/include/io/pixelmap.h
r8db09e4 r15d0046 1 1 /* 2 2 * Copyright (c) 2011 Petr Koupy 3 * Copyright (c) 2014 Martin Sucha 3 4 * All rights reserved. 4 5 * … … 40 41 #include <unistd.h> 41 42 #include <io/pixel.h> 43 44 /* Defines how a pixel outside of pixmap rectangle shall be treated */ 45 typedef enum { 46 /* Pixels outside of a pixmap are PIXEL(0, 0, 0, 0) */ 47 PIXELMAP_EXTEND_TRANSPARENT_BLACK = 0, 48 49 /* The pixmap is repeated infinetely */ 50 PIXELMAP_EXTEND_TILE, 51 52 /* If outside of a pixmap, return closest pixel from the edge */ 53 PIXELMAP_EXTEND_SIDES, 54 55 /* If outside of a pixmap, return closest pixel from the edge, 56 * with alpha = 0 57 */ 58 PIXELMAP_EXTEND_TRANSPARENT_SIDES 59 } pixelmap_extend_t; 42 60 43 61 typedef struct { … … 86 104 } 87 105 106 static inline pixel_t pixelmap_get_extended_pixel(pixelmap_t *pixmap, 107 native_t x, native_t y, pixelmap_extend_t extend) 108 { 109 bool transparent = false; 110 if (extend == PIXELMAP_EXTEND_TILE) { 111 x %= pixmap->width; 112 y %= pixmap->height; 113 } 114 else if (extend == PIXELMAP_EXTEND_SIDES || 115 extend == PIXELMAP_EXTEND_TRANSPARENT_SIDES) { 116 bool transparent_outside = 117 (extend == PIXELMAP_EXTEND_TRANSPARENT_SIDES); 118 if (x < 0) { 119 x = 0; 120 transparent = transparent_outside; 121 } 122 else if (((sysarg_t) x) >= pixmap->width) { 123 x = pixmap->width - 1; 124 transparent = transparent_outside; 125 } 126 127 if (y < 0) { 128 y = 0; 129 transparent = transparent_outside; 130 } 131 else if (((sysarg_t) y) >= pixmap->height) { 132 y = pixmap->height - 1; 133 transparent = transparent_outside; 134 } 135 } 136 137 if (x < 0 || ((sysarg_t) x) >= pixmap->width || 138 y < 0 || ((sysarg_t) y) >= pixmap->height) 139 return PIXEL(0, 0, 0, 0); 140 141 pixel_t pixel = pixelmap_get_pixel(pixmap, x, y); 142 143 if (transparent) 144 pixel = PIXEL(0, RED(pixel), GREEN(pixel), BLUE(pixel)); 145 146 return pixel; 147 } 148 149 88 150 #endif 89 151
Note:
See TracChangeset
for help on using the changeset viewer.
