Jump to content

dormky

Members
  • Content Count

    160
  • Joined

  • Last visited

Community Reputation

5 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. dormky

    What could I use to draw custom graphs ?

    Jesus I just tested for benchmarking's sake and not using Polydraw is easily a x5 improvement 😭 What the hell
  2. dormky

    What could I use to draw custom graphs ?

    I need to be able to draw data points as both a continuous line and separate points ; I do remove points that aren't far enough from the previous point to produce a change (I simply check that the difference is superior to half of what a pixel is worth). If I don't do that I'm looking at like 200ms easily lol. For reference, my test data is a 12k points sine wave. I also keep a buffer of the whole background, axis etc. to not redraw them everytime. It's just the data.
  3. dormky

    What could I use to draw custom graphs ?

    I'm drawing to a TBitmap as a buffer, and then using Canvas.Draw().
  4. dormky

    What could I use to draw custom graphs ?

    80% is calling PolyDraw. PolyDraw gets me the best GDI performance, but there might be other ways to handle things in GDI ? Don't forget that I'm doing this on a full screen (1440x2560) and that it seems to scale linearly with display size.
  5. dormky

    What could I use to draw custom graphs ?

    Yeah, I completely forgot about Skia. Seems like there's a Skia4Delphi community project, will give it a try some time this week hopefully. Thank you !
  6. dormky

    What could I use to draw custom graphs ?

    Main bottleneck is the repeated calls to the gdi canvas to draw lines. I have code that prevents drawing unnecessarily (ie check if 2 points are far enough apart that they won't get resolved to the same coordinates) and this reduces the time proportionally to the size of the canvas used.
  7. dormky

    What could I use to draw custom graphs ?

    Would TeeChart allow me to draw arbitrary shapes onto the graph ? From what I've this doesn't seem to be the case but I might have missed something. I need complete control over how the axis are laid out etc. Although if you know what exactly TeeChart uses under the hood that might point me in the right direction.
  8. dormky

    What could I use to draw custom graphs ?

    Quickly yes, quickly enough no. And I'm already using things like Polyline and caching to reduce syscalls.
  9. dormky

    What could I use to draw custom graphs ?

    I did, but performance wasn't that much better, only 50 % 😕 And that's discounting a bunch of issues I've had making it work (it's still not a one-to-one of what I get with GDI, while OpenGL is and didn't cause me implementation issues)
  10. I'm drawing custom graphs, for now using GDI. Here's an example from a test project : It's a mess but that's because I'm testing as many possibilities as I can with the management of the axis. One problem that I'm running into is performance : 50ms to draw. This is annoying because it makes the graph jittery when dragging elements (lines and rectangles must be able to be moved by the user). I've made modifications so that it can be rendered by OpenGL, which is obviously MUCH faster (<8ms without looking very much at other performance improvements). Unfortunately initializing OpenGL takes multiple seconds. This is fine when you're running a game, but I have forms with 12 of these graphs on screen at the same time, all showing different stuff... So yeah. Is there any rendering engine on Windows that's got equivalent functionnality to GDI, but is just faster by vertue of using the GPU ? Any alternatives to consider ?
  11. dormky

    MyDAC blob from PDF

    query := TMyQuery.Create(nil); query.Connection := conn; query.SQL.Text := 'INSERT INTO documents (key, document) VALUES (:pkey, :pdocument)'; query.ParamByName('pkey').Value := 'key'; query.ParamByName('pdocument').AsBytes := TFile.ReadAllBytes('dummy_1.pdf'); query.Execute(); query.Free(); CREATE TABLE `documents` ( `key` VARCHAR(255) NOT NULL, `document` MEDIUMBLOB); The pdf file : https://www.cte.iup.edu/cte/Resources/PDF_TestPage.pdf For some reason, without the key field this works perfectly fine, but with it I get the error : EMySqlException with message '#42000You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key, document) VALUES ('key', '%PDF-1.4\n%äüöß\n2 0 obj\n<</Length 3 0 R/Fil' at line 1'. Does anyone have any idea of what forsaken bullshit is going on ? It doesn't look like an escape character issue AFAIK as the problem occurs whether the key parameter is in front of the document parameters or after it. I think it's because delphi is casting the pdf file as text but I'm not sure. Edit : I'm blind. Since MyDAC forces you to write SQL statements by hand, I forgot about the `. Gotta hate on bad error messages 🙂
  12. dormky

    MyDAC copy to another DB

    You mean that MySQL can transfer data directly from one server to the other ? I'm not talking about doing replication, this is for select rows
  13. dormky

    MyDAC copy to another DB

    The databases aren't on the same server. Obviously if that was the case this would be trivial
  14. dormky

    MyDAC copy to another DB

    So I need to copy the contents of one table to another database. But it seems changing the Connection on a TMyQuery erases the data stored in it. Any alternatives that do not require creating a TMyTable ?
  15. dormky

    Anonymous instance methods

    Figured that anonymous methods on instance procedures such as OnClick was actually possible with this little tick : type // Allows instance anonymous procs by giving it to the constructor here and giving OnSender to the OnClick event for example // You need to give the instance on which the OnSender will be attributed so the object gets garbage-collected. // MyButton.OnClick := TAnonProc.Create(MyButton, procedure (Sender: TObject) begin /* */ end).OnSender; TAnonProc = class(TComponent) proc: TProc<TObject>; constructor Create(AOwner: TComponent; AProc: TProc<TObject>); reintroduce; procedure OnSender(Sender: TObject); end; constructor TAnonProc.Create(AOwner: TComponent; AProc: TProc<TObject>); begin inherited Create(AOwner); proc := AProc; end; procedure TAnonProc.OnSender(Sender: TObject); begin if Assigned(proc) then proc(Sender); end;
×