shithub: puzzles

Download patch

ref: 01471b5dc98e80a5ca0874b7be7a202700c93dae
parent: bce3f1bd2680b0f6bd6f6781b551c7c6b1e51f65
author: Simon Tatham <anakin@pobox.com>
date: Mon Apr 1 12:23:03 EDT 2013

Rewrite trim_rect() for robustness.

The previous version dealt adequately with rectangles _partially_
overlapping the edge of the canvas, but doesn't correctly handle a
rectangle that's completely out of bounds in one direction. Replace
with a complete rewrite which is more easily seen to be correct. Also,
while I'm at it, add a missing condition to draw_update() so that we
don't even bother calling the Javascript half of it on any rectangle
that's been trimmed into nonexistence.

[originally from svn r9800]