bugGNUstep - Bugs: bug #40776, NSClipView should redraw when...

Group
 
 

bug #40776: NSClipView should redraw when bounds change

Submitter:  Jeff Teunissen <Deek>
Submitted:  Mon 02 Dec 2013 04:07:18 PM UTC
   
 
Category:  Gui/AppKit Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  FredKiefer
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 08 Dec 2013 10:34:25 PM UTC, comment #7: 

Or, perhaps, using NSUnionRect(b, oldBounds) and converting to figure out the actual dirty rect.

Jeff Teunissen <Deek>
Sun 08 Dec 2013 07:29:28 PM UTC, comment #6: 

Indeed, -documentVisibleRect is in the document view's coordinate system, I failed to notice that when I replaced [self setNeedsDisplay: YES] with it, and it still /seemed to/ work correctly, so I left it alone.

If you want to only redraw the whole clip view when the document view shrinks, then one could do

:
:
NSRect oldBounds = [self bounds];
[super setBounds: b];
if (NSContainsRect(b, oldBounds))
  {
    [_documentView setNeedsDisplayInRect: [self documentVisibleRect]];
  }
else
  {
    [self setNeedsDisplay: YES];
  }
:
:

but that may be overkill, and just easier to always redraw when the bounds change.

Jeff Teunissen <Deek>
Sun 08 Dec 2013 02:15:47 PM UTC, comment #5: 

You screen shot shows the problem quite clearly.

Your original proposal is still wrong though, there you use the documentVisibleRect to invalidate self, which is missing two different coordinate systems. Converting documentVisibleRect back to self gives _bounds, which is the same as calling [self setNeedsDisplay: YES]. And I prefer to use that instead.

I am not happy with that change, but in the end we might end up with adding that call in NSView setBounds: anyway. Why not start doing it here.

Fred Kiefer <FredKiefer>
Group Member
Sun 08 Dec 2013 12:48:41 AM UTC, comment #4: 

Yes, I'm sure. In the attached screenshot, I set the zoom factor to 200% (which redrew to fill the window, as it should), then set it back to zero, which then resulted in a redrawing of the document view...leaving the portions of the clip view not covered by the document view unchanged.

If the new bounds are not a superset of the old bounds, then the clipview itself must be redrawn. Only if the new bounds are strictly greater than the old ones can you get away with not redrawing the clipview itself.



Jeff Teunissen <Deek>
Sat 07 Dec 2013 04:29:33 PM UTC, comment #3: 

Could you please try the code and see if the problem you are expecting really occures?
I would like to have the code in setBounds: and setBoundsSize: in line with the code in the method setBoundsOrigin: and there we only set the _documentView as needing redisplay. This may be wrong, but we never had a bug report on this and that code has been in GNUstep for a long time. For this reason I would only like to change this, if there is a proven problem with it.

I moved this bug report back to open to make it easier to find for others interested.

Fred Kiefer <FredKiefer>
Group Member
Wed 04 Dec 2013 01:21:40 AM UTC, comment #2: 

I don't think that will work out very well.

When doing the patch, the very first thing I tried was marking only the document view as needing display, but the document view does not have to fill the clipview.

Because of this fact, there may be quite a lot of area that /was/ covered by the document view that no longer is.

If you have a 1000x1000 documentview and scale or otherwise resize it to 100x100, telling the documentview to redraw will only redraw the 100x100 area the documentview now fills, leaving the rest of the clipview unchanged (even though it's still full of the clipview's former contents).

That's why the clipview (and the documentview inside it, but that's handled anyway) needs to be redrawn.

Jeff Teunissen <Deek>
Tue 03 Dec 2013 10:18:59 PM UTC, comment #1: 

Thank you for the bug report and the patch. I committed a slightly modified version of your patch. Please give it a try.

Fred Kiefer <FredKiefer>
Group Member
Mon 02 Dec 2013 04:07:18 PM UTC, original submission:  

When changing zoom factor, TextEdit just changes the clipview's bounds, on the assumption that the clipview will automatically mark itself as needing display. GNUstep's doesn't, so the display is messed up until the user scrolls.

Patch attached, pulled out of my tree.

Jeff Teunissen <Deek>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #29804:  ClipView-drawing.png added by Deek (171KiB - image/png)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by FredKiefer (Posted a comment)
  • -email is unavailable- added by Deek (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-01-23 FredKiefer StatusReady For Test Fixed
        Open/ClosedIn Test Closed
    2013-12-08 FredKiefer Open/ClosedOpen In Test
    2013-12-08 Deek Attached File- Added ClipView-drawing.png, #29804
    2013-12-07 FredKiefer Open/ClosedIn Test Open
    2013-12-03 FredKiefer StatusNone Ready For Test
        Assigned toNone FredKiefer
        Open/ClosedOpen In Test
    2013-12-02 Deek Attached File- Added 0001-NSClipView-redraw-when-bounds-size-changes.patch, #29754

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code