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/api_gen | |
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/api_gen')
-rw-r--r-- | lib/wx/api_gen/wx_gen_cpp.erl | 12 | ||||
-rw-r--r-- | lib/wx/api_gen/wx_gen_erl.erl | 22 | ||||
-rw-r--r-- | lib/wx/api_gen/wxapi.conf | 18 |
3 files changed, 39 insertions, 13 deletions
diff --git a/lib/wx/api_gen/wx_gen_cpp.erl b/lib/wx/api_gen/wx_gen_cpp.erl index 1b4c32db24..4bc58533ad 100644 --- a/lib/wx/api_gen/wx_gen_cpp.erl +++ b/lib/wx/api_gen/wx_gen_cpp.erl @@ -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 @@ -645,6 +645,16 @@ decode_arg(N,#type{name=Type,single=list,base={class,Class}},arg,A0) -> w(" ~s.Append(*(~s *) getPtr(bp,memenv)); bp += 4;}~n", [N,Class]), w(" bp += ((~p+ *~sLen)%2 )*4;~n", [A,N]), 0; +decode_arg(N,#type{single=array,base={comp,Class="wxPoint2DDouble",_}},arg,A0) -> + w(" int * ~sLen = (int *) bp; bp += 4;~n", [N]), + w(" ~s *~s;~n",[Class,N]), + w(" ~s = (~s *) driver_alloc(sizeof(~s) * *~sLen);~n",[N,Class,Class,N]), + store_free(N), + align(A0+1,64), + w(" for(int i=0; i < *~sLen; i++) {~n", [N]), + w(" double x = * (double *) bp; bp += 8;~n double y = * (double *) bp; bp += 8;~n", []), + w(" ~s[i] = wxPoint2DDouble(x,y);}~n", [N]), + 0; decode_arg(Name,T, Arg,_A) -> ?error({unhandled_type, {Name,T, Arg}}). diff --git a/lib/wx/api_gen/wx_gen_erl.erl b/lib/wx/api_gen/wx_gen_erl.erl index 5e35631589..00bb7e20d0 100644 --- a/lib/wx/api_gen/wx_gen_erl.erl +++ b/lib/wx/api_gen/wx_gen_erl.erl @@ -307,6 +307,11 @@ gen_dest(#class{name=CName,abstract=Abs}, Ms) -> false -> case lists:keysearch(destructor,#method.method_type, lists:append(Ms)) of {value, #method{method_type=destructor, id=Id}} -> + case CName of + "wxGraphicsCo" ++ _ -> + io:format("parents ~p~n",[parents(CName)]); + _ -> ok + end, case hd(reverse(parents(CName))) of object -> gen_dest2(CName, object); @@ -603,9 +608,9 @@ guard_test(#param{name=N,type=#type{base=int64}}) -> guard_test(#param{name=N,type=#type{base=long}}) -> "is_integer(" ++ erl_arg_name(N) ++ ")"; guard_test(#param{name=N,type=#type{base=float}}) -> - "is_float(" ++ erl_arg_name(N) ++ ")"; + "is_number(" ++ erl_arg_name(N) ++ ")"; guard_test(#param{name=N,type=#type{base=double}}) -> - "is_float(" ++ erl_arg_name(N) ++ ")"; + "is_number(" ++ erl_arg_name(N) ++ ")"; guard_test(#param{name=N,type=#type{base=bool}}) -> "is_boolean(" ++ erl_arg_name(N) ++ ")"; guard_test(#param{name=N,type=#type{name="wxDateTime"}}) -> @@ -744,8 +749,8 @@ doc_arg_type3(#type{base=int64}) -> "integer()"; doc_arg_type3(#type{base=long}) -> "integer()"; doc_arg_type3(#type{name="wxTreeItemId"}) -> "wxTreeCtrl:treeItemId()"; doc_arg_type3(#type{base=bool}) -> "boolean()"; -doc_arg_type3(#type{base=float}) -> "float()"; -doc_arg_type3(#type{base=double}) -> "float()"; +doc_arg_type3(#type{base=float}) -> "number()"; +doc_arg_type3(#type{base=double}) -> "number()"; doc_arg_type3(#type{base=binary}) -> "binary()"; doc_arg_type3(#type{base={binary,_}}) -> "binary()"; doc_arg_type3(#type{base=eventType}) -> "atom()"; @@ -933,7 +938,7 @@ marshal_arg(#type{single=true,base={comp,_,Comp}}, Name, Align0) -> Str = args(fun(Str) -> Str end, ",", A), {Str,(Align0 + length(Comp)) rem 2}; {double,_} -> - A = [Name++Spec++":64/float" || {double,Spec} <- Comp], + A = [Name++Spec++":64/?F" || {double,Spec} <- Comp], Str = args(fun(Str) -> Str end, ",", A), align(64,Align0,Str) end; @@ -959,9 +964,14 @@ marshal_arg(#type{base=Base, single=Single}, Name, Align0) Str0 = "(length("++Name++")):32/?UI,\n" " (<< <<X:32/?I,Y:32/?I>> || {X,Y} <- "++Name++">>)/binary", align(32,Align0, Str0); + {comp, "wxPoint2DDouble", _} -> + Str0 = "(length("++Name++")):32/?UI,\n", + Str1 = " (<< <<X:64/?F,Y:64/?F>> || {X,Y} <- "++Name++">>)/binary", + {Str,_Align} = align(64,Align0+1, Str1), + {Str0 ++ Str, 0}; double -> Str0 = "(length("++Name++")):32/?UI,\n", - Str1 = " (<< <<C:64/float>> || C <- "++Name++">>)/binary", + Str1 = " (<< <<C:64/?F>> || C <- "++Name++">>)/binary", {Str,_Align} = align(64,Align0+1, Str1), {Str0 ++ Str, 0}; _ -> diff --git a/lib/wx/api_gen/wxapi.conf b/lib/wx/api_gen/wxapi.conf index ff618faf04..fe86838c2f 100644 --- a/lib/wx/api_gen/wxapi.conf +++ b/lib/wx/api_gen/wxapi.conf @@ -2,7 +2,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 @@ -355,18 +355,24 @@ %%{class,wxAutoBufferedPaintDC,wxBufferedPaintDC,[],['wxAutoBufferedPaintDC']}. {class, wxGraphicsObject, object, [{ifdef, wxUSE_GRAPHICS_CONTEXT}], - ['GetRenderer','IsNull']}. -{class, wxGraphicsContext, wxGraphicsObject, [{ifdef, wxUSE_GRAPHICS_CONTEXT}], - ['Create', %%CreateFromNative CreateFromNativeWindow + ['~wxGraphicsObject', 'GetRenderer','IsNull']}. +{class, wxGraphicsContext, wxGraphicsObject, + [{ifdef, wxUSE_GRAPHICS_CONTEXT}, {skip, [{'StrokeLines',4}]}], + ['~wxGraphicsContext', + 'Create', %%CreateFromNative CreateFromNativeWindow 'CreatePen','CreateBrush','CreateRadialGradientBrush', 'CreateLinearGradientBrush','CreateFont','CreateMatrix', 'CreatePath','Clip','ResetClip', - 'DrawBitmap','DrawEllipse','DrawIcon','DrawLines','DrawPath', + 'DrawBitmap','DrawEllipse','DrawIcon', + {'DrawLines', [{"n",{c_only,{length,"points"}}}, {"points", {single,array}}]}, + 'DrawPath', 'DrawRectangle','DrawRoundedRectangle','DrawText','FillPath', 'StrokePath','GetNativeContext','GetPartialTextExtents', 'GetTextExtent','Rotate','Scale','Translate', 'GetTransform','SetTransform','ConcatTransform', - 'SetBrush','SetFont','SetPen','StrokeLine','StrokeLines']}. + 'SetBrush','SetFont','SetPen','StrokeLine', + {'StrokeLines', [{"n",{c_only,{length,"points"}}}, {"points", {single,array}}]} + ]}. {class, wxGraphicsMatrix, wxGraphicsObject, [{ifdef, wxUSE_GRAPHICS_CONTEXT}], ['Concat','Get','GetNativeMatrix','Invert','IsEqual','IsIdentity', 'Rotate','Scale','Translate','Set','TransformPoint','TransformDistance']}. |