Try it now (#115)

Signed-off-by: Laentir Valetov <laex@bk.ru>
This commit is contained in:
Laentir Valetov 2019-03-04 21:31:03 +04:00
parent bf6d45180f
commit 13a0a73d96
2 changed files with 9 additions and 8 deletions

View File

@ -334,7 +334,7 @@ Type
TocvDataReceiver = class(TComponent, IocvDataReceiver) TocvDataReceiver = class(TComponent, IocvDataReceiver)
private private
FocvVideoSource: IocvDataSource; [weak] FocvVideoSource: IocvDataSource;
protected protected
procedure SetVideoSource(const Value: TObject); virtual; procedure SetVideoSource(const Value: TObject); virtual;
procedure SetOpenCVVideoSource(const Value: IocvDataSource); virtual; procedure SetOpenCVVideoSource(const Value: IocvDataSource); virtual;
@ -348,7 +348,7 @@ Type
TocvDataSourceAndReceiver = class(TocvDataSource, IocvDataReceiver) TocvDataSourceAndReceiver = class(TocvDataSource, IocvDataReceiver)
private private
FocvVideoSource: IocvDataSource; [weak] FocvVideoSource: IocvDataSource;
protected protected
procedure SetVideoSource(const Value: TObject); virtual; procedure SetVideoSource(const Value: TObject); virtual;
procedure SetOpenCVVideoSource(const Value: IocvDataSource); virtual; procedure SetOpenCVVideoSource(const Value: IocvDataSource); virtual;

View File

@ -85,7 +85,7 @@ type
TocvViewFrame = class(TCollectionItem, IocvDataReceiver) TocvViewFrame = class(TCollectionItem, IocvDataReceiver)
private private
FocvVideoSource: IocvDataSource; [weak] FocvVideoSource: IocvDataSource;
FImage: IocvImage; FImage: IocvImage;
FLock: TCriticalSection; FLock: TCriticalSection;
FDrawRect: TocvPersistentRect; FDrawRect: TocvPersistentRect;
@ -113,7 +113,7 @@ type
TocvView = class(TWinControl, IocvDataReceiver) TocvView = class(TWinControl, IocvDataReceiver)
private private
FocvVideoSource: IocvDataSource; [weak] FocvVideoSource: IocvDataSource;
FImage: IocvImage; FImage: IocvImage;
FOnAfterPaint: TOnOcvAfterViewPaint; FOnAfterPaint: TOnOcvAfterViewPaint;
FOnBeforePaint: TOnOcvNotify; FOnBeforePaint: TOnOcvNotify;
@ -180,8 +180,9 @@ end;
destructor TocvView.Destroy; destructor TocvView.Destroy;
begin begin
if Assigned(FocvVideoSource) then // if Assigned(FocvVideoSource) then
FocvVideoSource.RemoveReceiver(Self); // FocvVideoSource.RemoveReceiver(Self);
VideoSource := nil;
FCanvas.Free; FCanvas.Free;
FFrames.Free; FFrames.Free;
inherited; inherited;
@ -191,10 +192,10 @@ procedure TocvView.SetOpenCVVideoSource(const Value: IocvDataSource);
begin begin
if FocvVideoSource <> Value then if FocvVideoSource <> Value then
begin begin
if Assigned(FocvVideoSource) then if Assigned(FocvVideoSource) and (not(csDesigning in ComponentState)) then
FocvVideoSource.RemoveReceiver(Self); FocvVideoSource.RemoveReceiver(Self);
FocvVideoSource := Value; FocvVideoSource := Value;
if Assigned(FocvVideoSource) then if Assigned(FocvVideoSource) and (not(csDesigning in ComponentState)) then
FocvVideoSource.AddReceiver(Self); FocvVideoSource.AddReceiver(Self);
end; end;
end; end;