Hi,

In the last month I was looking in to making GS's drawing output match cocoa 
exactly, in particular, getting rid of rounding in the backends. 

One of the problems I encountered is GS can give autoresizing views fractional 
positions/sizes, whereas when Cocoa autoresizes views it only ever sizes them 
to pixel-aligned rects. The problem with GS's current behaviour is it will make 
UI elements blurry if we get rid of rounding in the backend. 

Attached is a preliminary patch* which switches to Cocoa's behaviour. I wanted 
to ask for feedback as to whether this is a reasonable patch to apply.

The patch has to do a bit more than simply adding rounding to - (void) 
resizeWithOldSuperviewSize: (NSSize)oldSize, because if we just round _frame, 
we will lose track of where a view originally was. I add a new ivar 
_autoresizingFrameError which stores the difference between the rounded _frame, 
and what _frame would be without rounding. The only slightly messy bit of the 
patch is that any parts of the code that modify _frame directly should also set 
_autoresizingFrameError to {0, 0}.

Thanks,
Eric

Attachment: AutoresizeRoudning1.diff
Description: Binary data


[*] One thing I would change in the patch is instead of rounding using floor(), 
I would call -centerScanRect: so that the pixel-alignment takes in to account 
the transformation matrix of the current view.
_______________________________________________
Gnustep-dev mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to