Update of /cvsroot/freenet/freenet/src/freenet/support/graph
In directory sc8-pr-cvs1:/tmp/cvs-serv7395/src/freenet/support/graph
Modified Files:
Bitmap.java
Log Message:
6348:
Pessimistic initial estimators. Break compatibility with previous Estimator fieldsets,
because they will have initially optimistic estimators. Combined with work in 6347, we
now have an initial implementation of what was planned on devl: pessimistic initial
estimators, and a means of ensuring that new nodes do get routed to despite it.
Fairly major supporting architectural work.
Minor bugfixes to graphs.
Index: Bitmap.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/support/graph/Bitmap.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -w -r1.8 -r1.9
--- Bitmap.java 14 Nov 2003 10:40:40 -0000 1.8
+++ Bitmap.java 22 Nov 2003 02:47:51 -0000 1.9
@@ -119,10 +119,10 @@
}
public void drawTo(float newx, float newy) {
- int x1 = Math.round(xPix(x));
- int y1 = Math.round(yPix(y));
- int x2 = Math.round(xPix(newx));
- int y2 = Math.round(yPix(newy));
+ int x1 = clipX(Math.round(xPix(x)));
+ int y1 = clipY(Math.round(yPix(y)));
+ int x2 = clipX(Math.round(xPix(newx)));
+ int y2 = clipY(Math.round(yPix(newy)));
int dx, dy, xdir, ydir;
@@ -199,6 +199,18 @@
return ((yu - coord.top) / (coord.top - coord.bottom)) * (0.5f -
(float) height);
}
+ private int clipX(int x) {
+ if(x < 0) x = 0;
+ if(x >= width) x = width-1;
+ return x;
+ }
+
+ private int clipY(int y) {
+ if(y < 0) y = 0;
+ if(y >= height) y = height-1;
+ return y;
+ }
+
byte[][] getPixels() {
return pixels;
}
_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs