Hi, I'm on MacOSX 10.5.8, and Lazarus 0.9.29 (r27648M, i386-darwin-carbon(beta)).
I often use InvalidateRect to speed up things, and do drawings on a canvas limited with a rect, so I like to use the Canvas.ClipRect on a paint event, but the function TCarbonDeviceContext.GetClipRect uses the CGContextGetClipBoundingBox to return the rect of a clipping area. Result := CGRectToRect(CGContextGetClipBoundingBox(CGContext)); I read somewhere on Apple Mailings Lists that due to the way it is implemented (not in Lazarus), it will often return a rect that is much larger than the actual bounds of a clipping shape - which always is the case on a paint event after an InvalidateRect. I also read that I could use HIShapeGetBounds on a HIShapeRef in kEventParamShape to get the bounds of the dirty area, but before I can do that I also need to call GetEventParameter with an EventRef, which I don't have because I use OnPaint/Paint to do the drawings, and I only have access to a TCanvas. I tried to add a few lines of test codes in the CarbonCommon_Draw() to see if I could get a rect I could save somewhere, but none of the rects from HIShapeGetBounds returned recognizable rectangles. I might be using these in a wrong way: var FShape: HIShapeRef; FRect: TRect; FHIRect: HIRect; ... GetEventParameter(AEvent, kEventParamShape, typeHIShapeRef, nil, SizeOf(FShape), nil, @FShape); HIShapeGetBounds(FShape, FHIRect); FRect := CGRectToRect(FHIRect); ... I also don't have any idea how to redirect this FRect to the OnPaint event, but since it don't return a rect I invalidated, I haven't look at this yet. The InvalidateRect truly invalidate a rectangle with right dimensions (only a partial area of the canvas is paintable). Any ideas on how to implement Canvas.ClipRect with correct rects? Best regards, Normann -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
