Changeset 6d527cff in mainline
- Timestamp:
- 2020-11-16T11:26:21Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 140e21a
- Parents:
- 0d3bc7b1
- git-author:
- Jiri Svoboda <jiri@…> (2020-11-15 19:25:55)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-11-16 11:26:21)
- Location:
- uspace
- Files:
-
- 2 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/fb/kfb/port.c
r0d3bc7b1 r6d527cff 50 50 #include <gfx/color.h> 51 51 #include <gfx/coord.h> 52 #include <io/mode.h>53 52 #include <io/pixelmap.h> 54 53 #include <ipcgfx/server.h> -
uspace/lib/c/include/io/pixelmap.h
r0d3bc7b1 r6d527cff 42 42 #include <stddef.h> 43 43 #include <io/pixel.h> 44 45 /* Defines how a pixel outside of pixmap rectangle shall be treated */46 typedef enum {47 /* Pixels outside of a pixmap are PIXEL(0, 0, 0, 0) */48 PIXELMAP_EXTEND_TRANSPARENT_BLACK = 0,49 50 /* The pixmap is repeated infinetely */51 PIXELMAP_EXTEND_TILE,52 53 /* If outside of a pixmap, return closest pixel from the edge */54 PIXELMAP_EXTEND_SIDES,55 56 /*57 * If outside of a pixmap, return closest pixel from the edge,58 * with alpha = 059 */60 PIXELMAP_EXTEND_TRANSPARENT_SIDES61 } pixelmap_extend_t;62 44 63 45 typedef struct { … … 106 88 } 107 89 108 static inline pixel_t pixelmap_get_extended_pixel(pixelmap_t *pixmap,109 native_t x, native_t y, pixelmap_extend_t extend)110 {111 bool transparent = false;112 if (extend == PIXELMAP_EXTEND_TILE) {113 x %= pixmap->width;114 y %= pixmap->height;115 } else if (extend == PIXELMAP_EXTEND_SIDES ||116 extend == PIXELMAP_EXTEND_TRANSPARENT_SIDES) {117 bool transparent_outside =118 (extend == PIXELMAP_EXTEND_TRANSPARENT_SIDES);119 if (x < 0) {120 x = 0;121 transparent = transparent_outside;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 } else if (((sysarg_t) y) >= pixmap->height) {131 y = pixmap->height - 1;132 transparent = transparent_outside;133 }134 }135 136 if (x < 0 || ((sysarg_t) x) >= pixmap->width ||137 y < 0 || ((sysarg_t) y) >= pixmap->height)138 return PIXEL(0, 0, 0, 0);139 140 pixel_t pixel = pixelmap_get_pixel(pixmap, x, y);141 142 if (transparent)143 pixel = PIXEL(0, RED(pixel), GREEN(pixel), BLUE(pixel));144 145 return pixel;146 }147 148 90 #endif 149 91
Note:
See TracChangeset
for help on using the changeset viewer.