From: Michael Ang Date: Fri, 14 Aug 2009 22:18:32 +0000 (+0000) Subject: Allow reduction factors down to 32. Reduces size of loaded images in 2up when zoomed... X-Git-Url: http://git.rot13.org/?a=commitdiff_plain;h=2c8bfb271fdb5e83e7fb1afdde672d99acc92d80;p=bookreader.git Allow reduction factors down to 32. Reduces size of loaded images in 2up when zoomed out far. See https://bugs.edge.launchpad.net/gnubook/+bug/333458 --- diff --git a/GnuBookIA/datanode/GnuBookImages.php b/GnuBookIA/datanode/GnuBookImages.php index cb9f05d..c8c7ddb 100644 --- a/GnuBookIA/datanode/GnuBookImages.php +++ b/GnuBookIA/datanode/GnuBookImages.php @@ -77,8 +77,14 @@ if (isset($_REQUEST['height'])) { $powReduce = 1; } else if (4 == $scale) { $powReduce = 2; + } else if (8 == $scale) { + $powReduce = 3; + } else if (16 == $scale) { + $powReduce = 4; + } else if (32 == $scale) { + $powReduce = 5; } else { - // $$$ why do we default to such a small scale? + // $$$ Leaving this in as default though I'm not sure why it is... $scale = 8; $powReduce = 3; } diff --git a/GnuBookIA/datanode/GnuBookJSIA.php b/GnuBookIA/datanode/GnuBookJSIA.php index e17702d..250cd60 100755 --- a/GnuBookIA/datanode/GnuBookJSIA.php +++ b/GnuBookIA/datanode/GnuBookJSIA.php @@ -139,16 +139,22 @@ gb.getPageURI = function(index) { if (1==this.mode) { var url = 'http://'+this.server+'/GnuBook/GnuBookImages.php?zip='+this.zip+'&file='+file+'&scale='+this.reduce; } else { - var ratio = this.getPageHeight(index) / this.twoPageH; + var ratio = this.getPageHeight(index) / this.twoPage.height; var scale; // $$$ we make an assumption here that the scales are available pow2 (like kakadu) if (ratio <= 2) { scale = 1; } else if (ratio <= 4) { scale = 2; - } else { + } else if (ratio <= 8) { scale = 4; - } + } else if (ratio <= 16) { + scale = 8; + } else if (ratio <= 32) { + scale = 16; + } else { + scale = 32; + } var url = 'http://'+this.server+'/GnuBook/GnuBookImages.php?zip='+this.zip+'&file='+file+'&scale='+scale;