code cleaning
Creates Pixel_in_document_current_layer() to factorize code between Pixel_in_spare() and Pixel_in_current_layer()
This commit is contained in:
		
							parent
							
								
									0af49cfd95
								
							
						
					
					
						commit
						aeaf468c4b
					
				@ -291,8 +291,7 @@ GFX2_GLOBAL int Pixel_width;
 | 
			
		||||
GFX2_GLOBAL int Pixel_height;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// -- Current image data
 | 
			
		||||
 | 
			
		||||
/// Current image data
 | 
			
		||||
GFX2_GLOBAL T_Document Main;
 | 
			
		||||
 | 
			
		||||
/// Pointer to the pixel data of the main image
 | 
			
		||||
@ -300,8 +299,7 @@ GFX2_GLOBAL byte *    Main_screen;
 | 
			
		||||
/// Lookup table for XOR effects, pointing each color to the most different one
 | 
			
		||||
GFX2_GLOBAL byte xor_lut[256];
 | 
			
		||||
 | 
			
		||||
// -- Spare page data
 | 
			
		||||
 | 
			
		||||
/// Spare page data
 | 
			
		||||
GFX2_GLOBAL T_Document Spare;
 | 
			
		||||
 | 
			
		||||
// -- Image backups
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								src/graph.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								src/graph.c
									
									
									
									
									
								
							@ -3502,18 +3502,32 @@ static void Pixel_in_screen_overlay_with_opt_preview(word x,word y,byte color,in
 | 
			
		||||
 | 
			
		||||
Func_pixel_opt_preview Pixel_in_current_screen_with_opt_preview=Pixel_in_screen_direct_with_opt_preview;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Put a pixel in the current layer of a "Document"
 | 
			
		||||
 *
 | 
			
		||||
 * @param doc pointer to either @ref Main or @ref Spare
 | 
			
		||||
 * @param x x coordinate of the pixel to put
 | 
			
		||||
 * @param y y coordinate of the pixel to put
 | 
			
		||||
 * @param color the new color for the pixel
 | 
			
		||||
 */
 | 
			
		||||
void Pixel_in_document_current_layer(T_Document * doc, word x, word y, byte color)
 | 
			
		||||
{
 | 
			
		||||
  doc->backups->Pages->Image[doc->current_layer].Pixels[x + y*doc->image_width] = color;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Pixel_in_spare(word x,word y, byte color)
 | 
			
		||||
{
 | 
			
		||||
  *((y)*Spare.image_width+(x)+Spare.backups->Pages->Image[Spare.current_layer].Pixels)=color;
 | 
			
		||||
  Pixel_in_document_current_layer(&Spare, x, y, color);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Pixel_in_current_layer(word x,word y, byte color)
 | 
			
		||||
{
 | 
			
		||||
  *((y)*Main.image_width+(x)+Main.backups->Pages->Image[Main.current_layer].Pixels)=color;
 | 
			
		||||
  Pixel_in_document_current_layer(&Main, x, y, color);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
byte Read_pixel_from_current_layer(word x,word y)
 | 
			
		||||
{
 | 
			
		||||
  // return Main.backups->Pages->Image[Main.current_layer].Pixels[x + y*Main.image_width];
 | 
			
		||||
  return *((y)*Main.image_width+(x)+Main.backups->Pages->Image[Main.current_layer].Pixels);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user