Revision 112
fixed problemin 3rd function
graphics.c | ||
---|---|---|
73 | 73 |
return (vbe_mem_info.BitsPerPixel + 7) >> 3; |
74 | 74 |
} |
75 | 75 |
|
76 |
uint16_t get_RedMaskSize(void){
|
|
77 |
return vbe_mem_info.RedMaskSize;
|
|
78 |
} |
|
76 |
uint16_t get_RedMaskSize (void){ return vbe_mem_info.RedMaskSize ; }
|
|
77 |
uint16_t get_GreenMaskSize(void){ return vbe_mem_info.GreenMaskSize; }
|
|
78 |
uint16_t get_BlueMaskSize (void){ return vbe_mem_info.BlueMaskSize ; }
|
|
79 | 79 |
|
80 |
uint16_t get_GreenMaskSize(void){ |
|
81 |
return vbe_mem_info.GreenMaskSize; |
|
82 |
} |
|
83 |
|
|
84 |
uint16_t get_BlueMaskSize(void){ |
|
85 |
return vbe_mem_info.BlueMaskSize; |
|
86 |
} |
|
87 |
|
|
88 | 80 |
int (map_vram)(void) { |
89 | 81 |
int r; |
90 | 82 |
unsigned int vram_base = get_phys_addr(); |
... | ... | |
104 | 96 |
return !lm_free(&mem_map); |
105 | 97 |
} |
106 | 98 |
|
107 |
int (set_pixel)(uint16_t row, uint16_t col, uint32_t color) {
|
|
108 |
if (row >= vbe_mem_info.XResolution || col >= vbe_mem_info.YResolution) {
|
|
99 |
int (set_pixel)(uint16_t x, uint16_t y, uint32_t color) {
|
|
100 |
if (x >= vbe_mem_info.XResolution || y >= vbe_mem_info.YResolution) {
|
|
109 | 101 |
printf("%s: invalid pixel.\n", __func__); |
110 | 102 |
return OUT_OF_RANGE; |
111 | 103 |
} |
112 |
unsigned int pos = (row + col * vbe_mem_info.XResolution) * get_bytes_pixel();
|
|
104 |
unsigned int pos = (x + y * vbe_mem_info.XResolution) * get_bytes_pixel();
|
|
113 | 105 |
memcpy((void*)((unsigned int)video_mem + pos), &color, get_bytes_pixel()); |
114 | 106 |
return SUCCESS; |
115 | 107 |
} |
... | ... | |
138 | 130 |
int r; |
139 | 131 |
for (int i = 0; i < len; i++) |
140 | 132 |
if ((r = set_pixel(x + i, y, color))) return r; |
141 |
|
|
142 | 133 |
return SUCCESS; |
143 | 134 |
} |
144 | 135 |
|
Also available in: Unified diff