瀏覽代碼

Fix for bug #4218

git-svn-id: trunk@744 -
michael 20 年之前
父節點
當前提交
cf95b53b8f
共有 1 個文件被更改,包括 30 次插入36 次删除
  1. 30 36
      fcl/image/fpcanvas.inc

+ 30 - 36
fcl/image/fpcanvas.inc

@@ -462,14 +462,14 @@ begin
     DoEllipseAndFill (bounds)
   else
     begin
-    if not dp then
+    if p then
       DoEllipse (bounds)
-    else
+    else if dp then
       with bounds do
         TFPCustomDrawPen(Pen).Ellipse (left,top,right,bottom);
-    if not db then
+    if b then
       DoEllipseFill (bounds)
-    else
+    else if db then 
       with bounds do
         TFPCustomDrawBrush(Brush).Ellipse (left,top,right,bottom);
     end;
@@ -491,40 +491,32 @@ begin
 end;
 
 procedure TFPCustomCanvas.Rectangle (const Bounds:TRect);
-var p,b,dp,db,pb : boolean;
+var np,nb,dp,db,pb : boolean;
 begin
-  p := Pen.style <> psClear;
-  b := Brush.style <> bsClear;
-  if p and (pen is TFPCustomDrawPen) then
+  np:= Pen.style <> psClear; // Need pen ?
+  nb:= Brush.style <> bsClear;  // Need brush ?
+  dp:=(pen is TFPCustomDrawPen); // Pen draws ?
+  db:=(brush is TFPCustomDrawBrush); // Brush draws ?
+  if (np and nb) and not (db or db) then
+    DoRectangleAndFill (bounds)
+  else
+    begin
+    if np then
       begin
-      p := false;
-      dp := true;
+      If not dp then
+        DoRectangle (bounds)
+      else
+        with bounds do
+          TFPCustomDrawPen(Pen).Rectangle (left,top,right,bottom);
       end;
-  if b and (brush is TFPCustomDrawBrush) then
+    if Nb then
       begin
-      b := false;
-      db := true;
+      if not db then
+        DoRectangleFill (bounds)
+      else 
+        with bounds do
+          TFPCustomDrawBrush(Brush).Rectangle (left,top,right,bottom);
       end;
-  if p and b then
-    begin
-    p := false;
-    b := false;
-    pb := true;
-    end;
-  if pb then
-    DoRectangleAndFill (bounds)
-  else
-    begin
-    if p then
-      DoRectangle (bounds)
-    else
-      with bounds do
-        TFPCustomDrawPen(Pen).Rectangle (left,top,right,bottom);
-    if b then
-      DoRectangleFill (bounds)
-    else
-      with bounds do
-        TFPCustomDrawBrush(Brush).Rectangle (left,top,right,bottom);
     end;
 end;
 
@@ -544,6 +536,9 @@ var p,b,dp,db,pb : boolean;
 begin
   p := Pen.style <> psClear;
   b := Brush.style <> bsClear;
+  dp:=false;
+  db:=false;
+  pb:=False;
   if p and (pen is TFPCustomDrawPen) then
       begin
       p := false;
@@ -566,11 +561,11 @@ begin
     begin
     if p then
       DoPolygon (points)
-    else
+    else if dp then
       TFPCustomDrawPen(Pen).Polyline (points, true);
     if b then
       DoPolygonFill (points)
-    else
+    else if db then
       TFPCustomDrawBrush(Brush).Polygon (points);
     end;
 end;
@@ -610,4 +605,3 @@ begin
     end;
 end;
 
-