chiark / gitweb /
Slight simplification to whitepixel().
authorBen Harris <bjh21@bjh21.me.uk>
Thu, 26 Dec 2013 08:06:03 +0000 (08:06 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Thu, 26 Dec 2013 08:06:03 +0000 (08:06 +0000)
Previously, when two black corners of a white pixel were adjacent,
they were both modified so as not to overlap.  Now only one corner is
modified, albeit slightly more radically.  This has no practical
effect on the output, but it makes the code simpler.

bedstead.c

index 747544c8f77bf0a9e20fef46cf1536b75f097b0f..0a4e5690f0d9901cde2404cbae61ed6cfef58394 100644 (file)
@@ -1500,34 +1500,26 @@ whitepixel(int x, int y, int bl, int br, int tr, int tl)
        x *= 4; y *= 4;
 
        if (bl) {
-               moveto(x, y);
-               if (tl) { lineto(x, y+2); lineto(x+1, y+2); }
-               else lineto(x, y+3);
-               if (br) { lineto(x+2, y+1); lineto(x+2, y); }
+               moveto(x, y); lineto(x, y+3);
+               if (br) { lineto(x+2, y+1); lineto(x+1, y); }
                else lineto(x+3, y);
                closepath();
        }
        if (tl) {
-               moveto(x, y+4);
-               if (tr) { lineto(x+2, y+4); lineto(x+2, y+3); }
-               else lineto(x+3, y+4);
-               if (bl) { lineto(x+1, y+2); lineto(x, y+2); }
+               moveto(x, y+4); lineto(x+3, y+4);
+               if (bl) { lineto(x+1, y+2); lineto(x, y+3); }
                else lineto(x, y+1);
                closepath();
        }
        if (tr) {
-               moveto(x+4, y+4);
-               if (br) { lineto(x+4, y+2); lineto(x+3, y+2); }
-               else lineto(x+4, y+1);
-               if (tl) { lineto(x+2, y+3); lineto(x+2, y+4); }
+               moveto(x+4, y+4); lineto(x+4, y+1);
+               if (tl) { lineto(x+2, y+3); lineto(x+3, y+4); }
                else lineto(x+1, y+4);
                closepath();
        }
        if (br) {
-               moveto(x+4, y);
-               if (bl) { lineto(x+2, y); lineto(x+2, y+1); }
-               else lineto(x+1, y);
-               if (tr) { lineto(x+3, y+2); lineto(x+4, y+2); }
+               moveto(x+4, y); lineto(x+1, y);
+               if (tr) { lineto(x+3, y+2); lineto(x+4, y+1); }
                else lineto(x+4, y+3);
                closepath();
        }