优化
This commit is contained in:
tslediter 2024-01-26 17:53:23 +08:00
parent eccc96de15
commit 27fb67b49a
5 changed files with 20 additions and 10 deletions

View File

@ -1452,7 +1452,8 @@ type TWinControl = class(tcontrol)
rgb := _wapi.CreateRectRgn(outrect[0],outrect[1],outrect[2],outrect[3]); //控件区域 rgb := _wapi.CreateRectRgn(outrect[0],outrect[1],outrect[2],outrect[3]); //控件区域
//_wapi.CombineRgn(rgC,rga,rgb,RGN_AND); //控件绘画区域 //_wapi.CombineRgn(rgC,rga,rgb,RGN_AND); //控件绘画区域
//bkrg := _wapi.SelectClipRgn(TheMessage.wparam,rgc); //裁剪区域 //bkrg := _wapi.SelectClipRgn(TheMessage.wparam,rgc); //裁剪区域
bkrg := _wapi.SelectClipRgn(TheMessage.wparam,rgb); //裁剪区域 //bkrg :=
_wapi.SelectClipRgn(TheMessage.wparam,rgb); //裁剪区域
try try
pts := it.PaintStruct(); pts := it.PaintStruct();
pts._setvalue_("rcpaint",array(outrect[0]-itbounds[0],outrect[1]-itbounds[1],outrect[2]-itbounds[0],outrect[3]-itbounds[1])); pts._setvalue_("rcpaint",array(outrect[0]-itbounds[0],outrect[1]-itbounds[1],outrect[2]-itbounds[0],outrect[3]-itbounds[1]));
@ -1461,7 +1462,7 @@ type TWinControl = class(tcontrol)
it.Perform(ne); it.Perform(ne);
_wapi.SetViewportOrgEx(TheMessage.wparam,c[0],c[1],nil); //恢复基准点 _wapi.SetViewportOrgEx(TheMessage.wparam,c[0],c[1],nil); //恢复基准点
finally finally
_wapi.SelectClipRgn(TheMessage.wparam,bkrg); //恢复区域 //_wapi.SelectClipRgn(TheMessage.wparam,bkrg); //恢复区域
_wapi.DeleteObject(rgb); //销毁区域 _wapi.DeleteObject(rgb); //销毁区域
end; end;
end end

View File

@ -4736,11 +4736,12 @@ type tgtkapis = class() //gtk
function cairo_applay_pen_style(dc); function cairo_applay_pen_style(dc);
begin begin
pt := gtk_object_get_data(dc,"pen.style"); pt := gtk_object_get_data(dc,"pen.style");
if pt=0x2 then if pt=0x2 or pt=0x3 or pt=0x4 then
begin begin
cairo_set_dash(dc,array(4.0,1.0),2,0); cairo_set_dash(dc,array(4.0,1.0),2,0);
end end
else cairo_set_dash(dc,array(4.0,0.0),2,0); else cairo_set_dash(dc,array(4.0,0.0),2,0);
return pt=5;
end end
function cairo_draw_round_rectangle(cr,x,y,w,h,r); function cairo_draw_round_rectangle(cr,x,y,w,h,r);
begin begin

View File

@ -2243,11 +2243,12 @@ type TCanvsRgnClipAutoSave=class()
FCvsHandle := cvs.Handle; FCvsHandle := cvs.Handle;
FCrg := FW32api.CreateRectRgn(rec[0],rec[1],rec[2],rec[3]); FCrg := FW32api.CreateRectRgn(rec[0],rec[1],rec[2],rec[3]);
FBKrg := FW32api.SelectClipRgn(FCvsHandle,FCrg); //裁剪区域 FBKrg := FW32api.SelectClipRgn(FCvsHandle,FCrg); //裁剪区域
FBKrg := nil;
end end
end end
function Destroy(); function Destroy();
begin begin
if FW32api and FCvsHandle and FBKrg and FCrg then if FW32api and FCvsHandle {and FBKrg} and FCrg then
begin begin
FW32api.SelectClipRgn(FCvsHandle,FBKrg); //恢复区域 FW32api.SelectClipRgn(FCvsHandle,FBKrg); //恢复区域
FW32api.DeleteObject(FCrg); //销毁区域 FW32api.DeleteObject(FCrg); //销毁区域

View File

@ -2305,13 +2305,13 @@ type TcustomCanvas = class(TSLUIBASE)
end end
return r; return r;
end end
function SelectClipRgn(rgn); (*function SelectClipRgn(rgn);
begin begin
{** {**
@explan(说明) 设置区域 %% @explan(说明) 设置区域 %%
@param(rgn)(TRgn) 选择区域 %% @param(rgn)(TRgn) 选择区域 %%
**} **}
if rgn=FRgn then exit; if rgn and (rgn=FRgn) then exit;
r := FRgn; r := FRgn;
FRgn := rgn; FRgn := rgn;
if not HandleAllocated()then exit; if not HandleAllocated()then exit;
@ -2324,7 +2324,7 @@ type TcustomCanvas = class(TSLUIBASE)
end end
if r is class(trgn)then return r; if r is class(trgn)then return r;
return r1; return r1;
end end*)
function create();override; function create();override;
begin begin
inherited; inherited;

View File

@ -682,9 +682,13 @@ type tg_axes = class(tg_graph) //
function paint(cvs);override; function paint(cvs);override;
begin begin
if not visible then return ; if not visible then return ;
modify_coordinate_postion(); modify_coordinate_postion();
inherited; r := array(p_left-1,p_top-1,p_left+p_width+1,p_top+p_height+1);
o := new TCanvsRgnClipAutoSave(cvs,r);
inherited;
o := nil;
paint_grid(cvs); paint_grid(cvs);
for i,v in faxes_objects do //»æÖÆ×ø±ê for i,v in faxes_objects do //»æÖÆ×ø±ê
begin begin
v.paint(cvs); v.paint(cvs);
@ -1330,7 +1334,10 @@ type tg_Polyline = class(tg_graph)
end end
else else
begin begin
cvs.draw_polyline().points(xys).draw(); if fclosed and length(xys)>2 then
cvs.draw_polyline().points( xys union xys[0:0]).draw();
else
cvs.draw_polyline().points(xys).draw();
end end
end; end;
mk := markinfo; mk := markinfo;