mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
KOptInterface: Keep returning nil in get*Boxes when we don't actually
get any boxes Exposed by #7624, but we were arguably putting garbage in the Cache before that anyway, so, it w<asn't all that great either ;p. Fix #7850
This commit is contained in:
@@ -516,6 +516,9 @@ function KoptInterface:getReflowedTextBoxes(doc, pageno)
|
||||
--kc:setDebug()
|
||||
local fullwidth, fullheight = kc:getPageDim()
|
||||
local boxes, nr_word = kc:getReflowedWordBoxes("dst", 0, 0, fullwidth, fullheight)
|
||||
if not boxes then
|
||||
return nil
|
||||
end
|
||||
DocCache:insert(hash, CacheItem:new{ rfpgboxes = boxes, size = 192 * nr_word }) -- estimation
|
||||
return boxes
|
||||
end
|
||||
@@ -541,6 +544,9 @@ function KoptInterface:getNativeTextBoxes(doc, pageno)
|
||||
--kc:setDebug()
|
||||
local fullwidth, fullheight = kc:getPageDim()
|
||||
local boxes, nr_word = kc:getNativeWordBoxes("dst", 0, 0, fullwidth, fullheight)
|
||||
if not boxes then
|
||||
return nil
|
||||
end
|
||||
DocCache:insert(hash, CacheItem:new{ nativepgboxes = boxes, size = 192 * nr_word }) -- estimation
|
||||
return boxes
|
||||
end
|
||||
@@ -569,8 +575,11 @@ function KoptInterface:getReflowedTextBoxesFromScratch(doc, pageno)
|
||||
local kc = self:createContext(doc, pageno)
|
||||
kc:copyDestBMP(reflowed_kc)
|
||||
local boxes, nr_word = kc:getNativeWordBoxes("dst", 0, 0, fullwidth, fullheight)
|
||||
DocCache:insert(hash, CacheItem:new{ scratchrfpgboxes = boxes, size = 192 * nr_word }) -- estimation
|
||||
kc:free()
|
||||
if not boxes then
|
||||
return nil
|
||||
end
|
||||
DocCache:insert(hash, CacheItem:new{ scratchrfpgboxes = boxes, size = 192 * nr_word }) -- estimation
|
||||
return boxes
|
||||
end
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user