hwhw/kindlepdfviewer — pull request #64 by houqp (2012-03-13 08:39:26+00:00)
Title: Try to fix some bugs in new cache system

I am not sure my fixes are right or not, but at least it works for me.

In draworcache method, I added `offset_x_in_page` and `offset_y_in_page` variables to represents offset within page the page to draw. So we don't need to use `self.offset_x` and `self.offset_y` in following calculations. `self.offset_x` and `self.offset_y` might be positive or negative, which is easy to introduce bugs.

* The first bug is not handlling positive self.offset values, which leads to this output: http://imgur.com/7Ku01

* I am the one to blaim for the second bug: ZOOM_FIT_TO_CONTENT_WIDTH_PAN mode is not taken into consider. This leads to this output: http://imgur.com/1hrBu. I added ZOOM_FIT_TO_CONTENT_WIDTH_PAN mode to simulate the page turning experence in native reader days before. ;P

Besides what I mentioned above, the new cache system works great, I can observe that when panning in ZOOM mode, no page:draw() method is called :)