Skip to content

Commit

Permalink
#1781: smarter way of deciding when to merge rectangles when refreshi…
Browse files Browse the repository at this point in the history
…ng the video region

git-svn-id: https://xpra.org/svn/Xpra/trunk@18749 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Mar 17, 2018
1 parent f1c4aab commit fee392d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/xpra/server/window/video_subregion.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,17 +240,18 @@ def refresh(self):
#runs via timeout_add, safe to call UI!
self.refresh_timer = 0
regions = self.refresh_regions
#it probably makes sense to refresh the whole thing:
#(the window source code doesn't know about the video region,
# and would decide to do many overlapping refreshes)
rect = self.rectangle
if rect and len(regions)>=2:
regions = [rect]
#figure out if it makes sense to refresh the whole area,
#or if we just send the list of smaller rectangles:
pixels = sum(r.width*r.height for r in regions)
if pixels>=rect.width*rect.height//2:
regions = [rect]
refreshlog("refresh() calling %s with regions=%s", self.refresh_cb, regions)
if self.refresh_cb(regions):
self.refresh_regions = []
else:
#retry
#retry later
self.refresh_timer = self.timeout_add(1000, self.refresh)


Expand Down

0 comments on commit fee392d

Please sign in to comment.