Hi Lazarus developers,
after fighting some time for compiling Lazarus bigide under CentOs 5, I
found that the villain in cairocanvas_pkg.
Lazreports pulls in Printers4lazarus, which in turn pulls in
cairocanvas_pkg, which, just in one place requires cairo_clip_extents,
which is available only since cairo 1.4, while the widely used CentOs 5
provides cairo 1.2. The problem is detected only when linking.
Looking at the code, it turns out that cairo_clip_extents is used to
provide the clipping rectangle (converted from cairo coordinates to
Lazarus coordinates).
But as the clipping rectangle is supplied in Lazarus coordinates, to
start with, and is kept in a TCairoPrinterCanvas field, returning just
the stored field should be enough, thus eliminating the annoying dependency.
My suggested patch:
function TCairoPrinterCanvas.GetClipRect: TRect;
{$ifdef cairo_has_clip_extents} // only available from 1.4
var
x1,y1,x2,y2: double;
begin
RequiredState([csHandleValid]);
// it doesn't matter what the clip is in use, default or user
// this returns always the current clip
cairo_clip_extents(cr, @x1, @y1, @x2, @y2);
result.Left:=round(x1/ScaleX);
result.Top:=round(y1/ScaleY);
result.Right:=round(x2/ScaleX);
result.Bottom:=round(y2/ScaleY);
end;
{$else}
begin
Result := FLazClipRect;
end;
{$endif}
Do I miss something important?
Giuliano
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus