On Mon, 12 Dec 2005 16:11:47 -0200
Felipe Monteiro de Carvalho <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I am finishing the conversion of a win32 app to gtk. Everything goes 
> fine, except that I need to substitute win api calls to StretchBlt with 
> something else.
> 
> So I thought about using LCLIntf.StretchBlt. I used it just like I was 
> using on Windows:
> 
>      LCLIntf.StretchBlt(DestCanvas.Handle, GlassLeft + 4, GlassTop + 4,
>       GlassWidth - 8, GlassHeight - 8,
>       bmpDisplay.Canvas.Handle, ScreenRect.Left, ScreenRect.Top,
>       ScreenRect.Right - ScreenRect.Left, ScreenRect.Bottom - 
> ScreenRect.Top, SRCCOPY);

I didn't had the time to look deeper into the issue. But I will give some
generic tips.

 
> Works well on Windows, but on Linux I get many gtk error messages, like 
> this:
> 
> > [CRITICAL] file gdk-pixbuf-drawable.c: line 1109
> > (gdk_pixbuf_get_from_drawable):
> >  assertion `dest_x == 0 && dest_y == 0' failed.
> > WARNING: ScalePixmap ScaleSRC=nil
> > WARNING: ScaleAndROP ScalePixmap for pixmap failed
> > WARNING: SrcDevBitmapToDrawable: ScaleAndROP failed

Run with --g-fatal-warnings in gdb. Then you will get the exact point, where
the gtk gets the wrong parameters.
This can help us to track down the bug.

 
> So I tryed to investigate what happens with LCLIntf.StretchBlt. I say 
> the implementation on gtk, didn't understang much about it, but I found 
> many places checking the -dVerboseStretchCopyArea define for debugging.
> 
> Then I tryed to compile Lazarus with -dVerboseStretchCopyArea, figuring 
> this could give me a clue about what is going on. It won't compile 
> (latest subversion). I got lot's of errors complaining about argument 
> number, received Integer, but expected ansistring and received boolean 
> but expected ansistring on DebugLn.

Commented debugging stuff is not supported.
I fixed it.

 
> I surounded all Integer with IntToStr(), commented out the Booleans ( 
> How do I transform a boolean to string easely???) and got it to compile.

Just enclose everything with dbgs(). They are defined for all base types and
some more.

 
> Now, I can make a patch with this, but I am not sure if the DebugLn 
> function shouldn't be corrected to accept integers and booleans instead 
> of trying to use hundreds of IntToStr() ...

It's only debugging stuff. Don't spend much time to 'correct' such things.

 
> Here is a sample of one of the debug lines got after I edited it:
> 
>      {$IFDEF VerboseStretchCopyArea}
>      DebugLn('StretchCopyArea Cliping Src to left NewSrcWidth=',
>       IntToStr(NewSrcWidth),' NewWidth=',IntToStr(NewWidth));
>      {$ENDIF}
> 
> 
> Now, going back to my application, I got the LCL to compile with 
> VerboseStretchCopyArea, but now there are lot's of messages, lot's 
> really lot's and I don't know what should be right and wrong ....
> 
> The best thing I can think of is: My pictures are bitmap, but I should 
> be working with Pixmaps on GTK. Is this correct???

Don't confuse gtk 'Pixmaps' and TPixmap.
A gtk pixmap corresponds to the winapi bitmap. It's the memory format of
images of the widgetset.
When the LCL loads a .bmp/.xpm/.png ... it converts the file format to the
memory image format of the current widgetset. That means gdk pixmap/image
for a gtk application, and bitmap for a winapi application.


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to