[haiku-commits] Change in haiku[master]: app_server: Reduce usage of the RegionPool where unnecessary.

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 1 Mar 2020 02:19:41 +0000

From waddlesplash <waddlesplash@xxxxxxxxx>:

waddlesplash has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/2298 ;)


Change subject: app_server: Reduce usage of the RegionPool where unnecessary.
......................................................................

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).
---
M src/servers/app/View.cpp
1 file changed, 15 insertions(+), 24 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/98/2298/1

diff --git a/src/servers/app/View.cpp b/src/servers/app/View.cpp
index 8964810..70ea9b0 100644
--- a/src/servers/app/View.cpp
+++ b/src/servers/app/View.cpp
@@ -277,12 +277,10 @@
                        // 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 @@
                        // 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 @@
                                // 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 @@
                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);

--
To view, visit https://review.haiku-os.org/c/haiku/+/2298
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I10ac6bc7b5cf6b681641e88558a3f1ba770b6f77
Gerrit-Change-Number: 2298
Gerrit-PatchSet: 1
Gerrit-Owner: waddlesplash <waddlesplash@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: app_server: Reduce usage of the RegionPool where unnecessary. - Gerrit