NSTableView blurry contents

  • Hi,

    I have an NSTableView in my app in which the contents blur when
    scrolled. I don't mean that they blur from movement, but that they
    actually distort and remain distorted afterwards. I posted some
    screenshots at http://www.psatellite.com/table_bug/

    I would really like some insight into what could be going on here...

    Thanks,

    Wil
  • That is very strange.. can you isolate that behavior in a simple app?
    If so, let me know.

    --corbin

    Am Aug 17, 2005 um 7:29 AM schrieb William Turner:

    > I have an NSTableView in my app in which the contents blur when
    > scrolled. I don't mean that they blur from movement, but that they
    > actually distort and remain distorted afterwards. I posted some
    > screenshots at http://www.psatellite.com/table_bug/
    >
  • > I have an NSTableView in my app in which the contents blur when
    > scrolled. I don't mean that they blur from movement, but that they
    > actually distort and remain distorted afterwards. I posted some
    > screenshots at http://www.psatellite.com/table_bug/
    >
    > I would really like some insight into what could be going on here...

    This happens when a views frame is set to non integer values. I can't
    say exactly where the problem is, but I think that's what you should
    look for. Probably there is somewhere in your code where you are
    calling setFrame and you need to first call floor() or ceil() on the
    rectangle values to validate them.

    Jesse
  • Thanks Jesse - that was it! I floor'd all the elements of the frame
    and the problem is gone. Nifty. Do you - or does anyone - know why
    that has to be? Just curious.

    Thanks for all the speedy responses :)

    Wil

    On Aug 17, 2005, at 11:37 AM, Jesse Grosjean wrote:

    >> I have an NSTableView in my app in which the contents blur when
    >> scrolled. I don't mean that they blur from movement, but that they
    >> actually distort and remain distorted afterwards. I posted some
    >> screenshots at http://www.psatellite.com/table_bug/
    >>
    >> I would really like some insight into what could be going on here...
    >
    > This happens when a views frame is set to non integer values. I
    > can't say exactly where the problem is, but I think that's what you
    > should look for. Probably there is somewhere in your code where you
    > are calling setFrame and you need to first call floor() or ceil()
    > on the rectangle values to validate them.
    >
    > Jesse
  • On Aug 17, 2005, at 8:55 AM, William Turner wrote:
    > Thanks Jesse - that was it! I floor'd all the elements of the frame
    > and the problem is gone. Nifty. Do you - or does anyone - know why
    > that has to be? Just curious.

    Scrolling normally performs a bitmap-copy of the existing ClipView
    contents, so that the document view will only need to be asked to
    draw the newly revealed portion of its content.  For this
    optimization to work correctly, the ClipView needs to be aligned on
    pixel boundaries.  (It's enough to pixel-align the ScrollView; the
    ClipView will follow suit.)

    Guaranteeing pixel alignment is generally the best thing to do.  As
    an alternative, however, you could also send "setCopiesOnScroll:NO"
    to the ClipView, which disables the bitmap-copy optimization (meaning
    the entire ClipView content will need to be redrawn on each scroll
    step), but will eliminate the blurred drawing.

    --
    Troy Stephens
    Cocoa Frameworks
    Apple Computer, Inc.
  • Ah, that makes sense - thanks for the explanation.

    On Aug 17, 2005, at 2:20 PM, Troy Stephens wrote:

    > On Aug 17, 2005, at 8:55 AM, William Turner wrote:
    >
    >> Thanks Jesse - that was it! I floor'd all the elements of the
    >> frame and the problem is gone. Nifty. Do you - or does anyone -
    >> know why that has to be? Just curious.
    >>
    >
    > Scrolling normally performs a bitmap-copy of the existing ClipView
    > contents, so that the document view will only need to be asked to
    > draw the newly revealed portion of its content.  For this
    > optimization to work correctly, the ClipView needs to be aligned on
    > pixel boundaries.  (It's enough to pixel-align the ScrollView; the
    > ClipView will follow suit.)
    >
    > Guaranteeing pixel alignment is generally the best thing to do.  As
    > an alternative, however, you could also send "setCopiesOnScroll:NO"
    > to the ClipView, which disables the bitmap-copy optimization
    > (meaning the entire ClipView content will need to be redrawn on
    > each scroll step), but will eliminate the blurred drawing.
    >
    > --
    > Troy Stephens
    > Cocoa Frameworks
    > Apple Computer, Inc.
    >
    >
    >
  • I get this in Mail on 10.3.9 when scrolling the main email list whilst
    Mail is busy downloading new emails.

    - Tim

    On 18/08/2005, at 1:34 AM, Corbin Dunn wrote:

    > That is very strange.. can you isolate that behavior in a simple app?
    > If so, let me know.
    >
    > --corbin
    >
    > Am Aug 17, 2005 um 7:29 AM schrieb William Turner:
    >
    >> I have an NSTableView in my app in which the contents blur when
    >> scrolled. I don't mean that they blur from movement, but that they
    >> actually distort and remain distorted afterwards. I posted some
    >> screenshots at http://www.psatellite.com/table_bug/
    >>
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/
    > <t.lucas...>
    >
    > This email sent to <t.lucas...>
    >
  • >>> I have an NSTableView in my app in which the contents blur when
    >>> scrolled. I don't mean that they blur from movement, but that they
    >>> actually distort and remain distorted afterwards. I posted some
    >>> screenshots at http://www.psatellite.com/table_bug/
    > I get this in Mail on 10.3.9 when scrolling the main email list whilst
    > Mail is busy downloading new emails.

    I lie. It's not a blur, its whole square chunks of display... looks
    like a drawing rect problem.

    - tim
  • On Aug 17, 2005, at 16:29:12, William Turner wrote:
    > I have an NSTableView in my app in which the contents blur when
    > scrolled. I don't mean that they blur from movement, but that they
    > actually distort and remain distorted afterwards. I posted some
    > screenshots at http://www.psatellite.com/table_bug/
    >
    > I would really like some insight into what could be going on here...

    Wil,

      looks suspiciously like something else is weird here. Make sure
    your app doesn't have any zombies (in particular that you haven't
    released your data source while it's still registered with the table
    view -- delegates are never released to avoid retain circles). Also
    make sure you're only making your calls to the table view from the
    main thread. Those are the most common reasons for unexpected
    transparency and smears.

    Cheers,
    -- M. Uli Kusterer
    http://www.zathras.de