Jump to content

При вызове метода DrawLines рисуется лишняя точка в [0,0]


yuri

Recommended Posts

Добрый день,

делаю форму с возможностью масштабирования и рисованием пальцем на TfgPaintbox и наткнулся на такой интересный баг:

Если в событии OnPaint вызвать ACanvas.DrawLines то кроме линии на самих точках всегда рисуется точка в координатах [0,0].

Скорее всего это общая проблема для всех TfgCanvas.

image.thumb.png.adacb6d121f04c68521733dd598e1006.png

Прикрепляю демку с проблемой.

Spoiler
procedure TFormMain.pbSourcePaint(Sender: TObject; const ACanvas: TfgCanvas);
begin
  var vPoints : TfgPoints;

  try
    SetLength(vPoints, 2);

    vPoints[0].SetLocation(150, 150);
    vPoints[1].SetLocation(300, 300);

    ACanvas.Stroke.Thickness := 20;

    ACanvas.DrawLines(vPoints);
  finally
    SetLength(vPoints, 0);
  end;
end;

FGX 1.16.0.1, Delphi 11.3. 

LinesDemo.zip

Link to comment
Share on other sites

3 hours ago, Alan said:

The issue seems to be that SetLength is not doing its job!
When I step through your code    length = 8589934593....

Unfortunately, I don't know why this is happening.

I don't think that you see bug of SetLength, maybe you get bug of debugger, because in real life project i use `for i := 0 to Length(vPoints) - 1` a lot of times and all works fine, but i see same colored pixel[0,0].

Strange issue that applying of ZoomMatrix and TranslationMatrix works with this [0,0] pixel like it's really in vPoints array. So it's definitly somehow related with DrawLines method.

Spoiler

image.thumb.png.9a7bdb82e6bfa6427b30950609ecd55f.png

 

Edited by yuri
Link to comment
Share on other sites

×
×
  • Create New...