nogui.c (2075B)
1 #include "u.h" 2 #include "lib.h" 3 #include "mem.h" 4 #include "dat.h" 5 #include "fns.h" 6 #include "error.h" 7 #define Image IMAGE /* kernel has its own Image */ 8 #include <draw.h> 9 #include <memdraw.h> 10 #include <keyboard.h> 11 #include <cursor.h> 12 #include "screen.h" 13 14 15 /* 16 * Replacements for libmemdraw routines. 17 * (They've been underscored.) 18 */ 19 Memimage* 20 allocmemimage(Rectangle r, uint32 chan) 21 { 22 return _allocmemimage(r, chan); 23 } 24 25 void 26 freememimage(Memimage *m) 27 { 28 _freememimage(m); 29 } 30 31 32 int 33 cloadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) 34 { 35 int n; 36 37 n = _cloadmemimage(i, r, data, ndata); 38 return n; 39 } 40 41 /* 42 * The X acceleration doesn't fit into the standard hwaccel 43 * model because we have the extra steps of pulling the image 44 * data off the server and putting it back when we're done. 45 */ 46 void 47 memimagedraw(Memimage *dst, Rectangle r, Memimage *src, Point sp, 48 Memimage *mask, Point mp, int op) 49 { 50 Memdrawparam *par; 51 52 if((par = _memimagedrawsetup(dst, r, src, sp, mask, mp, op)) == nil) 53 return; 54 55 /* now can run memimagedraw on the in-memory bits */ 56 _memimagedraw(par); 57 } 58 59 void 60 memfillcolor(Memimage *m, uint32 val) 61 { 62 _memfillcolor(m, val); 63 } 64 65 int 66 loadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) 67 { 68 int n; 69 70 n = _loadmemimage(i, r, data, ndata); 71 return n; 72 } 73 74 int 75 unloadmemimage(Memimage *i, Rectangle r, uchar *data, int ndata) 76 { 77 return _unloadmemimage(i, r, data, ndata); 78 } 79 80 uint32 81 pixelbits(Memimage *m, Point p) 82 { 83 return _pixelbits(m, p); 84 } 85 86 void 87 getcolor(ulong i, ulong *r, ulong *g, ulong *b) 88 { 89 ulong v; 90 91 v = 0; 92 *r = (v>>16)&0xFF; 93 *g = (v>>8)&0xFF; 94 *b = v&0xFF; 95 } 96 97 int 98 setcolor(ulong i, ulong r, ulong g, ulong b) 99 { 100 /* no-op */ 101 return 0; 102 } 103 104 105 int 106 hwdraw(Memdrawparam *p) 107 { 108 return 0; 109 } 110 111 char* 112 getsnarf(void) 113 { 114 return nil; 115 } 116 117 void 118 putsnarf(char *data) 119 { 120 } 121 122 void 123 setmouse(Point p) 124 { 125 } 126 127 void 128 setcursor(struct Cursor *c) 129 { 130 } 131 132 void 133 flushmemscreen(Rectangle r) 134 { 135 } 136 137 uchar* 138 attachscreen(Rectangle *r, ulong *chan, int *depth, 139 int *width, int *softscreen, void **X) 140 { 141 if(conf.monitor) 142 panic("no gui - must use -g"); 143 return nil; 144 }