소스 검색

Actaully disable that warning, fix a bug

Creating a paletted image along with other images broke it
tags/v1.8.0
Xerbo 4 년 전
부모
커밋
d37f450229
2개의 변경된 파일11개의 추가작업 그리고 13개의 파일을 삭제
  1. +1
    -1
      Makefile
  2. +10
    -12
      pngio.c

+ 1
- 1
Makefile 파일 보기

@@ -1,7 +1,7 @@
CC = gcc
BIN = /usr/bin
INCLUDES = -I.
CFLAGS = -O3 -g -Wall -Wextra $(INCLUDES)
CFLAGS = -O3 -g -Wall -Wextra -Wno-missing-field-initializers $(INCLUDES)
OBJS = main.o image.o dsp.o filter.o reg.o pngio.o median.o color.o

aptdec: $(OBJS)


+ 10
- 12
pngio.c 파일 보기

@@ -277,8 +277,8 @@ int applyUserPalette(float **prow, int nrow, char *filename, rgb_t **crow){
for(int y = 0; y < nrow; y++){
for(int x = 0; x < CH_WIDTH; x++){
int cha = prow[y][x + CHA_OFFSET];
int cbb = prow[y][x + CHB_OFFSET];
crow[y][x + CHA_OFFSET] = pal_row[cbb][cha];
int chb = prow[y][x + CHB_OFFSET];
crow[y][x + CHA_OFFSET] = pal_row[chb][cha];
}
}
@@ -293,7 +293,6 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c
sprintf(outName, "%s/%s", opts->path, opts->filename);
}

#pragma GCC diagnostic ignored "-Wunused-result"
png_text meta[] = {
{PNG_TEXT_COMPRESSION_NONE, "Software", VERSION},
{PNG_TEXT_COMPRESSION_NONE, "Channel", desc, sizeof(desc)},
@@ -340,8 +339,8 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c
}
if(opts->map != NULL && opts->map[0] != '\0'){
greyscale = 0;
}
greyscale = 0;
}

FILE *pngfile;

@@ -384,15 +383,15 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c
png_write_info(png_ptr, info_ptr);

// Move prow into crow, crow ~ color rows, if required
rgb_t *crow[img->nrow];
if(!greyscale){
prow2crow(img->prow, img->nrow, palette, crow);
}
rgb_t *crow[MAX_HEIGHT];
if(!greyscale){
prow2crow(img->prow, img->nrow, palette, crow);
}
// Apply a user provided color palette
if(CONTAINS(opts->type, Palleted)){
applyUserPalette(img->prow, img->nrow, opts->palette, crow);
}
}

// Precipitation overlay
if(CONTAINS(opts->effects, Precipitation_Overlay)){
@@ -417,7 +416,6 @@ int ImageOut(options_t *opts, image_t *img, int offset, int width, char *desc, c

printf("Writing %s", outName);

// Float power macro (for gamma adjustment)
#define POWF(a, b) (b == 1.0 ? a : exp(b * log(a)))
float a = POWF(255, opts->gamma)/255;


불러오는 중...
취소
저장