From 55fa14c07b4ca4ba4144bc1c40b77312bc57be3c Mon Sep 17 00:00:00 2001 From: CrLF0710 Date: Sun, 17 Nov 2019 23:52:26 +0800 Subject: [PATCH 1/2] Fix dpx warnings raised that was found during investigations on #195. --- dpx/src/specials/misc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dpx/src/specials/misc.rs b/dpx/src/specials/misc.rs index 995c15ac4..df4866fc1 100644 --- a/dpx/src/specials/misc.rs +++ b/dpx/src/specials/misc.rs @@ -168,7 +168,7 @@ pub unsafe extern "C" fn spc_misc_setup_handler( let key = (*args).cur; let mut keylen = 0; for &c in (*args).cur { - if (c as u8).is_ascii_alphabetic() { + if !(c as u8).is_ascii_alphabetic() { break; } keylen += 1; From 0ba4b44ac313f8636f4927bd658e07ac3527481d Mon Sep 17 00:00:00 2001 From: CrLF0710 Date: Mon, 18 Nov 2019 00:17:23 +0800 Subject: [PATCH 2/2] Fix buggy coordinate transformation. --- dpx/src/dpx_pdfdraw.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/dpx/src/dpx_pdfdraw.rs b/dpx/src/dpx_pdfdraw.rs index 7f9b42c11..ef7ea9f2b 100644 --- a/dpx/src/dpx_pdfdraw.rs +++ b/dpx/src/dpx_pdfdraw.rs @@ -333,20 +333,23 @@ impl TMatrix { impl Coord { pub fn transform(&mut self, M: &TMatrix) -> Result<(), ()> { - self.x = self.x * M.a + self.y * M.c + M.e; - self.y = self.x * M.b + self.y * M.d + M.f; + let (x, y) = (self.x, self.y); + self.x = x * M.a + y * M.c + M.e; + self.y = x * M.b + y * M.d + M.f; Ok(()) } pub fn dtransform(&mut self, M: &TMatrix) -> Result<(), ()> { - self.x = self.x * M.a + self.y * M.c; - self.y = self.x * M.b + self.y * M.d; + let (x, y) = (self.x, self.y); + self.x = x * M.a + y * M.c; + self.y = x * M.b + y * M.d; Ok(()) } fn idtransform(&mut self, M: &TMatrix) -> Result<(), ()> { let W = M.inverse()?; - self.x = self.x * W.a + self.y * W.c; - self.y = self.x * W.b + self.y * W.d; + let (x, y) = (self.x, self.y); + self.x = x * W.a + y * W.c; + self.y = x * W.b + y * W.d; Ok(()) } }