Initial commit (#1867423).
This commit is contained in:
parent
c6890f1692
commit
96cf239e7a
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/ragg_0.3.1.tar.gz
|
@ -0,0 +1,48 @@
|
||||
From 3fe3b45dd22b97525caa22678f8927d0ddf352ca Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Tue, 4 Aug 2020 05:54:38 -0400
|
||||
Subject: [PATCH 1/2] Byte swap `agg_capture` output on big-endian systems.
|
||||
|
||||
R expects colours to be integers of ABGR, which on little-endian
|
||||
machines maps to singular bytes in RGBA order, but maps to ABGR order on
|
||||
bit-endian machines.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
src/AggDeviceCapture.h | 4 +++-
|
||||
src/ragg.h | 2 ++
|
||||
2 files changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/AggDeviceCapture.h b/src/AggDeviceCapture.h
|
||||
index 02f76a4..86f7cc4 100644
|
||||
--- a/src/AggDeviceCapture.h
|
||||
+++ b/src/AggDeviceCapture.h
|
||||
@@ -21,7 +21,9 @@ public:
|
||||
}
|
||||
SEXP capture() {
|
||||
SEXP raster = PROTECT(Rf_allocVector(INTSXP, this->width * this->height));
|
||||
- memcpy(INTEGER(raster), this->buffer, this->width * this->height * 4);
|
||||
+ agg::rendering_buffer caprbuf(reinterpret_cast<agg::int8u*>(INTEGER(raster)),
|
||||
+ this->width, this->height, this->width * 4);
|
||||
+ agg::convert<pixfmt_r_capture, pixfmt_type_32>(&caprbuf, &this->rbuf);
|
||||
SEXP dims = PROTECT(Rf_allocVector(INTSXP, 2));
|
||||
INTEGER(dims)[0] = this->height;
|
||||
INTEGER(dims)[1] = this->width;
|
||||
diff --git a/src/ragg.h b/src/ragg.h
|
||||
index 7a66d8b..0fca0a5 100644
|
||||
--- a/src/ragg.h
|
||||
+++ b/src/ragg.h
|
||||
@@ -36,8 +36,10 @@ typedef agg::pixfmt_rgba64_pre pixfmt_type_64;
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
typedef agg::pixfmt_abgr32_plain pixfmt_r_raster;
|
||||
+typedef agg::pixfmt_abgr32_pre pixfmt_r_capture;
|
||||
#else
|
||||
typedef agg::pixfmt_rgba32_plain pixfmt_r_raster;
|
||||
+typedef agg::pixfmt_rgba32_pre pixfmt_r_capture;
|
||||
#endif
|
||||
|
||||
// pixfmt agnosting demultiplying
|
||||
--
|
||||
2.25.4
|
||||
|
30
0002-Use-WORDS_BIGENDIAN-from-Rconfig.h.patch
Normal file
30
0002-Use-WORDS_BIGENDIAN-from-Rconfig.h.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From fb0633028f569dd91ab949794c0a3af0ef0686ca Mon Sep 17 00:00:00 2001
|
||||
From: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
Date: Wed, 5 Aug 2020 05:43:22 -0400
|
||||
Subject: [PATCH 2/2] Use WORDS_BIGENDIAN from Rconfig.h.
|
||||
|
||||
This seems to actually work, as __BIG_ENDIAN__ isn't defined on s390x.
|
||||
Possibly it needs another header, but it's easier to use a macro already
|
||||
in R.
|
||||
|
||||
Signed-off-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
|
||||
---
|
||||
src/ragg.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/ragg.h b/src/ragg.h
|
||||
index 0fca0a5..cd08ebb 100644
|
||||
--- a/src/ragg.h
|
||||
+++ b/src/ragg.h
|
||||
@@ -34,7 +34,7 @@ typedef agg::pixfmt_rgba32_pre pixfmt_type_32;
|
||||
typedef agg::pixfmt_rgb48_pre pixfmt_type_48;
|
||||
typedef agg::pixfmt_rgba64_pre pixfmt_type_64;
|
||||
|
||||
-#ifdef __BIG_ENDIAN__
|
||||
+#ifdef WORDS_BIGENDIAN
|
||||
typedef agg::pixfmt_abgr32_plain pixfmt_r_raster;
|
||||
typedef agg::pixfmt_abgr32_pre pixfmt_r_capture;
|
||||
#else
|
||||
--
|
||||
2.25.4
|
||||
|
87
R-ragg.spec
Normal file
87
R-ragg.spec
Normal file
@ -0,0 +1,87 @@
|
||||
%global packname ragg
|
||||
%global packver 0.3.1
|
||||
%global rlibdir %{_libdir}/R/library
|
||||
|
||||
Name: R-%{packname}
|
||||
Version: 0.3.1
|
||||
Release: 1%{?dist}
|
||||
Summary: Graphic Devices Based on AGG
|
||||
|
||||
License: MIT
|
||||
URL: https://CRAN.R-project.org/package=%{packname}
|
||||
Source0: https://cran.r-project.org/src/contrib/%{packname}_%{packver}.tar.gz
|
||||
# https://github.com/r-lib/ragg/pull/49
|
||||
Patch0001: 0001-Byte-swap-agg_capture-output-on-big-endian-systems.patch
|
||||
Patch0002: 0002-Use-WORDS_BIGENDIAN-from-Rconfig.h.patch
|
||||
|
||||
# Here's the R view of the dependencies world:
|
||||
# Depends:
|
||||
# Imports: R-systemfonts >= 0.2.1
|
||||
# Suggests: R-covr, R-testthat, R-grid, R-graphics
|
||||
# LinkingTo:
|
||||
# Enhances:
|
||||
|
||||
BuildRequires: R-devel
|
||||
BuildRequires: tex(latex)
|
||||
BuildRequires: R-systemfonts-devel >= 0.2.1
|
||||
BuildRequires: R-testthat
|
||||
BuildRequires: R-grid
|
||||
BuildRequires: R-graphics
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: pkgconfig(freetype2)
|
||||
BuildRequires: pkgconfig(libpng)
|
||||
BuildRequires: pkgconfig(libtiff-4)
|
||||
BuildRequires: libjpeg-devel
|
||||
|
||||
%description
|
||||
Anti-Grain Geometry (AGG) is a high-quality and high-performance 2D drawing
|
||||
library. The 'ragg' package provides a set of graphic devices based on AGG to
|
||||
use as alternative to the raster devices provided through the 'grDevices'
|
||||
package.
|
||||
|
||||
|
||||
%prep
|
||||
%setup -q -c -n %{packname}
|
||||
|
||||
pushd %{packname}
|
||||
%patch0001 -p1
|
||||
%patch0002 -p1
|
||||
|
||||
# Don't need coverage; it's not packaged either.
|
||||
sed -i 's/covr, //g' DESCRIPTION
|
||||
popd
|
||||
|
||||
|
||||
%build
|
||||
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}%{rlibdir}
|
||||
%{_bindir}/R CMD INSTALL -l %{buildroot}%{rlibdir} %{packname}
|
||||
test -d %{packname}/src && (cd %{packname}/src; rm -f *.o *.so)
|
||||
rm -f %{buildroot}%{rlibdir}/R.css
|
||||
|
||||
|
||||
%check
|
||||
%{_bindir}/R CMD check %{packname} || (cat %{packname}.Rcheck/tests/testthat.Rout.fail && exit 1)
|
||||
|
||||
|
||||
%files
|
||||
%dir %{rlibdir}/%{packname}
|
||||
%doc %{rlibdir}/%{packname}/html
|
||||
%{rlibdir}/%{packname}/DESCRIPTION
|
||||
%doc %{rlibdir}/%{packname}/NEWS.md
|
||||
%license %{rlibdir}/%{packname}/LICENSE
|
||||
%{rlibdir}/%{packname}/INDEX
|
||||
%{rlibdir}/%{packname}/NAMESPACE
|
||||
%{rlibdir}/%{packname}/Meta
|
||||
%{rlibdir}/%{packname}/R
|
||||
%{rlibdir}/%{packname}/help
|
||||
%dir %{rlibdir}/%{packname}/libs
|
||||
%{rlibdir}/%{packname}/libs/%{packname}.so
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Aug 03 2020 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 0.3.1-1
|
||||
- initial package for Fedora
|
Loading…
Reference in New Issue
Block a user