On Friday 10 April 2015 19:44:26 misu kun wrote:
> > So the problem is that CPU load goes to 100% if refresh is triggered
> > every 1.6ms?
>
> yes
>
This is normal. There are 625 times per second a read of the pixels from 
pixmap handle (most likely video memory), time consuming sine calculations 
and a write back of the pixels to video memory.
If I replace pixel access by a pixmap fillrect the CPU load goes down to < 1% 
on Linux because it will be handled by the GPU.
"
procedure tmainfo.onpaint(const sender: twidget; const acanvas: tcanvas);
var
 col1: colorty;
begin
 if ready then begin
  if odd(tick) then begin
   col1:= cl_black;
  end
  else begin
   col1:= cl_white;
  end;
  bmp.init(col1);
 end;  
 bmp.paint(acanvas,nullpoint);
end;
"
Graeme, if you read it, above probably affects the fpGUI AggPas canvas too, so 
i don't know if it is a good idea to make it the default.

The reading of the pixel memory can be omitted in the example because the 
whole image will be written:
"
procedure tmainfo.onpaint(const sender: twidget; const acanvas: tcanvas);
var
 x,y: int32;
 ima1: imagety;
 po1: prgbtriplety;
begin
 if ready then begin
  allocimage(ima1,bmp.size,bmk_rgb);
  po1:= pointer(ima1.pixels);
  for y:=0 to bmp.height-1 do begin
   for x:=0 to bmp.width-1 do begin
    longword(po1^):= round(sin((x/16)+tick*0.005) + 
                         sin((y/16)+tick*0.005))*128 ;
    inc(po1);
   end;
  end;
  bmp.loadfromimage(ima1);
  freeimage(ima1);
 end;  
 bmp.paint(acanvas,nullpoint);
end;
"
Martin

------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to