Rename cammy_image_format values to add bit depth
This commit is contained in:
		
							parent
							
								
									eba1a3e6b8
								
							
						
					
					
						commit
						15f540d763
					
				
					 3 changed files with 12 additions and 11 deletions
				
			
		|  | @ -83,7 +83,7 @@ int cammy_tile_import(int argc, char **argv) { | ||||||
|         goto error_malloc_dest; |         goto error_malloc_dest; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     dest->format = CAMMY_IMAGE_TILE; |     dest->format = CAMMY_IMAGE_2BPP_TILE; | ||||||
|     dest->tiles  = (cammy_tile *)&sram->data->photos[photo-1].tiles; |     dest->tiles  = (cammy_tile *)&sram->data->photos[photo-1].tiles; | ||||||
|     dest->width  = CAMMY_PHOTO_WIDTH; |     dest->width  = CAMMY_PHOTO_WIDTH; | ||||||
|     dest->height = CAMMY_PHOTO_HEIGHT; |     dest->height = CAMMY_PHOTO_HEIGHT; | ||||||
|  | @ -161,13 +161,13 @@ int cammy_tile_export(int argc, char **argv) { | ||||||
|         goto error_malloc_src; |         goto error_malloc_src; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     src->format = CAMMY_IMAGE_TILE; |     src->format = CAMMY_IMAGE_2BPP_TILE; | ||||||
|     src->size   = CAMMY_PHOTO_SIZE; |     src->size   = CAMMY_PHOTO_SIZE; | ||||||
|     src->width  = CAMMY_PHOTO_WIDTH; |     src->width  = CAMMY_PHOTO_WIDTH; | ||||||
|     src->height = CAMMY_PHOTO_HEIGHT; |     src->height = CAMMY_PHOTO_HEIGHT; | ||||||
|     src->tiles  = (cammy_tile *)&sram->data->photos[photo-1].tiles; |     src->tiles  = (cammy_tile *)&sram->data->photos[photo-1].tiles; | ||||||
| 
 | 
 | ||||||
|     if ((dest = cammy_image_new(CAMMY_IMAGE_TILE, |     if ((dest = cammy_image_new(CAMMY_IMAGE_2BPP_TILE, | ||||||
|                                 CAMMY_SCREEN_WIDTH, |                                 CAMMY_SCREEN_WIDTH, | ||||||
|                                 CAMMY_SCREEN_HEIGHT)) == NULL) { |                                 CAMMY_SCREEN_HEIGHT)) == NULL) { | ||||||
|         fprintf(stderr, "%s: %s: %s\n", |         fprintf(stderr, "%s: %s: %s\n", | ||||||
|  |  | ||||||
|  | @ -13,9 +13,9 @@ | ||||||
| 
 | 
 | ||||||
| typedef enum { | typedef enum { | ||||||
|     CAMMY_IMAGE_NONE, |     CAMMY_IMAGE_NONE, | ||||||
|     CAMMY_IMAGE_TILE, |     CAMMY_IMAGE_2BPP_TILE, | ||||||
|     CAMMY_IMAGE_RGB, |     CAMMY_IMAGE_24BPP_RGB, | ||||||
|     CAMMY_IMAGE_RGBA |     CAMMY_IMAGE_32BPP_RGBA | ||||||
| } cammy_image_format; | } cammy_image_format; | ||||||
| 
 | 
 | ||||||
| typedef struct _cammy_image { | typedef struct _cammy_image { | ||||||
|  |  | ||||||
							
								
								
									
										11
									
								
								src/image.c
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								src/image.c
									
										
									
									
									
								
							|  | @ -151,7 +151,7 @@ cammy_image *cammy_image_new(cammy_image_format format, | ||||||
|     size_t size; |     size_t size; | ||||||
| 
 | 
 | ||||||
|     switch (format) { |     switch (format) { | ||||||
|         case CAMMY_IMAGE_TILE: { |         case CAMMY_IMAGE_2BPP_TILE: { | ||||||
|             size_t tiles_width  = width  >> 3, |             size_t tiles_width  = width  >> 3, | ||||||
|                    tiles_height = height >> 3; |                    tiles_height = height >> 3; | ||||||
| 
 | 
 | ||||||
|  | @ -163,12 +163,12 @@ cammy_image *cammy_image_new(cammy_image_format format, | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         case CAMMY_IMAGE_RGB: { |         case CAMMY_IMAGE_24BPP_RGB: { | ||||||
|             size = 3 * width * height; |             size = 3 * width * height; | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         case CAMMY_IMAGE_RGBA: { |         case CAMMY_IMAGE_32BPP_RGBA: { | ||||||
|             size = 4 * width * height; |             size = 4 * width * height; | ||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|  | @ -223,7 +223,7 @@ cammy_image *cammy_image_open_tile(const char *filename, | ||||||
|         goto error_open; |         goto error_open; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if ((image = cammy_image_new(CAMMY_IMAGE_TILE, width, height)) == NULL) { |     if ((image = cammy_image_new(CAMMY_IMAGE_2BPP_TILE, width, height)) == NULL) { | ||||||
|         goto error_image_new; |         goto error_image_new; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -421,7 +421,8 @@ void cammy_image_copy(cammy_image *dest, | ||||||
|     size_t x_offset, |     size_t x_offset, | ||||||
|            y_offset; |            y_offset; | ||||||
| 
 | 
 | ||||||
|     if (dest->format != CAMMY_IMAGE_TILE || src->format != CAMMY_IMAGE_TILE) { |     if (dest->format != CAMMY_IMAGE_2BPP_TILE | ||||||
|  |       || src->format != CAMMY_IMAGE_2BPP_TILE) { | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue