[Pixelle-commit] SF.net SVN: pixelle: [126] trunk/pixelle/src/com/mebigfatguy/pixelle/ PixelleEval.
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-29 22:23:26
|
Revision: 126
http://pixelle.svn.sourceforge.net/pixelle/?rev=126&view=rev
Author: dbrosius
Date: 2008-06-29 15:22:36 -0700 (Sun, 29 Jun 2008)
Log Message:
-----------
fix selection calc (bit positions)
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-29 18:41:19 UTC (rev 125)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-29 22:22:36 UTC (rev 126)
@@ -195,18 +195,15 @@
* @param value the selection value to use where 0 is off
*/
protected void setSelectionValue(int x, int y, double value) {
- if ((x & 0x07) == 0) {
+ int bit = x & 0x07;
+ if (bit == 0)
selectionByte = 0;
- }
- int imageWidth = srcImage.getWidth();
- int bitOffset = 1 << (x & 0x07);
- if (value == 0.0)
- selectionByte &= ~bitOffset;
- else
+ int bitOffset = 1 << (7 - bit);
+ if (value != 0.0)
selectionByte |= bitOffset;
- if (((x & 0x07) == 7) || (x == imageWidth))
+ if ((bit == 7) || (x == width))
srcImage.setSelectionByte(x >> 3, y, selectionByte);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|