summaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-01-04 18:54:25 (GMT)
committer jacob1 <jfu614@gmail.com>2013-01-04 18:54:25 (GMT)
commit1b2e7b3c70bf72b069786c1ccd2a782028ae84ce (patch)
tree3e2ed576045bb83ae6cb973b18898afdbed0fba4 /src/graphics
parent8e50abcab956b7cf842a7891bcb1ceac40caf5d4 (diff)
downloadpowder-1b2e7b3c70bf72b069786c1ccd2a782028ae84ce.zip
powder-1b2e7b3c70bf72b069786c1ccd2a782028ae84ce.tar.gz
fix Ctrl+x being one pixel off, better xor_rect from tpt, delete test.c
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/RasterDrawMethods.inl21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/graphics/RasterDrawMethods.inl b/src/graphics/RasterDrawMethods.inl
index 55a64c9..dec15f1 100644
--- a/src/graphics/RasterDrawMethods.inl
+++ b/src/graphics/RasterDrawMethods.inl
@@ -236,12 +236,29 @@ void PIXELMETHODS_CLASS::xor_rect(int x, int y, int w, int h)
for (i=0; i<w; i+=2)
{
xor_pixel(x+i, y);
- xor_pixel(x+i, y+h-1);
}
+ if (h != 1)
+ {
+ if (h%2 == 1) i = 2;
+ else i = 1;
+ for (; i<w; i+=2)
+ {
+ xor_pixel(x+i, y+h-1);
+ }
+ }
+
for (i=2; i<h; i+=2)
{
xor_pixel(x, y+i);
- xor_pixel(x+w-1, y+i);
+ }
+ if (w != 1)
+ {
+ if (w%2 == 1) i = 2;
+ else i = 1;
+ for (; i<h-1; i+=2)
+ {
+ xor_pixel(x+w-1, y+i);
+ }
}
}