update to servicepoint 0.4.2
This commit is contained in:
		
							parent
							
								
									8690e052bd
								
							
						
					
					
						commit
						c01264afd7
					
				
					 5 changed files with 26 additions and 25 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -1,2 +1,3 @@ | |||
| /target | ||||
| /.idea | ||||
| .direnv | ||||
|  |  | |||
							
								
								
									
										8
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							|  | @ -477,9 +477,9 @@ dependencies = [ | |||
| 
 | ||||
| [[package]] | ||||
| name = "crc32fast" | ||||
| version = "1.4.0" | ||||
| version = "1.4.2" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" | ||||
| checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" | ||||
| dependencies = [ | ||||
|  "cfg-if", | ||||
| ] | ||||
|  | @ -1622,9 +1622,9 @@ dependencies = [ | |||
| 
 | ||||
| [[package]] | ||||
| name = "servicepoint2" | ||||
| version = "0.4.1" | ||||
| version = "0.4.2" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "54d49d501f34100406d70730d887775ed5961b6343ccb10d5ef0e105d7b295ae" | ||||
| checksum = "94d9aecc4d31a71578481de6c6d64383d374126c38469c9689067579c1d910fd" | ||||
| dependencies = [ | ||||
|  "bzip2", | ||||
|  "flate2", | ||||
|  |  | |||
|  | @ -7,7 +7,7 @@ license = "GPL-3.0-or-later" | |||
| 
 | ||||
| [dependencies] | ||||
| # packet parsing | ||||
| servicepoint2 = "0.4.1" | ||||
| servicepoint2 = { version = "0.4.2", features = ["all_compressions"] } | ||||
| 
 | ||||
| # gui | ||||
| winit = { version = "0.30", features = ["rwh_05"] } # for creating a window | ||||
|  |  | |||
							
								
								
									
										13
									
								
								shell.nix
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								shell.nix
									
										
									
									
									
								
							|  | @ -1,4 +1,11 @@ | |||
| { pkgs ? import <nixpkgs> {} }: | ||||
|   pkgs.mkShell { | ||||
|     nativeBuildInputs = with pkgs.buildPackages; [ rustup pkg-config xe lzma ]; | ||||
| {pkgs ? import <nixpkgs> {}}: | ||||
| pkgs.mkShell { | ||||
|   nativeBuildInputs = with pkgs.buildPackages; [ | ||||
|     rustup | ||||
|     pkg-config | ||||
|     xe | ||||
|     lzma | ||||
|     libxkbcommon | ||||
|     wayland | ||||
|   ]; | ||||
| } | ||||
|  |  | |||
|  | @ -2,7 +2,8 @@ use std::sync::{RwLock, RwLockWriteGuard}; | |||
| 
 | ||||
| use log::{debug, error, info, warn}; | ||||
| use servicepoint2::{ | ||||
|     ByteGrid, Command, Origin, PixelGrid, PIXEL_COUNT, PIXEL_WIDTH, TILE_SIZE, | ||||
|     ByteGrid, Command, Grid, Origin, PIXEL_COUNT, PIXEL_WIDTH, PixelGrid, | ||||
|     TILE_SIZE, | ||||
| }; | ||||
| 
 | ||||
| use crate::font::BitmapFont; | ||||
|  | @ -25,7 +26,7 @@ pub(crate) fn execute_command( | |||
|         } | ||||
|         Command::BitmapLinearWin(Origin(x, y), pixels, _) => { | ||||
|             let mut display = display_ref.write().unwrap(); | ||||
|             print_pixel_grid(x as usize, y as usize, &pixels, &mut display); | ||||
|             print_pixel_grid(x, y, &pixels, &mut display); | ||||
|         } | ||||
|         Command::Cp437Data(origin, grid) => { | ||||
|             let mut display = display_ref.write().unwrap(); | ||||
|  | @ -37,7 +38,7 @@ pub(crate) fn execute_command( | |||
|         } | ||||
|         // TODO: how to deduplicate this code in a rusty way?
 | ||||
|         Command::BitmapLinear(offset, vec, _) => { | ||||
|             if !check_bitmap_valid(offset, vec.len()) { | ||||
|             if !check_bitmap_valid(offset as u16, vec.len()) { | ||||
|                 return true; | ||||
|             } | ||||
|             let mut display = display_ref.write().unwrap(); | ||||
|  | @ -48,7 +49,7 @@ pub(crate) fn execute_command( | |||
|             } | ||||
|         } | ||||
|         Command::BitmapLinearAnd(offset, vec, _) => { | ||||
|             if !check_bitmap_valid(offset, vec.len()) { | ||||
|             if !check_bitmap_valid(offset as u16, vec.len()) { | ||||
|                 return true; | ||||
|             } | ||||
|             let mut display = display_ref.write().unwrap(); | ||||
|  | @ -60,7 +61,7 @@ pub(crate) fn execute_command( | |||
|             } | ||||
|         } | ||||
|         Command::BitmapLinearOr(offset, vec, _) => { | ||||
|             if !check_bitmap_valid(offset, vec.len()) { | ||||
|             if !check_bitmap_valid(offset as u16, vec.len()) { | ||||
|                 return true; | ||||
|             } | ||||
|             let mut display = display_ref.write().unwrap(); | ||||
|  | @ -72,7 +73,7 @@ pub(crate) fn execute_command( | |||
|             } | ||||
|         } | ||||
|         Command::BitmapLinearXor(offset, vec, _) => { | ||||
|             if !check_bitmap_valid(offset, vec.len()) { | ||||
|             if !check_bitmap_valid(offset as u16, vec.len()) { | ||||
|                 return true; | ||||
|             } | ||||
|             let mut display = display_ref.write().unwrap(); | ||||
|  | @ -85,8 +86,6 @@ pub(crate) fn execute_command( | |||
|         } | ||||
|         Command::CharBrightness(origin, grid) => { | ||||
|             let Origin(offset_x, offset_y) = origin; | ||||
|             let offset_x = offset_x as usize; | ||||
|             let offset_y = offset_y as usize; | ||||
| 
 | ||||
|             let mut luma = luma_ref.write().unwrap(); | ||||
|             for inner_y in 0..grid.height() { | ||||
|  | @ -130,9 +129,6 @@ fn print_cp437_data( | |||
|     display: &mut RwLockWriteGuard<PixelGrid>, | ||||
| ) { | ||||
|     let Origin(x, y) = origin; | ||||
|     let x = x as usize; | ||||
|     let y = y as usize; | ||||
| 
 | ||||
|     for char_y in 0usize..grid.height() { | ||||
|         for char_x in 0usize..grid.width() { | ||||
|             let char_code = grid.get(char_x, char_y); | ||||
|  | @ -142,8 +138,8 @@ fn print_cp437_data( | |||
| 
 | ||||
|             let bitmap = font.get_bitmap(char_code); | ||||
|             if !print_pixel_grid( | ||||
|                 tile_x * TILE_SIZE as usize, | ||||
|                 tile_y * TILE_SIZE as usize, | ||||
|                 tile_x * TILE_SIZE, | ||||
|                 tile_y * TILE_SIZE, | ||||
|                 bitmap, | ||||
|                 display, | ||||
|             ) { | ||||
|  | @ -185,8 +181,5 @@ fn print_pixel_grid( | |||
| 
 | ||||
| fn get_coordinates_for_index(offset: usize, index: usize) -> (usize, usize) { | ||||
|     let pixel_index = offset + index; | ||||
|     ( | ||||
|         pixel_index % PIXEL_WIDTH as usize, | ||||
|         pixel_index / PIXEL_WIDTH as usize, | ||||
|     ) | ||||
|     (pixel_index % PIXEL_WIDTH, pixel_index / PIXEL_WIDTH) | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vinzenz Schroeter
						Vinzenz Schroeter