[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Pixel-aligned autoresizing
From: |
Eric Wasylishen |
Subject: |
Pixel-aligned autoresizing |
Date: |
Tue, 5 Jul 2011 14:15:04 -0600 |
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
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.
- Pixel-aligned autoresizing,
Eric Wasylishen <=
- Re: Pixel-aligned autoresizing, Fred Kiefer, 2011/07/06
- Re: Pixel-aligned autoresizing, Jens Ayton, 2011/07/06
- Re: Pixel-aligned autoresizing, Eric Wasylishen, 2011/07/06
- Re: Pixel-aligned autoresizing, Fred Kiefer, 2011/07/06
- Re: Pixel-aligned autoresizing, Eric Wasylishen, 2011/07/07
- Re: Pixel-aligned autoresizing, Fred Kiefer, 2011/07/07
- Re: Pixel-aligned autoresizing, Eric Wasylishen, 2011/07/08
- Re: Pixel-aligned autoresizing, Fred Kiefer, 2011/07/08
- Re: Pixel-aligned autoresizing, Eric Wasylishen, 2011/07/08
- Re: Pixel-aligned autoresizing, Fred Kiefer, 2011/07/08