Revision 134
corrected dragging and flickering. now one or + pixels do not match
graphics.c | ||
---|---|---|
172 | 172 |
return !lm_free(&mem_map); |
173 | 173 |
} |
174 | 174 |
|
175 |
int (set_pixel)(uint16_t x, uint16_t y, uint32_t color) { |
|
176 |
if (x >= vbe_mem_info.XResolution || y >= vbe_mem_info.YResolution) { |
|
177 |
printf("%s: invalid pixel.\n", __func__); |
|
178 |
return OUT_OF_RANGE; |
|
179 |
} |
|
180 |
unsigned int pos = (x + y * vbe_mem_info.XResolution) * get_bytes_pixel(); |
|
181 |
memcpy((void*)((unsigned int)video_mem + pos), &color, get_bytes_pixel()); |
|
182 |
return SUCCESS; |
|
183 |
} |
|
184 |
|
|
185 | 175 |
int (set_graphics_mode)(uint16_t mode) { |
186 | 176 |
struct reg86 reg_86; |
187 | 177 |
|
... | ... | |
202 | 192 |
return SUCCESS; |
203 | 193 |
} |
204 | 194 |
|
195 |
|
|
196 |
int (set_pixel)(uint16_t x, uint16_t y, uint32_t color) { |
|
197 |
if (x >= vbe_mem_info.XResolution || y >= vbe_mem_info.YResolution) { |
|
198 |
printf("%s: invalid pixel.\n", __func__); |
|
199 |
return OUT_OF_RANGE; |
|
200 |
} |
|
201 |
unsigned int pos = (x + y * vbe_mem_info.XResolution) * get_bytes_pixel(); |
|
202 |
memcpy((void*)((unsigned int)video_mem + pos), &color, get_bytes_pixel()); |
|
203 |
return SUCCESS; |
|
204 |
} |
|
205 |
|
|
205 | 206 |
int (draw_hline)(uint16_t x, uint16_t y, uint16_t len, uint32_t color){ |
206 | 207 |
int r; |
207 | 208 |
for (uint16_t i = 0; i < len; i++) |
... | ... | |
221 | 222 |
int (vg_draw_rectangle)(uint16_t x, uint16_t y,uint16_t width, uint16_t height, uint32_t color){ |
222 | 223 |
return draw_rectangle(x,y,width,height, color); |
223 | 224 |
} |
225 |
|
|
226 |
int paint_screen(uint32_t color){ |
|
227 |
return draw_rectangle(0,0,get_XRes(),get_YRes(),color); |
|
228 |
} |
|
229 |
|
|
230 |
int clear_screen(){ |
|
231 |
return paint_screen(0); |
|
232 |
} |
Also available in: Unified diff