2
0
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:
chrox 2012-10-18 01:10:26 +08:00
parent 717c2aec48
commit f1977a470c
2 changed files with 6 additions and 6 deletions

3
pdf.c
View File

@ -522,9 +522,8 @@ static int reflowPage(lua_State *L) {
PdfPage *page = (PdfPage*) luaL_checkudata(L, 1, "pdfpage");
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;
dpp = dpi / 72.;
pix = NULL;

View File

@ -87,7 +87,6 @@ function PDFReader:drawOrCache(no, preCache)
end
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
-- they are always positive.
@ -144,7 +143,7 @@ function PDFReader:drawOrCache(no, preCache)
max_cache = max_cache - self.cache[self.pagehash].size
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)
Debug("page::reflowPage:", "width:", self.fullwidth, "height:", self.fullheight)
@ -184,7 +183,7 @@ end
-- set viewer state according to zoom state
function PDFReader:rfzoom(page, preCache)
local dc = DrawContext.new()
self.globalzoom_mode = self.ZOOM_BY_VALUE
if(self.min_offset_x > 0) then
@ -194,7 +193,9 @@ function PDFReader:rfzoom(page, preCache)
self.min_offset_y = 0
end
local dc = DrawContext.new()
dc:setZoom(self.globalzoom)
self.globalzoom_orig = self.globalzoom
if self.globalgamma ~= self.GAMMA_NO_GAMMA then
Debug("gamma correction: ", self.globalgamma)
dc:setGamma(self.globalgamma)