Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 5 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 18, 2013
Tony Cook skip t/x30podlinkcheck.t if Pod::Parser 1.50 not available 17dbbf9
Tony Cook handle older perls for the new perlio integration 84700c4
Tony Cook [rt #83212] avoid a possible bad optimizer on centos 5.9
rotate(degrees => 270) was producing glitches near the horizontal and
vertical centrelines only on 5.9 with the default (perl config
specified) optimizations.  These disappeared when Imager was built with
-O1 instead.

Re-arranged some code to avoid duplicate floor() and double -> long
conversions which seems to have avoided the optimization problem.
1e9de31
@tonycoz change note for the rotate change 41125e7
@tonycoz avoid a probably unwarranted compiler warning d701a5e
View
3  Changes
@@ -18,6 +18,9 @@ Imager release history. Older releases can be found in Changes.old
- the JPEG test code now reports the compile-time library version
+ - avoid a possible compiler optimization issue on CentOS 5.9 i386 by
+ rearranging (and mildly optimizing) some code.
+
Imager 0.94 - 15 Dec 2012
=========================
View
3  iolayer.c
@@ -1187,6 +1187,9 @@ i_io_read_fill(io_glue *ig, ssize_t needed) {
work = ig->buffer;
}
+ /* there should always be buffer space the first time around, but
+ avoid a compiler warning here */
+ rc = -1;
while (work < buf_end && (rc = i_io_raw_read(ig, work, buf_end - work)) > 0) {
work += rc;
good = 1;
View
20 perlio.c
@@ -18,12 +18,16 @@ static int
perlio_closer(void *handle);
static void
perlio_destroy(void *handle);
-static const char *my_strerror(int err);
+static const char *my_strerror(pTHX_ int err);
+
+#ifndef tTHX
+#define tTHX PerlInterpreter *
+#endif
typedef struct {
PerlIO *handle;
pIMCTX;
-#ifdef USE_PERLIO
+#ifdef MULTIPLICITY
tTHX my_perl;
#endif
} im_perlio;
@@ -47,7 +51,7 @@ im_io_new_perlio(pTHX_ PerlIO *handle) {
dIMCTX;
state->handle = handle;
-#ifdef USE_PERLIO
+#ifdef MULTIPLICITY
state->aTHX = aTHX;
#endif
state->aIMCTX = aIMCTX;
@@ -64,7 +68,7 @@ perlio_reader(void *ctx, void *buf, size_t count) {
ssize_t result = PerlIO_read(state->handle, buf, count);
if (result == 0 && PerlIO_error(state->handle)) {
- im_push_errorf(aIMCTX, errno, "read() failure (%s)", my_strerror(errno));
+ im_push_errorf(aIMCTX, errno, "read() failure (%s)", my_strerror(aTHX_ errno));
return -1;
}
@@ -81,7 +85,7 @@ perlio_writer(void *ctx, const void *buf, size_t count) {
result = PerlIO_write(state->handle, buf, count);
if (result == 0) {
- im_push_errorf(aIMCTX, errno, "write() failure (%s)", my_strerror(errno));
+ im_push_errorf(aIMCTX, errno, "write() failure (%s)", my_strerror(aTHX_ errno));
}
return result;
@@ -95,7 +99,7 @@ perlio_seeker(void *ctx, off_t offset, int whence) {
if (whence != SEEK_CUR || offset != 0) {
if (PerlIO_seek(state->handle, offset, whence) < 0) {
- im_push_errorf(aIMCTX, errno, "seek() failure (%s)", my_strerror(errno));
+ im_push_errorf(aIMCTX, errno, "seek() failure (%s)", my_strerror(aTHX_ errno));
return -1;
}
}
@@ -110,7 +114,7 @@ perlio_closer(void *ctx) {
dIMCTXperlio(state);
if (PerlIO_flush(state->handle) < 0) {
- im_push_errorf(aIMCTX, errno, "flush() failure (%s)", my_strerror(errno));
+ im_push_errorf(aIMCTX, errno, "flush() failure (%s)", my_strerror(aTHX_ errno));
return -1;
}
return 0;
@@ -122,7 +126,7 @@ perlio_destroy(void *ctx) {
}
static
-const char *my_strerror(int err) {
+const char *my_strerror(pTHX_ int err) {
const char *result = strerror(err);
if (!result)
View
16 rotate.im
@@ -252,16 +252,18 @@ i_img *i_matrix_transform_bg(i_img *src, i_img_dim xsize, i_img_dim ysize, const
if (fabs(sz) > 0.0000001
&& sx >= -1 && sx < src->xsize
&& sy >= -1 && sy < src->ysize) {
+ i_img_dim bx = floor(sx);
+ i_img_dim by = floor(sy);
ROT_DEBUG(fprintf(stderr, "map " i_DFp " to %g,%g\n", i_DFcp(x, y), sx, sy));
- if (sx != (i_img_dim)sx) {
- if (sy != (i_img_dim)sy) {
+ if (sx != bx) {
+ if (sy != by) {
IM_COLOR c[2][2];
IM_COLOR ci2[2];
ROT_DEBUG(fprintf(stderr, " both non-int\n"));
for (i = 0; i < 2; ++i)
for (j = 0; j < 2; ++j)
- if (IM_GPIX(src, floor(sx)+i, floor(sy)+j, &c[j][i]))
+ if (IM_GPIX(src, bx+i, by+j, &c[j][i]))
c[j][i] = back;
for (j = 0; j < 2; ++j)
ci2[j] = interp_i_color(c[j][0], c[j][1], sx, src->channels);
@@ -271,7 +273,7 @@ i_img *i_matrix_transform_bg(i_img *src, i_img_dim xsize, i_img_dim ysize, const
IM_COLOR ci2[2];
ROT_DEBUG(fprintf(stderr, " y int, x non-int\n"));
for (i = 0; i < 2; ++i)
- if (IM_GPIX(src, floor(sx)+i, sy, ci2+i))
+ if (IM_GPIX(src, bx+i, sy, ci2+i))
ci2[i] = back;
vals[x] = interp_i_color(ci2[0], ci2[1], sx, src->channels);
}
@@ -281,7 +283,7 @@ i_img *i_matrix_transform_bg(i_img *src, i_img_dim xsize, i_img_dim ysize, const
IM_COLOR ci2[2];
ROT_DEBUG(fprintf(stderr, " x int, y non-int\n"));
for (i = 0; i < 2; ++i)
- if (IM_GPIX(src, sx, floor(sy)+i, ci2+i))
+ if (IM_GPIX(src, bx, by+i, ci2+i))
ci2[i] = back;
vals[x] = interp_i_color(ci2[0], ci2[1], sy, src->channels);
}
@@ -402,7 +404,7 @@ i_matrix_mult(double *dest, const double *left, const double *right) {
#define numfmt "%23g"
-ROT_DEBUG(static dump_mat(const char *name, double *f) {
+ROT_DEBUG(static void dump_mat(const char *name, double *f) {
fprintf(stderr, "%s:\n " numfmt " " numfmt " " numfmt "\n"
" " numfmt " " numfmt " " numfmt "\n"
" " numfmt " " numfmt " " numfmt "\n",
@@ -417,6 +419,8 @@ i_img *i_rotate_exact_bg(i_img *src, double amount,
double temp[9], matrix[9];
i_img_dim x1, x2, y1, y2, newxsize, newysize;
+ ROT_DEBUG(fprintf(stderr, "rotate angle %.20g\n", amount));
+
/* first translate the centre of the image to (0,0) */
xlate1[0] = 1;
xlate1[2] = (src->xsize-1)/2.0;
View
2  t/t64copyflip.t
@@ -269,7 +269,7 @@ sub rot_test {
is($deg->getwidth, 150, "check degrees => 270 width");
is($deg->getheight, 150, "check degrees => 270 height");
ok($deg->write(file => "testout/t64rotdeg270.ppm"), "save it");
- # deg->write(file => "testout/t64rotright270.ppm");
+ $right->write(file => "testout/t64rotright270.ppm");
is_image($deg, $right, "check right and degrees result the same");
#$deg = $deg->convert(preset => "addalpha");
# $right = $right->convert(preset => "addalpha");
View
5 t/x30podlinkcheck.t
@@ -1,7 +1,10 @@
#!perl -w
use strict;
use Test::More;
-use Pod::Parser 1.50;
+BEGIN {
+ eval 'use Pod::Parser 1.50;';
+ plan skip_all => "Pod::Parser 1.50 required for podlinkcheck" if $@;
+}
use File::Find;
use File::Spec::Functions qw(rel2abs abs2rel splitdir);

No commit comments for this range

Something went wrong with that request. Please try again.