Permalink
Browse files

Switched all of jpeg to iolayer functions, removed older functions an…

…d did some

clean up.
  • Loading branch information...
1 parent ec9b9c3 commit dd55acc83c6339f654a7311912c83a83efb2fbf1 Arnar Mar Hrafnkelsson committed Jun 8, 2001
Showing with 220 additions and 596 deletions.
  1. +20 −31 Imager.pm
  2. +2 −57 Imager.xs
  3. +3 −5 image.h
  4. +1 −0 io.c
  5. +187 −499 jpeg.c
  6. +7 −4 t/t101jpeg.t
View
@@ -16,17 +16,17 @@ use Imager::Font;
DSO_close
DSO_funclist
DSO_call
-
+
load_plugin
unload_plugin
-
+
i_list_formats
i_has_format
-
+
i_color_new
i_color_set
i_color_info
-
+
i_img_empty
i_img_empty_ch
i_img_exorcise
@@ -43,7 +43,7 @@ use Imager::Font;
i_box_filled
i_arc
i_circle_aa
-
+
i_bezier_multi
i_poly_aa
@@ -53,14 +53,14 @@ use Imager::Font;
i_scale_nn
i_haar
i_count_colors
-
-
+
+
i_gaussian
i_conv
-
+
i_convert
i_map
-
+
i_img_diff
i_init_fonts
@@ -77,9 +77,6 @@ use Imager::Font;
i_tt_text
i_tt_bbox
- i_readjpeg
- i_writejpeg
-
i_readjpeg_wiol
i_writejpeg_wiol
@@ -110,19 +107,18 @@ use Imager::Font;
i_postlevels
i_mosaic
i_watermark
-
+
malloc_state
list_formats
-
+
i_gifquant
newfont
newcolor
newcolour
NC
NF
-
);
@@ -460,6 +456,9 @@ sub read {
# FIXME: Find the format here if not specified
# yes the code isn't here yet - next week maybe?
+ # Next week? Are you high or something? That comment
+ # has been there for half a year dude.
+
if (!$input{type} and $input{file}) {
$input{type}=$FORMATGUESS->($input{file});
@@ -592,20 +591,16 @@ sub read {
return undef;
}
$self->{DEBUG} && print "loading a gif file\n";
+ }
-
- } elsif ( $input{type} eq 'jpeg' ) {
- if (exists $input{data}) {
- ($self->{IMG},$self->{IPTCRAW})=i_readjpeg_scalar($input{data});
- } else {
- ($self->{IMG},$self->{IPTCRAW})=i_readjpeg( $fd );
- }
- if ( !defined($self->{IMG}) ) {
- $self->{ERRSTR}='unable to read jpeg image';
+ if ( $input{type} eq 'jpeg' ) {
+ if ( !i_writejpeg_wiol($self->{IMG}, $IO, $input{jpegquality})) {
+ $self->{ERRSTR}='unable to write jpeg image';
return undef;
}
- $self->{DEBUG} && print "loading a jpeg file\n";
+ $self->{DEBUG} && print "writing a jpeg file\n";
}
+
}
return $self;
}
@@ -741,12 +736,6 @@ sub write {
}
$self->{DEBUG} && print "writing a gif file\n";
- } elsif ( $input{type} eq 'jpeg' ) {
- $rc = i_writejpeg($self->{IMG},$fd,$input{jpegquality});
- if ( !defined($rc) ) {
- $self->{ERRSTR}='unable to write jpeg image'; return undef;
- }
- $self->{DEBUG} && print "writing a jpeg file\n";
}
}
return $self;
View
@@ -1018,66 +1018,11 @@ i_tt_bbox(handle,point,str,len)
#ifdef HAVE_LIBJPEG
undef_int
-i_writejpeg(im,fd,qfactor)
+i_writejpeg_wiol(im, ig, qfactor)
Imager::ImgRaw im
- int fd
+ Imager::IO ig
int qfactor
-void
-i_readjpeg(fd)
- int fd
- PREINIT:
- char* iptc_itext;
- int tlength;
- i_img* rimg;
- SV* r;
- PPCODE:
- iptc_itext = NULL;
- rimg=i_readjpeg(fd,&iptc_itext,&tlength);
- if (iptc_itext == NULL) {
- r = sv_newmortal();
- EXTEND(SP,1);
- sv_setref_pv(r, "Imager::ImgRaw", (void*)rimg);
- PUSHs(r);
- } else {
- r = sv_newmortal();
- EXTEND(SP,2);
- sv_setref_pv(r, "Imager::ImgRaw", (void*)rimg);
- PUSHs(r);
- PUSHs(sv_2mortal(newSVpv(iptc_itext,tlength)));
- myfree(iptc_itext);
- }
-
-
-void
-i_readjpeg_scalar(...)
- PROTOTYPE: $
- PREINIT:
- char* data;
- unsigned int length;
- char* iptc_itext;
- int tlength;
- i_img* rimg;
- SV* r;
- PPCODE:
- iptc_itext = NULL;
- data = (char *)SvPV(ST(0), length);
- rimg=i_readjpeg_scalar(data,length,&iptc_itext,&tlength);
- mm_log((1,"i_readjpeg_scalar: 0x%08X\n",rimg));
- if (iptc_itext == NULL) {
- r = sv_newmortal();
- EXTEND(SP,1);
- sv_setref_pv(r, "Imager::ImgRaw", (void*)rimg);
- PUSHs(r);
- } else {
- r = sv_newmortal();
- EXTEND(SP,2);
- sv_setref_pv(r, "Imager::ImgRaw", (void*)rimg);
- PUSHs(r);
- PUSHs(sv_2mortal(newSVpv(iptc_itext,tlength)));
- myfree(iptc_itext);
- }
-
void
i_readjpeg_wiol(ig)
View
@@ -352,11 +352,9 @@ extern i_palidx *quant_translate(i_quantize *quant, i_img *img);
extern void quant_transparent(i_quantize *quant, i_palidx *indices, i_img *img, i_palidx trans_index);
#ifdef HAVE_LIBJPEG
-i_img* i_readjpeg(int fd,char** iptc_itext,int *tlength);
-i_img* i_readjpeg_scalar(char *data, int length,char** iptc_itext,int *itlength);
-i_img* i_readjpeg_wiol(io_glue *ig, int length, char** iptc_itext, int *itlength);
-i_img* i_readjpeg_extra2(int fd,char** iptc_itext);
-undef_int i_writejpeg(i_img *im,int fd,int qfactor);
+i_img *
+i_readjpeg_wiol(io_glue *ig, int length, char** iptc_itext, int *itlength);
+undef_int i_writejpeg_wiol(i_img *im, io_glue *ig, int qfactor);
#endif /* HAVE_LIBJPEG */
#ifdef HAVE_LIBTIFF
View
1 io.c
@@ -188,6 +188,7 @@ mymalloc(int size) {
void
myfree(void *p) {
+ mm_log((1, "myfree(p %p)\n", p));
free(p);
}
Oops, something went wrong.

0 comments on commit dd55acc

Please sign in to comment.