diff options
Diffstat (limited to 'xs/src/perlglue.cpp')
-rw-r--r-- | xs/src/perlglue.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/xs/src/perlglue.cpp b/xs/src/perlglue.cpp index 5665f6c0f..9813f02d5 100644 --- a/xs/src/perlglue.cpp +++ b/xs/src/perlglue.cpp @@ -485,8 +485,8 @@ SV* to_SV_pureperl(const Point* THIS) { AV* av = newAV(); av_fill(av, 1); - av_store(av, 0, newSViv(THIS->x())); - av_store(av, 1, newSViv(THIS->y())); + av_store(av, 0, newSViv((*THIS)(0))); + av_store(av, 1, newSViv((*THIS)(1))); return newRV_noinc((SV*)av); } @@ -495,8 +495,7 @@ void from_SV(SV* point_sv, Point* point) AV* point_av = (AV*)SvRV(point_sv); // get a double from Perl and round it, otherwise // it would get truncated - point->x() = lrint(SvNV(*av_fetch(point_av, 0, 0))); - point->y() = lrint(SvNV(*av_fetch(point_av, 1, 0))); + (*point) = Point(lrint(SvNV(*av_fetch(point_av, 0, 0))), lrint(SvNV(*av_fetch(point_av, 1, 0)))); } void from_SV_check(SV* point_sv, Point* point) @@ -514,8 +513,8 @@ SV* to_SV_pureperl(const Pointf* point) { AV* av = newAV(); av_fill(av, 1); - av_store(av, 0, newSVnv(point->x())); - av_store(av, 1, newSVnv(point->y())); + av_store(av, 0, newSVnv((*point)(0))); + av_store(av, 1, newSVnv((*point)(1))); return newRV_noinc((SV*)av); } @@ -526,8 +525,7 @@ bool from_SV(SV* point_sv, Pointf* point) SV* sv_y = *av_fetch(point_av, 1, 0); if (!looks_like_number(sv_x) || !looks_like_number(sv_y)) return false; - point->x() = SvNV(sv_x); - point->y() = SvNV(sv_y); + *point = Pointf(SvNV(sv_x), SvNV(sv_y)); return true; } |