Merge pull request #6 from dpavlin/master

modify_gamma now use cache correctly, add memory-limit patch for muPDF
pull/2/merge
HW 13 years ago
commit 13fc5cefbb

@ -0,0 +1,12 @@
diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c
index 83f4652..c4d7d6a 100644
--- a/fitz/res_pixmap.c
+++ b/fitz/res_pixmap.c
@@ -1,6 +1,6 @@
#include "fitz.h"
-static int fz_memory_limit = 256 << 20;
+static int fz_memory_limit = 64 << 20; // XXX dpavlin - limit memory usage to 64M
static int fz_memory_used = 0;
fz_pixmap *

@ -117,7 +117,7 @@ function freecache()
end
function checkcache(no)
for i = 1, #cache do
if cache[i].no == no then
if cache[i].no == no and cache[i].page ~= nil then
print("cache hit: slot="..i.." page="..no)
return i
end
@ -216,13 +216,12 @@ function modify_gamma(offset)
if gamma == -1 then
gamma = 1
end
print("modify_gamma slot="..slot.." gamma="..gamma.." offset="..offset)
local no = cache[slot].no
print("modify_gamma "..no.." slot="..slot.." gamma="..gamma.." offset="..offset)
gamma = gamma + offset;
cache[slot].dc:setGamma( gamma );
optarg["G"] = gamma; -- for next page
cache[slot].page:draw(cache[slot].dc, cache[slot].bb, 0, 0)
fb:blitFullFrom(cache[slot].bb)
fb:refresh(0)
freecache()
goto(no)
end
function mainloop()

Loading…
Cancel
Save