[Pixelle-commit] SF.net SVN: pixelle: [64] trunk/pixelle/src/com/mebigfatguy/pixelle
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2008-06-23 05:58:40
|
Revision: 64
http://pixelle.svn.sourceforge.net/pixelle/?rev=64&view=rev
Author: dbrosius
Date: 2008-06-22 22:58:47 -0700 (Sun, 22 Jun 2008)
Log Message:
-----------
get rid of the strips, and improve performance
Modified Paths:
--------------
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-23 05:53:42 UTC (rev 63)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleEval.java 2008-06-23 05:58:47 UTC (rev 64)
@@ -112,7 +112,12 @@
}
private double getSelectionValue(int x, int y) {
- return srcImage.getSelectionValue(x, y);
+ if ((x & 0x07) == 0) {
+ selectionByte = srcImage.getSelectionByte(x >> 3, y);
+ }
+
+ int bitOffset = 1 << (x & 0x07);
+ return ((selectionByte & bitOffset) == 0) ? 0 : 1;
}
protected void setSelectionValue(int x, int y, double value) {
Modified: trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java
===================================================================
--- trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java 2008-06-23 05:53:42 UTC (rev 63)
+++ trunk/pixelle/src/com/mebigfatguy/pixelle/PixelleImage.java 2008-06-23 05:58:47 UTC (rev 64)
@@ -72,11 +72,10 @@
}
}
- public int getSelectionValue(int x, int y) {
+ public int getSelectionByte(int xByteOffset, int y) {
DataBuffer buffer = selection.getRaster().getDataBuffer();
int byteWidth = (getWidth() + 7) >> 3;
- int byteValue = buffer.getElem(y * byteWidth + (x >> 3));
- return ((byteValue & (1 << (x >> 3))) != 0) ? 1 : 0;
+ return buffer.getElem(y * byteWidth + xByteOffset);
}
public void setSelectionByte(int xByteOffset, int y, int byteValue) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|