diff options
author | Dan Gudmundsson <[email protected]> | 2012-02-16 13:55:08 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2012-02-17 10:19:45 +0100 |
commit | 953ee650a80d863a85c99e82ef69501496db0ad6 (patch) | |
tree | 637e728152ec48479bc06275e0976250c47a1d23 /lib/wx/c_src/gen/wxe_funcs.cpp | |
parent | 2e3260f90ce4cb595296a36fbd212578e10a7e94 (diff) | |
download | otp-953ee650a80d863a85c99e82ef69501496db0ad6.tar.gz otp-953ee650a80d863a85c99e82ef69501496db0ad6.tar.bz2 otp-953ee650a80d863a85c99e82ef69501496db0ad6.zip |
[wx] Fix wxGraphicContext bugs
* Lines had wrong arguments
* Change float() to number in guards, when packing arguments
integers are converted floats to automaticly anyway.
Diffstat (limited to 'lib/wx/c_src/gen/wxe_funcs.cpp')
-rw-r--r-- | lib/wx/c_src/gen/wxe_funcs.cpp | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/lib/wx/c_src/gen/wxe_funcs.cpp b/lib/wx/c_src/gen/wxe_funcs.cpp index f456bd3287..95a77d7f4f 100644 --- a/lib/wx/c_src/gen/wxe_funcs.cpp +++ b/lib/wx/c_src/gen/wxe_funcs.cpp @@ -1,7 +1,7 @@ /* * %CopyrightBegin% * - * Copyright Ericsson AB 2008-2011. All Rights Reserved. + * Copyright Ericsson AB 2008-2012. All Rights Reserved. * * The contents of this file are subject to the Erlang Public License, * Version 1.1, (the "License"); you may not use this file except in @@ -6255,17 +6255,21 @@ case wxGraphicsContext_DrawIcon: { // wxGraphicsContext::DrawIcon case wxGraphicsContext_DrawLines: { // wxGraphicsContext::DrawLines int fillStyle=wxODDEVEN_RULE; wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; - int * n = (int *) bp; bp += 4; - wxDouble * pointsX = (wxDouble *) bp; bp += 8; - wxDouble * pointsY = (wxDouble *) bp; bp += 8; - wxPoint2DDouble points = wxPoint2DDouble(*pointsX,*pointsY); + int * pointsLen = (int *) bp; bp += 4; + wxPoint2DDouble *points; + points = (wxPoint2DDouble *) driver_alloc(sizeof(wxPoint2DDouble) * *pointsLen); + for(int i=0; i < *pointsLen; i++) { + double x = * (double *) bp; bp += 8; + double y = * (double *) bp; bp += 8; + points[i] = wxPoint2DDouble(x,y);} while( * (int*) bp) { switch (* (int*) bp) { case 1: {bp += 4; fillStyle = (int)*(int *) bp; bp += 4; } break; }}; if(!This) throw wxe_badarg(0); - This->DrawLines((size_t) *n,&points,fillStyle); + This->DrawLines(*pointsLen,points,fillStyle); + driver_free(points); break; } case wxGraphicsContext_DrawPath: { // wxGraphicsContext::DrawPath @@ -6514,27 +6518,18 @@ case wxGraphicsContext_StrokeLine: { // wxGraphicsContext::StrokeLine This->StrokeLine((wxDouble) *x1,(wxDouble) *y1,(wxDouble) *x2,(wxDouble) *y2); break; } -case wxGraphicsContext_StrokeLines_2: { // wxGraphicsContext::StrokeLines +case wxGraphicsContext_StrokeLines: { // wxGraphicsContext::StrokeLines wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; - int * n = (int *) bp; bp += 4; - wxDouble * pointsX = (wxDouble *) bp; bp += 8; - wxDouble * pointsY = (wxDouble *) bp; bp += 8; - wxPoint2DDouble points = wxPoint2DDouble(*pointsX,*pointsY); + int * pointsLen = (int *) bp; bp += 4; + wxPoint2DDouble *points; + points = (wxPoint2DDouble *) driver_alloc(sizeof(wxPoint2DDouble) * *pointsLen); + for(int i=0; i < *pointsLen; i++) { + double x = * (double *) bp; bp += 8; + double y = * (double *) bp; bp += 8; + points[i] = wxPoint2DDouble(x,y);} if(!This) throw wxe_badarg(0); - This->StrokeLines((size_t) *n,&points); - break; -} -case wxGraphicsContext_StrokeLines_3: { // wxGraphicsContext::StrokeLines - wxGraphicsContext *This = (wxGraphicsContext *) getPtr(bp,memenv); bp += 4; - int * n = (int *) bp; bp += 4; - wxDouble * beginPointsX = (wxDouble *) bp; bp += 8; - wxDouble * beginPointsY = (wxDouble *) bp; bp += 8; - wxPoint2DDouble beginPoints = wxPoint2DDouble(*beginPointsX,*beginPointsY); - wxDouble * endPointsX = (wxDouble *) bp; bp += 8; - wxDouble * endPointsY = (wxDouble *) bp; bp += 8; - wxPoint2DDouble endPoints = wxPoint2DDouble(*endPointsX,*endPointsY); - if(!This) throw wxe_badarg(0); - This->StrokeLines((size_t) *n,&beginPoints,&endPoints); + This->StrokeLines(*pointsLen,points); + driver_free(points); break; } #endif // wxUSE_GRAPHICS_CONTEXT |