tachart: fix range check errors

git-svn-id: trunk@24811 -
This commit is contained in:
paul 2010-04-22 02:43:25 +00:00
parent 1088982d5b
commit 5451a2e4a3
3 changed files with 17 additions and 0 deletions

View File

@ -323,6 +323,9 @@ implementation
uses
Clipbrd, GraphMath, LCLProc, Math, Types;
{$IFOPT R+}{$DEFINE RangeChecking}{$ELSE}{$UNDEF RangeChecking}{$ENDIF}
{$IFOPT Q+}{$DEFINE OverflowChecking}{$ELSE}{$UNDEF OverflowChecking}{$ENDIF}
function CompareZPosition(AItem1, AItem2: Pointer): Integer;
begin
Result :=
@ -1011,6 +1014,7 @@ procedure TChart.UpdateExtent;
begin
if AUseMin then ALo := AMin;
if AUseMax then AHi := AMax;
{$R-}{$Q-}
case CASE_OF_TWO[ALo = Infinity, AHi = NegInfinity] of
cotNone: begin // Both high and low boundary defined
if ALo = AHi then begin
@ -1030,6 +1034,7 @@ procedure TChart.UpdateExtent;
AHi := DEFAULT_WIDTH / 2;
end;
end;
{$ifdef OverflowChecking}{$Q+}{$endif}{$ifdef RangeChecking}{$R+}{$endif}
end;
var

View File

@ -205,6 +205,9 @@ implementation
uses
LCLIntf, Math, StrUtils;
{$IFOPT R+}{$DEFINE RangeChecking}{$ELSE}{$UNDEF RangeChecking}{$ENDIF}
{$IFOPT Q+}{$DEFINE OverflowChecking}{$ELSE}{$UNDEF OverflowChecking}{$ENDIF}
type
{ TListChartSourceStrings }
@ -573,7 +576,9 @@ begin
FExtent.b.X := Max(FExtent.b.X, Item[i]^.X);
end;
if oldX = FExtent.a.X then begin
{$R-}{$Q-}
FExtent.a.X := Infinity;
{$ifdef OverflowChecking}{$Q+}{$endif}{$ifdef RangeChecking}{$R+}{$endif}
for i := 0 to Count - 1 do
FExtent.a.X := Min(FExtent.a.X, Item[i]^.X);
end;
@ -602,7 +607,9 @@ begin
FExtent.b.Y := Max(FExtent.b.Y, Item[i]^.Y);
end;
if oldY = FExtent.a.Y then begin
{$R-}{$Q-}
FExtent.a.Y := Infinity;
{$ifdef OverflowChecking}{$Q+}{$endif}{$ifdef RangeChecking}{$R+}{$endif}
for i := 0 to Count - 1 do
FExtent.a.Y := Min(FExtent.a.Y, Item[i]^.Y);
end;

View File

@ -171,6 +171,9 @@ uses
ComponentEditors, Forms, GraphMath, Math, PropEdits, SysUtils, Types,
TAChartUtils, TASubcomponentsEditor;
{$IFOPT R+}{$DEFINE RangeChecking}{$ELSE}{$UNDEF RangeChecking}{$ENDIF}
{$IFOPT Q+}{$DEFINE OverflowChecking}{$ELSE}{$UNDEF OverflowChecking}{$ENDIF}
type
{ TToolsComponentEditor }
@ -586,6 +589,7 @@ var
df: TPointDistFunc;
begin
if FChart.ReticuleMode = rmNone then exit;
{$R-}{$Q-}
minDist := Infinity;
df := DIST_FUNCS[FChart.ReticuleMode];
for i := 0 to FChart.SeriesCount - 1 do
@ -605,6 +609,7 @@ begin
if Assigned(FChart.OnDrawReticule) then
FChart.OnDrawReticule(FChart, bestSeries, pointIndex, value);
end;
{$ifdef OverflowChecking}{$Q+}{$endif}{$ifdef RangeChecking}{$R+}{$endif}
end;
{ TZoomClickTool }