fix GeometryBuffer.clear(), first index should never be -1

This commit is contained in:
Hannes Janetzek 2013-10-06 21:11:03 +02:00
parent 19ee048582
commit af4df27d42

View File

@ -1,6 +1,5 @@
package org.oscim.core; package org.oscim.core;
// TODO: Auto-generated Javadoc
// TODO // TODO
// - getter methods! // - getter methods!
// - check indexPos < Short.Max // - check indexPos < Short.Max
@ -99,7 +98,7 @@ public class GeometryBuffer {
* Reset buffer. * Reset buffer.
*/ */
public void clear() { public void clear() {
index[0] = -1; index[0] = 0;
indexPos = 0; indexPos = 0;
pointPos = 0; pointPos = 0;
type = GeometryType.NONE; type = GeometryType.NONE;
@ -224,7 +223,7 @@ public class GeometryBuffer {
public GeometryBuffer translate(float dx, float dy) { public GeometryBuffer translate(float dx, float dy) {
for (int i = 0; i < pointPos; i += 2) { for (int i = 0; i < pointPos; i += 2) {
points[i] += dx; points[i] += dx;
points[i+1] += dy; points[i + 1] += dy;
} }
return this; return this;
} }
@ -232,7 +231,7 @@ public class GeometryBuffer {
public GeometryBuffer scale(float scaleX, float scaleY) { public GeometryBuffer scale(float scaleX, float scaleY) {
for (int i = 0; i < pointPos; i += 2) { for (int i = 0; i < pointPos; i += 2) {
points[i] *= scaleX; points[i] *= scaleX;
points[i+1] *= scaleY; points[i + 1] *= scaleY;
} }
return this; return this;
} }