[patch #6630] Patch to always check -isFlipped as Cocoa does rather than accessing the flag directly

View: New views
4 Messages — Rating Filter:   Alert me  

[patch #6630] Patch to always check -isFlipped as Cocoa does rather than accessing the flag directly

by Diego Sevilla Ruiz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


URL:
  <http://savannah.gnu.org/patch/?6630>

                 Summary: Patch to always check -isFlipped as Cocoa does
rather than accessing the flag directly
                 Project: GNUstep
            Submitted by: qmathe
            Submitted on: mer 03 sep 2008 17:53:02 GMT
                Category: AppKit
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Here is a patch to ensure the flipping is always determined by calling
-isFlipped as Cocoa does instead of accessing _rFlags.flipped_view.

To take a concrete example… If an NSView subclass adds a setter
-setFlipped: and stores the flipping value in a subclass specific ivar
(instead of _rFlags.flipped_view), then -setFlipped: YES isn't handled
properly: the drawing and the resizing could behave in a really weird way.
GNUstep has this problem because it caches -isFlipped in the initializer, then
accesses the flipping value through the _rFlags.

My current workaround to this solution is to access _rFlags.flipped_view
directly on GNUstep. But this patch would eliminate this need and make GNUstep
AppKit matches Cocoa behavior.

Quentin.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: mer 03 sep 2008 17:53:02 GMT  Name: NSView-flipping.m.patch  Size: 863
o   By: qmathe

<http://savannah.gnu.org/patch/download.php?file_id=16424>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?6630>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@...
http://lists.gnu.org/mailman/listinfo/bug-gnustep

[patch #6630] Patch to always check -isFlipped as Cocoa does rather than accessing the flag directly

by Diego Sevilla Ruiz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #1, patch #6630 (project gnustep):

Your patch removes only two usages of this flag from the code. I am not sure,
whether this approach would create even more problems in the long run.
Shouldn't we remove this optimisation completely?

Nicola, what is your opinion here, if I remember correctly it was you how
introduced this bit.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?6630>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@...
http://lists.gnu.org/mailman/listinfo/bug-gnustep

[patch #6630] Patch to always check -isFlipped as Cocoa does rather than accessing the flag directly

by Diego Sevilla Ruiz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #2, patch #6630 (project gnustep):

Well ... I don't remember much about this, so I can only state the obvious
...

how often would -isFlipped be called when a standard window is drawn ?  Is
it 10 times, 1k times, 10k times ?  That gives you an idea of how important
it would be to keep the optimization ...

If the optimization is useful, then maybe you could compute the flag once
at the beginning of each draw cycle ?

Anyway my guess is that it's quite likely that the optimization can go away
without any noticeable impact on the performance, but it's worth checking

Thanks

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?6630>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@...
http://lists.gnu.org/mailman/listinfo/bug-gnustep

[patch #6630] Patch to always check -isFlipped as Cocoa does rather than accessing the flag directly

by Diego Sevilla Ruiz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Follow-up Comment #3, patch #6630 (project gnustep):

Good point. I would expect that the optimisation is used less then five times
per drawing request on each view. But it will be hard to count.

A grep on flipped_view shows that this mostly is used for NSScrollView and
there is another hack in place for NSClipView.
(Apart from the usage in NSView and one marginal case in NSSplitView) Only
the usage in NSView could be performance critical, as far as I can tell.

My current idea is to set this variable in _rebuildCoordinates, that way we
have the correct value and as long as nothing changes the method wont get
called.

Still, if the ivar only gets used as little as we all expect, we might as
well remove it.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/patch/?6630>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/



_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@...
http://lists.gnu.org/mailman/listinfo/bug-gnustep
LightInTheBox - Buy quality products at wholesale price!