mirror of
https://github.com/koreader/koreader
synced 2024-10-31 21:20:20 +00:00
Cleanup: pass globalzoom to reflow in dc
This commit is contained in:
parent
717c2aec48
commit
f1977a470c
3
pdf.c
3
pdf.c
@ -522,9 +522,8 @@ static int reflowPage(lua_State *L) {
|
|||||||
|
|
||||||
PdfPage *page = (PdfPage*) luaL_checkudata(L, 1, "pdfpage");
|
PdfPage *page = (PdfPage*) luaL_checkudata(L, 1, "pdfpage");
|
||||||
DrawContext *dc = (DrawContext*) luaL_checkudata(L, 2, "drawcontext");
|
DrawContext *dc = (DrawContext*) luaL_checkudata(L, 2, "drawcontext");
|
||||||
double zoom = (double) luaL_checknumber(L, 3);
|
|
||||||
|
|
||||||
double dpi = 250*zoom;
|
double dpi = 250*(dc->zoom);
|
||||||
double dpp;
|
double dpp;
|
||||||
dpp = dpi / 72.;
|
dpp = dpi / 72.;
|
||||||
pix = NULL;
|
pix = NULL;
|
||||||
|
@ -87,7 +87,6 @@ function PDFReader:drawOrCache(no, preCache)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local dc = self:rfzoom(page, preCache)
|
local dc = self:rfzoom(page, preCache)
|
||||||
self.globalzoom_orig = self.globalzoom
|
|
||||||
|
|
||||||
-- offset_x_in_page & offset_y_in_page is the offset within zoomed page
|
-- offset_x_in_page & offset_y_in_page is the offset within zoomed page
|
||||||
-- they are always positive.
|
-- they are always positive.
|
||||||
@ -144,7 +143,7 @@ function PDFReader:drawOrCache(no, preCache)
|
|||||||
max_cache = max_cache - self.cache[self.pagehash].size
|
max_cache = max_cache - self.cache[self.pagehash].size
|
||||||
end
|
end
|
||||||
|
|
||||||
self.fullwidth, self.fullheight = page:reflow(dc, self.globalzoom)
|
self.fullwidth, self.fullheight = page:reflow(dc)
|
||||||
--self.fullwidth, self.fullheight = page:reflow(dc, self.globalzoom)
|
--self.fullwidth, self.fullheight = page:reflow(dc, self.globalzoom)
|
||||||
Debug("page::reflowPage:", "width:", self.fullwidth, "height:", self.fullheight)
|
Debug("page::reflowPage:", "width:", self.fullwidth, "height:", self.fullheight)
|
||||||
|
|
||||||
@ -184,7 +183,7 @@ end
|
|||||||
|
|
||||||
-- set viewer state according to zoom state
|
-- set viewer state according to zoom state
|
||||||
function PDFReader:rfzoom(page, preCache)
|
function PDFReader:rfzoom(page, preCache)
|
||||||
|
local dc = DrawContext.new()
|
||||||
self.globalzoom_mode = self.ZOOM_BY_VALUE
|
self.globalzoom_mode = self.ZOOM_BY_VALUE
|
||||||
|
|
||||||
if(self.min_offset_x > 0) then
|
if(self.min_offset_x > 0) then
|
||||||
@ -194,7 +193,9 @@ function PDFReader:rfzoom(page, preCache)
|
|||||||
self.min_offset_y = 0
|
self.min_offset_y = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
local dc = DrawContext.new()
|
dc:setZoom(self.globalzoom)
|
||||||
|
self.globalzoom_orig = self.globalzoom
|
||||||
|
|
||||||
if self.globalgamma ~= self.GAMMA_NO_GAMMA then
|
if self.globalgamma ~= self.GAMMA_NO_GAMMA then
|
||||||
Debug("gamma correction: ", self.globalgamma)
|
Debug("gamma correction: ", self.globalgamma)
|
||||||
dc:setGamma(self.globalgamma)
|
dc:setGamma(self.globalgamma)
|
||||||
|
Loading…
Reference in New Issue
Block a user