MCPcopy Create free account
hub / github.com/Ruddle/Fomos / flush

Method flush

bootloader/kernel/src/framebuffer.rs:229–276  ·  view source on GitHub ↗
(&mut self, framebuffer: &mut [u8], info: &FrameBufferInfo)

Source from the content-addressed store, hash-verified

227 }
228
229 pub fn flush(&mut self, framebuffer: &mut [u8], info: &FrameBufferInfo) {
230 let mut todraw = &self.pixels;
231
232 let start = global_time_ms();
233
234 // match info.pixel_format {
235 // PixelFormat::Bgr => {
236 // for (idx, &i) in self.pixels.iter().enumerate() {
237 // self.backbuffer[idx].r = i.b;
238 // self.backbuffer[idx].g = i.g;
239 // self.backbuffer[idx].b = i.r;
240 // }
241 // // todraw = &self.backbuffer;
242 // }
243 // _ => {}
244 // }
245
246 // let time0 = get_time_ms() - start;
247
248 // let start = get_time_ms();
249 framebuffer.copy_from_slice(unsafe {
250 slice::from_raw_parts(todraw.as_ptr() as *const u8, framebuffer.len())
251 });
252 // log::info!("step 0 FB {}ms", time0);
253 // log::info!("step 1 FB {}ms", get_time_ms() - start);
254 // for y in 0..self.h {
255 // for x in 0..self.w {
256 // let RGBA { r, g, b, a } = self.pixels[x + self.w * y];
257 // let pixel_offset = y * info.stride + x;
258
259 // let color = match info.pixel_format {
260 // PixelFormat::Rgb => [r, g, b, 0],
261 // PixelFormat::Bgr => [b, g, r, 0],
262 // PixelFormat::U8 => [if (g + b + r) as usize > 200 { 0xf } else { 0 }, 0, 0, 0],
263 // other => {
264 // // set a supported (but invalid) pixel format before panicking to avoid a double
265 // // panic; it might not be readable though
266 // // info.pixel_format = PixelFormat::Rgb;
267 // panic!("pixel format {:?} not supported in logger", other)
268 // }
269 // };
270 // let bytes_per_pixel = info.bytes_per_pixel;
271 // let byte_offset = pixel_offset * bytes_per_pixel;
272 // framebuffer[byte_offset..(byte_offset + bytes_per_pixel)]
273 // .copy_from_slice(&color[..bytes_per_pixel]);
274 // }
275 // }
276 }
277
278 // pub fn set(x: usize, y: usize)
279}

Callers 5

create_virt_from_physFunction · 0.45
kernel_mainFunction · 0.45
init_heapFunction · 0.45

Calls 1

global_time_msFunction · 0.85

Tested by

no test coverage detected