MG: accelerated SelectGDKPenProps

git-svn-id: trunk@1901 -
This commit is contained in:
lazarus 2002-08-17 23:39:53 +00:00
parent 72bdd73d34
commit bc646a73db

View File

@ -74,20 +74,17 @@ begin
// Draw outline // Draw outline
SelectGDKPenProps(DC); SelectGDKPenProps(DC);
If not IsValidGDIObject(hPen(CurrentPen)) then If (dcfPenSelected in DCFlags) then begin
exit;//cowardly refuse to continue Result := True;
if (CurrentPen^.IsNullPen) then exit;
If CurrentPen^.IsNullPen then begin DCOrigin:=GetDCOffset(TDeviceContext(DC));
Result := True;//not an error inc(X,DCOrigin.X);
Exit;//Skip out. inc(Y,DCOrigin.Y);
end; gdk_draw_arc(Drawable, GC, 0, X, Y, Width, Height,
Angle1 shl 2, Angle2 shl 2);
DCOrigin:=GetDCOffset(TDeviceContext(DC)); end else
inc(X,DCOrigin.X); Result:=false;
inc(Y,DCOrigin.Y);
gdk_draw_arc(Drawable, GC, 0, X, Y, Width, Height,
Angle1 shl 2, Angle2 shl 2);
Result := True;
end; end;
end; end;
end; end;
@ -2347,7 +2344,8 @@ end;
Returns: If the string was drawn, or CalcRect run Returns: If the string was drawn, or CalcRect run
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TgtkObject.DrawText(DC : hDC; Str: PChar; Count : Integer; var Rect: TRect; Flags : Cardinal): Integer; function TgtkObject.DrawText(DC : hDC; Str: PChar; Count : Integer;
var Rect: TRect; Flags : Cardinal): Integer;
begin begin
Assert(False, Format('trace:> [TgtkObject.DrawText] DC:0x%x, Str:''%s'', Count: %d, Rect = %d,%d,%d,%d, Flags:%d', Assert(False, Format('trace:> [TgtkObject.DrawText] DC:0x%x, Str:''%s'', Count: %d, Rect = %d,%d,%d,%d, Flags:%d',
[DC, Str, Count, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, Flags])); [DC, Str, Count, Rect.Left, Rect.Top, Rect.Right, Rect.Bottom, Flags]));
@ -2461,21 +2459,17 @@ begin
DCOrigin:=GetDCOffset(TDeviceContext(DC)); DCOrigin:=GetDCOffset(TDeviceContext(DC));
gdk_draw_arc(Drawable, GC, 1, x+DCOrigin.X, y+DCOrigin.Y, Width, Height, gdk_draw_arc(Drawable, GC, 1, x+DCOrigin.X, y+DCOrigin.Y, Width, Height,
0, 360 shl 6); 0, 360 shl 6);
// Draw outline
// Draw outline
SelectGDKPenProps(DC); SelectGDKPenProps(DC);
If not IsValidGDIObject(hPen(CurrentPen)) then If (dcfPenSelected in DCFlags) then begin
exit;//cowardly refuse to continue Result := True;
if (CurrentPen^.IsNullPen) then exit;
If CurrentPen^.IsNullPen then begin gdk_draw_arc(Drawable, GC, 0, x+DCOrigin.X, y+DCOrigin.Y, Width, Height,
Result := True;//not an error 0, 360 shl 6);
Exit;//Skip out. end else
end; Result := False;
gdk_draw_arc(Drawable, GC, 0, x+DCOrigin.X, y+DCOrigin.Y, Width, Height,
0, 360 shl 6);
Result := True;
end; end;
end; end;
end; end;
@ -4537,21 +4531,18 @@ begin
then with TDeviceContext(DC) do then with TDeviceContext(DC) do
begin begin
if GC <> nil then begin if GC <> nil then begin
DCOrigin:=GetDCOffset(TDeviceContext(DC));
SelectGDKPenProps(DC); SelectGDKPenProps(DC);
If not IsValidGDIObject(hPen(CurrentPen)) then If (dcfPenSelected in DCFlags) then begin
exit;//cowardly refuse to continue Result := True;
if (CurrentPen^.IsNullPen) then exit;
If CurrentPen^.IsNullPen then begin DCOrigin:=GetDCOffset(TDeviceContext(DC));
Result := True;//not an error gdk_draw_line(Drawable, GC, PenPos.X+DCOrigin.X, PenPos.Y+DCOrigin.Y,
Exit;//Skip out. X+DCOrigin.X, Y+DCOrigin.Y);
end; PenPos:= Point(X, Y);
end else
gdk_draw_line(Drawable, GC, PenPos.X+DCOrigin.X, PenPos.Y+DCOrigin.Y, Result := False;
X+DCOrigin.X, Y+DCOrigin.Y);
PenPos:= Point(X, Y);
Result := True;
end else begin end else begin
WriteLn('WARNING: [TgtkObject.LineTo] Uninitialized GC'); WriteLn('WARNING: [TgtkObject.LineTo] Uninitialized GC');
Result := False; Result := False;
@ -4911,18 +4902,13 @@ begin
SelectGDKPenProps(DC); SelectGDKPenProps(DC);
If not IsValidGDIObject(hPen(CurrentPen)) then begin If (dcfPenSelected in DCFlags) then begin
FreeMem(PointArray); //don't forget too free Result := True;
exit;//cowardly refuse to continue if (not CurrentPen^.IsNullPen) then begin
end; gdk_draw_polygon(Drawable, GC, 0, PointArray, NumPts);
end;
If CurrentPen^.IsNullPen then begin end else
Result := True;//not an error Result:=false;
FreeMem(PointArray); //don't forget too free
Exit;//Skip out.
end;
gdk_draw_polygon(Drawable, GC, 0, PointArray, NumPts);
FreeMem(PointArray); FreeMem(PointArray);
@ -4957,21 +4943,14 @@ begin
// draw outline // draw outline
SelectGDKPenProps(DC); SelectGDKPenProps(DC);
If not IsValidGDIObject(hPen(CurrentPen)) then begin If (dcfPenSelected in DCFlags) then begin
FreeMem(PointArray); //don't forget too free Result := True;
exit;//cowardly refuse to continue if (not CurrentPen^.IsNullPen) then
end; gdk_draw_lines(Drawable, GC, PointArray, NumPts);
end else
If CurrentPen^.IsNullPen then begin Result:=false;
Result := True;//not an error
FreeMem(PointArray); //don't forget too free
Exit;//Skip out.
end;
gdk_draw_lines(Drawable, GC, PointArray, NumPts);
FreeMem(PointArray); FreeMem(PointArray);
Result := True;
end; end;
end; end;
end; end;
@ -5226,17 +5205,14 @@ begin
// Draw outline // Draw outline
SelectGDKPenProps(DC); SelectGDKPenProps(DC);
If not IsValidGDIObject(hPen(CurrentPen)) then If (dcfPenSelected in DCFlags) then begin
exit;//cowardly refuse to continue Result := True;
if (not CurrentPen^.IsNullPen) then
If CurrentPen^.IsNullPen then begin gdk_draw_rectangle(Drawable, GC, 0, Left+DCOrigin.X, Top+DCOrigin.Y,
Result := True;//not an error Width, Height);
Exit;//Skip out. end else
end; Result:=false;
gdk_draw_rectangle(Drawable, GC, 0, Left+DCOrigin.X, Top+DCOrigin.Y,
Width, Height);
Result := True;
end; end;
end; end;
Assert(False, Format('trace:< [TgtkObject.Rectangle] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d', [DC, X1, Y1, X2, Y2])); Assert(False, Format('trace:< [TgtkObject.Rectangle] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d', [DC, X1, Y1, X2, Y2]));
@ -5316,8 +5292,11 @@ begin
then aDC.CurrentBitmap := nil; then aDC.CurrentBitmap := nil;
if pSavedDC.CurrentFont = aDC.CurrentFont if pSavedDC.CurrentFont = aDC.CurrentFont
then aDC.CurrentFont := nil; then aDC.CurrentFont := nil;
if pSavedDC.CurrentPen = aDC.CurrentPen if (pSavedDC.CurrentPen = aDC.CurrentPen)
then aDC.CurrentPen := nil; and (aDC.CurrentPen<>nil) then begin
aDC.CurrentPen := nil;
aDC.DCFlags:=aDC.DCFlags-[dcfPenSelected,dcfPenInvalid];
end;
if pSavedDC.CurrentBrush = aDC.CurrentBrush if pSavedDC.CurrentBrush = aDC.CurrentBrush
then aDC.CurrentBrush := nil; then aDC.CurrentBrush := nil;
{if pSavedDC.CurrentPalette = aDC.CurrentPalette {if pSavedDC.CurrentPalette = aDC.CurrentPalette
@ -5408,8 +5387,11 @@ begin
then pSavedDC.CurrentBitmap := nil; then pSavedDC.CurrentBitmap := nil;
if pSavedDC.CurrentFont = aDC.CurrentFont if pSavedDC.CurrentFont = aDC.CurrentFont
then pSavedDC.CurrentFont := nil; then pSavedDC.CurrentFont := nil;
if pSavedDC.CurrentPen = aDC.CurrentPen if (pSavedDC.CurrentPen = aDC.CurrentPen)
then pSavedDC.CurrentPen := nil; and (pSavedDC.CurrentPen<>nil) then begin
pSavedDC.CurrentPen := nil;
pSavedDC.DCFlags:=pSavedDC.DCFlags-[dcfPenInvalid,dcfPenSelected];
end;
if pSavedDC.CurrentBrush = aDC.CurrentBrush if pSavedDC.CurrentBrush = aDC.CurrentBrush
then pSavedDC.CurrentBrush := nil; then pSavedDC.CurrentBrush := nil;
if pSavedDC.CurrentBrush = aDC.CurrentBrush if pSavedDC.CurrentBrush = aDC.CurrentBrush
@ -5686,6 +5668,7 @@ begin
begin begin
Result := HPEN(CurrentPen); Result := HPEN(CurrentPen);
CurrentPen := PGDIObject(GDIObj); CurrentPen := PGDIObject(GDIObj);
DCFlags:=DCFlags-[dcfPenSelected,dcfPenInvalid];
if GC <> nil then SelectGDKPenProps(DC); if GC <> nil then SelectGDKPenProps(DC);
end; end;
gdiRegion: gdiRegion:
@ -7227,6 +7210,9 @@ end;
{ ============================================================================= { =============================================================================
$Log$ $Log$
Revision 1.145 2002/10/07 20:50:59 lazarus
MG: accelerated SelectGDKPenProps
Revision 1.144 2002/10/07 10:55:18 lazarus Revision 1.144 2002/10/07 10:55:18 lazarus
MG: accelerated TDynHashArray MG: accelerated TDynHashArray