Skip to content

Commit

Permalink
fix segmentation fault when transforming from reflow to native in bla…
Browse files Browse the repository at this point in the history
…nk page
  • Loading branch information
chrox committed Jan 23, 2014
1 parent 75d7e00 commit 1bcc960
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ffi/koptcontext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@ function KOPTContext_mt.__index:reflowToNativePosTransform(xc, yc, wr, hr)
m = i
end
end
local rectmap = self.rectmaps.wrectmap + m
local x = rectmap.coords[0].x*self.dev_dpi*self.quality/rectmap.srcdpiw
local y = rectmap.coords[0].y*self.dev_dpi*self.quality/rectmap.srcdpih
local w = rectmap.coords[2].x*self.dev_dpi*self.quality/rectmap.srcdpiw
local h = rectmap.coords[2].y*self.dev_dpi*self.quality/rectmap.srcdpih
return (x+w*wr)/self.zoom+self.bbox.x0, (y+h*hr)/self.zoom+self.bbox.y0
if self.rectmaps.n > m then
local rectmap = self.rectmaps.wrectmap + m
local x = rectmap.coords[0].x*self.dev_dpi*self.quality/rectmap.srcdpiw
local y = rectmap.coords[0].y*self.dev_dpi*self.quality/rectmap.srcdpih
local w = rectmap.coords[2].x*self.dev_dpi*self.quality/rectmap.srcdpiw
local h = rectmap.coords[2].y*self.dev_dpi*self.quality/rectmap.srcdpih
return (x+w*wr)/self.zoom+self.bbox.x0, (y+h*hr)/self.zoom+self.bbox.y0
end
end

function KOPTContext_mt.__index:nativeToReflowPosTransform(xc, yc)
Expand Down

0 comments on commit 1bcc960

Please sign in to comment.