mirror of
				https://github.com/webmproject/libwebp.git
				synced 2025-10-31 02:15:42 +01:00 
			
		
		
		
	cosmetics: normalize fn proto & decl param names
BUG=webp:355 Change-Id: If020eb3b064cdb11853d1fa47058acae34752ce3
This commit is contained in:
		| @@ -542,22 +542,24 @@ int WebPWriteYUV(FILE* fout, const WebPDecBuffer* const buffer) { | ||||
| // Generic top-level call | ||||
|  | ||||
| int WebPSaveImage(const WebPDecBuffer* const buffer, | ||||
|                   WebPOutputFileFormat format, const char* const out_file) { | ||||
|                   WebPOutputFileFormat format, | ||||
|                   const char* const out_file_name) { | ||||
|   FILE* fout = NULL; | ||||
|   int needs_open_file = 1; | ||||
|   const int use_stdout = (out_file != NULL) && !strcmp(out_file, "-"); | ||||
|   const int use_stdout = (out_file_name != NULL) && !strcmp(out_file_name, "-"); | ||||
|   int ok = 1; | ||||
|  | ||||
|   if (buffer == NULL || out_file == NULL) return 0; | ||||
|   if (buffer == NULL || out_file_name == NULL) return 0; | ||||
|  | ||||
| #ifdef HAVE_WINCODEC_H | ||||
|   needs_open_file = (format != PNG); | ||||
| #endif | ||||
|  | ||||
|   if (needs_open_file) { | ||||
|     fout = use_stdout ? ImgIoUtilSetBinaryMode(stdout) : fopen(out_file, "wb"); | ||||
|     fout = use_stdout ? ImgIoUtilSetBinaryMode(stdout) | ||||
|                       : fopen(out_file_name, "wb"); | ||||
|     if (fout == NULL) { | ||||
|       fprintf(stderr, "Error opening output file %s\n", out_file); | ||||
|       fprintf(stderr, "Error opening output file %s\n", out_file_name); | ||||
|       return 0; | ||||
|     } | ||||
|   } | ||||
| @@ -566,7 +568,7 @@ int WebPSaveImage(const WebPDecBuffer* const buffer, | ||||
|       format == RGBA || format == BGRA || format == ARGB || | ||||
|       format == rgbA || format == bgrA || format == Argb) { | ||||
| #ifdef HAVE_WINCODEC_H | ||||
|     ok &= WebPWritePNG(out_file, use_stdout, buffer); | ||||
|     ok &= WebPWritePNG(out_file_name, use_stdout, buffer); | ||||
| #else | ||||
|     ok &= WebPWritePNG(fout, buffer); | ||||
| #endif | ||||
|   | ||||
| @@ -169,11 +169,11 @@ VP8StatusCode WebPFlipBuffer(WebPDecBuffer* const buffer) { | ||||
|   return VP8_STATUS_OK; | ||||
| } | ||||
|  | ||||
| VP8StatusCode WebPAllocateDecBuffer(int w, int h, | ||||
| VP8StatusCode WebPAllocateDecBuffer(int width, int height, | ||||
|                                     const WebPDecoderOptions* const options, | ||||
|                                     WebPDecBuffer* const out) { | ||||
|                                     WebPDecBuffer* const buffer) { | ||||
|   VP8StatusCode status; | ||||
|   if (out == NULL || w <= 0 || h <= 0) { | ||||
|   if (buffer == NULL || width <= 0 || height <= 0) { | ||||
|     return VP8_STATUS_INVALID_PARAM; | ||||
|   } | ||||
|   if (options != NULL) {    // First, apply options if there is any. | ||||
| @@ -182,33 +182,34 @@ VP8StatusCode WebPAllocateDecBuffer(int w, int h, | ||||
|       const int ch = options->crop_height; | ||||
|       const int x = options->crop_left & ~1; | ||||
|       const int y = options->crop_top & ~1; | ||||
|       if (x < 0 || y < 0 || cw <= 0 || ch <= 0 || x + cw > w || y + ch > h) { | ||||
|       if (x < 0 || y < 0 || cw <= 0 || ch <= 0 || | ||||
|           x + cw > width || y + ch > height) { | ||||
|         return VP8_STATUS_INVALID_PARAM;   // out of frame boundary. | ||||
|       } | ||||
|       w = cw; | ||||
|       h = ch; | ||||
|       width = cw; | ||||
|       height = ch; | ||||
|     } | ||||
|     if (options->use_scaling) { | ||||
|       int scaled_width = options->scaled_width; | ||||
|       int scaled_height = options->scaled_height; | ||||
|       if (!WebPRescalerGetScaledDimensions( | ||||
|               w, h, &scaled_width, &scaled_height)) { | ||||
|               width, height, &scaled_width, &scaled_height)) { | ||||
|         return VP8_STATUS_INVALID_PARAM; | ||||
|       } | ||||
|       w = scaled_width; | ||||
|       h = scaled_height; | ||||
|       width = scaled_width; | ||||
|       height = scaled_height; | ||||
|     } | ||||
|   } | ||||
|   out->width = w; | ||||
|   out->height = h; | ||||
|   buffer->width = width; | ||||
|   buffer->height = height; | ||||
|  | ||||
|   // Then, allocate buffer for real. | ||||
|   status = AllocateBuffer(out); | ||||
|   status = AllocateBuffer(buffer); | ||||
|   if (status != VP8_STATUS_OK) return status; | ||||
|  | ||||
|   // Use the stride trick if vertical flip is needed. | ||||
|   if (options != NULL && options->flip) { | ||||
|     status = WebPFlipBuffer(out); | ||||
|     status = WebPFlipBuffer(buffer); | ||||
|   } | ||||
|   return status; | ||||
| } | ||||
|   | ||||
| @@ -673,12 +673,12 @@ void WebPIDelete(WebPIDecoder* idec) { | ||||
| //------------------------------------------------------------------------------ | ||||
| // Wrapper toward WebPINewDecoder | ||||
|  | ||||
| WebPIDecoder* WebPINewRGB(WEBP_CSP_MODE mode, uint8_t* output_buffer, | ||||
| WebPIDecoder* WebPINewRGB(WEBP_CSP_MODE csp, uint8_t* output_buffer, | ||||
|                           size_t output_buffer_size, int output_stride) { | ||||
|   const int is_external_memory = (output_buffer != NULL) ? 1 : 0; | ||||
|   WebPIDecoder* idec; | ||||
|  | ||||
|   if (mode >= MODE_YUV) return NULL; | ||||
|   if (csp >= MODE_YUV) return NULL; | ||||
|   if (is_external_memory == 0) {    // Overwrite parameters to sane values. | ||||
|     output_buffer_size = 0; | ||||
|     output_stride = 0; | ||||
| @@ -689,7 +689,7 @@ WebPIDecoder* WebPINewRGB(WEBP_CSP_MODE mode, uint8_t* output_buffer, | ||||
|   } | ||||
|   idec = WebPINewDecoder(NULL); | ||||
|   if (idec == NULL) return NULL; | ||||
|   idec->output_.colorspace = mode; | ||||
|   idec->output_.colorspace = csp; | ||||
|   idec->output_.is_external_memory = is_external_memory; | ||||
|   idec->output_.u.RGBA.rgba = output_buffer; | ||||
|   idec->output_.u.RGBA.stride = output_stride; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user