Graphics.cubicCurveTo broken?

Is there something wrong with Graphics.cubicCurveto()? It seems to me that even simple cubic curves come out looking completely wrong. Consider the following simple code inside an initially empty sketch:

graphics.lineStyle( 2.0, 0x000000 );
graphics.moveTo( 100, 100 );
graphics.cubicCurveTo( 200, 100, 300, 200, 400, 100 );
graphics.lineTo( 500, 100 );

This should be a simple cubic curve segment followed by a straight line. Instead, I get this on neko and html5:

Worse yet, when I comment out the final lineTo() call, the program crashes:

Called from ? line 1
Called from ApplicationMain.hx line 138
Called from ApplicationMain.hx line 51
Called from lime/app/Application.hx line 221
Called from lime/_backend/native/NativeApplication.hx line 127
Called from a C function
Called from lime/_backend/native/NativeApplication.hx line 332
Called from lime/app/Event.hx line 141
Called from lime/app/Application.hx line 110
Called from lime/app/Application.hx line 762
Called from openfl/display/Stage.hx line 1161
Called from openfl/_internal/renderer/opengl/GLRenderer.hx line 303
Called from openfl/_internal/renderer/opengl/GLRenderer.hx line 340
Called from openfl/display/DisplayObjectContainer.hx line 1062
Called from openfl/display/DisplayObjectContainer.hx line 1062
Called from openfl/display/DisplayObjectContainer.hx line 1058
Called from openfl/_internal/renderer/cairo/CairoGraphics.hx line 1323
Called from openfl/_internal/renderer/cairo/CairoGraphics.hx line 189
Called from openfl/_internal/renderer/cairo/CairoGraphics.hx line 498
Uncaught exception - Invalid operation (-)

It seems inconceivable that something as fundamental as cubic spline curves don’t work correctly, so I must ask: am I doing something obviously wrong?


Thank you!

This was a bug in the command buffer/reader. It was giving the wrong values (off by one) – that’s why Neko crashed if you didn’t have another command after it. Works now!

I wouldn’t have seen this without your help, thank you :smile: