Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: bmp.c

Issue 8720003: Update libjpeg-turbo to r722. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libjpeg_turbo/
Patch Set: '' Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « README.chromium ('k') | google.patch » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C)2011 D. R. Commander. All Rights Reserved. 2 * Copyright (C)2011 D. R. Commander. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met: 5 * modification, are permitted provided that the following conditions are met:
6 * 6 *
7 * - Redistributions of source code must retain the above copyright notice, 7 * - Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer. 8 * this list of conditions and the following disclaimer.
9 * - Redistributions in binary form must reproduce the above copyright notice, 9 * - Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation 10 * this list of conditions and the following disclaimer in the documentation
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 int loadbmp(char *filename, unsigned char **buf, int *w, int *h, 101 int loadbmp(char *filename, unsigned char **buf, int *w, int *h,
102 int dstpf, int bottomup) 102 int dstpf, int bottomup)
103 { 103 {
104 int retval=0, dstps, srcpf, tempc; 104 int retval=0, dstps, srcpf, tempc;
105 struct jpeg_compress_struct cinfo; 105 struct jpeg_compress_struct cinfo;
106 struct my_error_mgr jerr; 106 struct my_error_mgr jerr;
107 cjpeg_source_ptr src; 107 cjpeg_source_ptr src;
108 FILE *file=NULL; 108 FILE *file=NULL;
109 109
110 memset(&cinfo, 0, sizeof(struct jpeg_compress_struct));
111
110 if(!filename || !buf || !w || !h || dstpf<0 || dstpf>=TJ_NUMPF) 112 if(!filename || !buf || !w || !h || dstpf<0 || dstpf>=TJ_NUMPF)
111 _throw("loadbmp(): Invalid argument"); 113 _throw("loadbmp(): Invalid argument");
112 114
113 if((file=fopen(filename, "rb"))==NULL) 115 if((file=fopen(filename, "rb"))==NULL)
114 _throwunix("loadbmp(): Cannot open input file"); 116 _throwunix("loadbmp(): Cannot open input file");
115 117
116 cinfo.err=jpeg_std_error(&jerr.pub); 118 cinfo.err=jpeg_std_error(&jerr.pub);
117 jerr.pub.error_exit=my_error_exit; 119 jerr.pub.error_exit=my_error_exit;
118 jerr.pub.output_message=my_output_message; 120 jerr.pub.output_message=my_output_message;
119 121
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 int savebmp(char *filename, unsigned char *buf, int w, int h, int srcpf, 184 int savebmp(char *filename, unsigned char *buf, int w, int h, int srcpf,
183 int bottomup) 185 int bottomup)
184 { 186 {
185 int retval=0, srcps, dstpf; 187 int retval=0, srcps, dstpf;
186 struct jpeg_decompress_struct dinfo; 188 struct jpeg_decompress_struct dinfo;
187 struct my_error_mgr jerr; 189 struct my_error_mgr jerr;
188 djpeg_dest_ptr dst; 190 djpeg_dest_ptr dst;
189 FILE *file=NULL; 191 FILE *file=NULL;
190 char *ptr=NULL; 192 char *ptr=NULL;
191 193
194 memset(&dinfo, 0, sizeof(struct jpeg_decompress_struct));
195
192 if(!filename || !buf || w<1 || h<1 || srcpf<0 || srcpf>=TJ_NUMPF) 196 if(!filename || !buf || w<1 || h<1 || srcpf<0 || srcpf>=TJ_NUMPF)
193 _throw("savebmp(): Invalid argument"); 197 _throw("savebmp(): Invalid argument");
194 198
195 if((file=fopen(filename, "wb"))==NULL) 199 if((file=fopen(filename, "wb"))==NULL)
196 _throwunix("savebmp(): Cannot open output file"); 200 _throwunix("savebmp(): Cannot open output file");
197 201
198 dinfo.err=jpeg_std_error(&jerr.pub); 202 dinfo.err=jpeg_std_error(&jerr.pub);
199 jerr.pub.error_exit=my_error_exit; 203 jerr.pub.error_exit=my_error_exit;
200 jerr.pub.output_message=my_output_message; 204 jerr.pub.output_message=my_output_message;
201 205
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 bailout: 265 bailout:
262 jpeg_destroy_decompress(&dinfo); 266 jpeg_destroy_decompress(&dinfo);
263 if(file) fclose(file); 267 if(file) fclose(file);
264 return retval; 268 return retval;
265 } 269 }
266 270
267 const char *bmpgeterr(void) 271 const char *bmpgeterr(void)
268 { 272 {
269 return errStr; 273 return errStr;
270 } 274 }
OLDNEW
« no previous file with comments | « README.chromium ('k') | google.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698