[cairo] Delphi: Cairo hardware acceleration

Harald Friedrich harald at ibfriedrich.com
Fri Jan 2 10:49:49 PST 2015


How can I check, whether full hardware acceleration is taking place? I 
want to replace GDI+ in a Delphi project. So I did some testing with 
OpenGL, Andorra2D and Cairo.

My test was drawing 100.000 transparent triangles with different colors.

GDI+ took half a day. Andorra2D was rather slow and DelphiGL was very 
fast (<1sec). Unfortunately the triangles had no anti-aliased edges. In 
contrast Cairo works very well and has a perfect anti-aliased result, 
but it is not as fast as I hoped (12sec). Maybe Cairo in my case is not 
fully hardware accelerated?!?

Here is my source (pb is a TPaintBox on the MainForm):

procedure TfMain.Button1Click(Sender: TObject);
VAR Surface:Pcairo_surface_t;
     cr:Pcairo_t;
     H,W:Double;
     i:LongInt;
begin
   Randomize;
   W:=pb.Width; H:=pb.Height;
surface:=cairo_win32_surface_create_with_dib(CAIRO_FORMAT_ARGB32,pb.Width,pb.Height);
   cr:=cairo_create(surface);
   cairo_set_source_rgba(cr,1,1,1,1); cairo_paint(cr); {White background}
   FOR i:=0 TO 100000 DO BEGIN
     cairo_set_source_rgba(cr,Random,Random,Random,Random);
     cairo_move_to(cr,Random*W,Random*H);
     cairo_line_to(cr,Random*W,Random*H);
     cairo_line_to(cr,Random*W,Random*H);
     cairo_fill(cr);
   END;
   cairo_destroy(cr);
BitBlt(pb.Canvas.Handle,0,0,pb.Width,pb.Height,cairo_win32_surface_get_dc(surface),0,0,SRCCOPY);
   cairo_surface_destroy(surface);
end;

How can I check whether I have full hardware acceleration? Or how can I 
switch it on?

I use Delphi 7 on Win 7 on a Radeon HD 6450.

Thanks for any hints!

HarryF

P.S.: How can I search this mailinglist?



More information about the cairo mailing list