[haiku-commits] haiku: hrev53932 - src/servers/app

  • From: waddlesplash <waddlesplash@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 1 Mar 2020 16:09:47 -0500 (EST)

hrev53932 adds 1 changeset to branch 'master'
old head: ab319eb798f7b3bd9ed7a7dcc01f626fdd1e75e3
new head: 0d312fea71ad67c08d8d99299d2717ecaa9548df
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=0d312fea71ad+%5Eab319eb798f7

----------------------------------------------------------------------------

0d312fea71ad: app_server: Reduce usage of the RegionPool where unnecessary.
  
  BRegions with only 1 rectangle will use inline data and perform
  no allocations, so when we create a BRegion and only add
  one rect to it, we can just use one inline and avoid using
  the pool entirely at no cost (and some savings.)
  
  No functional change (intended).
  
  Change-Id: I10ac6bc7b5cf6b681641e88558a3f1ba770b6f77
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/2298
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53932
Commit:      0d312fea71ad67c08d8d99299d2717ecaa9548df
URL:         https://git.haiku-os.org/haiku/commit/?id=0d312fea71ad
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Mar  1 02:19:07 2020 UTC
Committer:   waddlesplash <waddlesplash@xxxxxxxxx>
Commit-Date: Sun Mar  1 21:09:41 2020 UTC

----------------------------------------------------------------------------

1 file changed, 15 insertions(+), 24 deletions(-)
src/servers/app/View.cpp | 39 +++++++++++++++------------------------

----------------------------------------------------------------------------

diff --git a/src/servers/app/View.cpp b/src/servers/app/View.cpp
index 8964810b19..70ea9b0419 100644
--- a/src/servers/app/View.cpp
+++ b/src/servers/app/View.cpp
@@ -277,12 +277,10 @@ View::AddChild(View* view)
                        // trigger redraw
                        IntRect clippedFrame = view->Frame();
                        ConvertToVisibleInTopView(&clippedFrame);
-                       BRegion* dirty = fWindow->GetRegion();
-                       if (dirty) {
-                               dirty->Set((clipping_rect)clippedFrame);
-                               fWindow->MarkContentDirtyAsync(*dirty);
-                               fWindow->RecycleRegion(dirty);
-                       }
+
+                       BRegion dirty;
+                       dirty.Set((clipping_rect)clippedFrame);
+                       fWindow->MarkContentDirtyAsync(dirty);
                }
        }
 }
@@ -333,12 +331,10 @@ View::RemoveChild(View* view)
                        // trigger redraw
                        IntRect clippedFrame = view->Frame();
                        ConvertToVisibleInTopView(&clippedFrame);
-                       BRegion* dirty = fWindow->GetRegion();
-                       if (dirty) {
-                               dirty->Set((clipping_rect)clippedFrame);
-                               fWindow->MarkContentDirtyAsync(*dirty);
-                               fWindow->RecycleRegion(dirty);
-                       }
+
+                       BRegion dirty;
+                       dirty.Set((clipping_rect)clippedFrame);
+                       fWindow->MarkContentDirtyAsync(dirty);
                }
        }
 
@@ -1282,12 +1278,10 @@ View::SetHidden(bool hidden)
                                // trigger a redraw
                                IntRect clippedBounds = Bounds();
                                ConvertToVisibleInTopView(&clippedBounds);
-                               BRegion* dirty = fWindow->GetRegion();
-                               if (!dirty)
-                                       return;
-                               dirty->Set((clipping_rect)clippedBounds);
-                               fWindow->MarkContentDirty(*dirty);
-                               fWindow->RecycleRegion(dirty);
+
+                               BRegion dirty;
+                               dirty.Set((clipping_rect)clippedBounds);
+                               fWindow->MarkContentDirty(dirty);
                        }
                }
        }
@@ -1532,12 +1526,9 @@ View::_ScreenClipping(BRegion* windowContentClipping, 
bool force) const
                ConvertToVisibleInTopView(&clippedBounds);
                if (clippedBounds.Width() < fScreenClipping.Frame().Width()
                        || clippedBounds.Height() < 
fScreenClipping.Frame().Height()) {
-                       BRegion* temp = fWindow->GetRegion();
-                       if (temp) {
-                               temp->Set((clipping_rect)clippedBounds);
-                               fScreenClipping.IntersectWith(temp);
-                               fWindow->RecycleRegion(temp);
-                       }
+                       BRegion temp;
+                       temp.Set((clipping_rect)clippedBounds);
+                       fScreenClipping.IntersectWith(&temp);
                }
 
                fScreenClipping.IntersectWith(windowContentClipping);


Other related posts:

  • » [haiku-commits] haiku: hrev53932 - src/servers/app - waddlesplash