Skip to content

Added mupdf.scaleBlitBuffer() for better scaling#519

Merged
Frenzie merged 2 commits intokoreader:masterfrom
poire-z:muscaling2
Sep 25, 2017
Merged

Added mupdf.scaleBlitBuffer() for better scaling#519
Frenzie merged 2 commits intokoreader:masterfrom
poire-z:muscaling2

Conversation

@poire-z
Copy link
Copy Markdown
Contributor

@poire-z poire-z commented Sep 25, 2017

We get better quality scaling with MuPDF than our internal BlitBuffer:scale(), so we'll use it instead in ImageWidget.

We get better quality scaling with MuPDF than our internal
BlitBuffer:scale(), so we'll use it instead in ImageWidget.
@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Sep 25, 2017

Looks good to me.

ffi/mupdf.lua Outdated
converted_bb = BlitBuffer.new(orig_w, orig_h, BlitBuffer.TYPE_BBRGB32)
converted_bb:blitFrom(bb, 0, 0, 0, 0, orig_w, orig_h)
bb = converted_bb -- we don't free() the provided bb, but we'll have to free our converted_bb
bbtype = bb:getType()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ffi/mupdf.lua:700:9: value assigned to variable 'bbtype' is unused

ffi/mupdf.lua Outdated
local p_width = M.fz_pixmap_width(context(), scaled_pixmap)
local p_height = M.fz_pixmap_height(context(), scaled_pixmap)
-- And convert the pixmap back to a BlitBuffer
local bbtype
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean bbtype = nil?

ffi/mupdf.lua:718:11: variable 'bbtype' was previously defined on line 682

ffi/mupdf.lua Outdated
error("unsupported number of color components")
end
local p = M.fz_pixmap_samples(context(), scaled_pixmap)
local bb = BlitBuffer.new(p_width, p_height, bbtype, p):copy()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ffi/mupdf.lua:727:11: variable 'bb' was previously defined as an argument on line 679

@Frenzie Frenzie merged commit 3b2acc9 into koreader:master Sep 25, 2017
@Frenzie
Copy link
Copy Markdown
Member

Frenzie commented Sep 25, 2017

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants