TurboPack / SynEdit

SynEdit is a syntax highlighting edit control, not based on the Windows common controls.
216 stars 72 forks source link

Exception when printing #226

Closed BorisU7 closed 1 year ago

BorisU7 commented 1 year ago

When I try to print the contents of my editor with this simple code

  SynEditPrint.SynEdit := Editor;
  SynEditPrint.Print;

I get the following exception image

It is generated at line 602 of SynEditPrint.pas

      GDIRT := RT as ID2D1GdiInteropRenderTarget;
      CheckOSError(GDIRT.GetDC(D2D1_DC_INITIALIZE_MODE_COPY, SourceDC));

Win10 latest, both Delphi 10.1 and 11, printer is MS PDF

BorisU7 commented 1 year ago

Now I am completely lost .... I have this exception when I statically link my program. And everything is fine when I compile it with the external .bpl' s Any ideas what is going on?

pyscripter commented 1 year ago

I am afraid not. I will have to look into this. Does the problem occur only when printing to PDF?

BorisU7 commented 1 year ago

Adobe PDF doesn't produce output but no exception? So the problem probably still there. HP LJ shows the same exception on the other computer.

BorisU7 commented 1 year ago

I seem to have found the source of the problem. I was using the GPUSupport define in my static build. The .bpl was compiled with the default settings without it. When I removed the definition from the static build, printing goes fine.

pyscripter commented 1 year ago

Aha! One more reason GPUSupport should be disabled. If it works well with GPUSupport disabled please close the issue.

BorisU7 commented 1 year ago

I have a decent GPU in my main computer (GeForce 2080S), so I assumed this define wouldn't hurt anything :) BTW do you have any test program to compare the speed of screen render with this option on/off? I'm just curious if it's really worth it?

pyscripter commented 1 year ago

No, but earlier testing with svgs and DirectDraw showed a slow down with GPU support. I think the benefits of GPU support are apparent in more graphics intensive applications (games).