diff options
author | Pierre Ossman <ossman@cendio.se> | 2020-05-01 17:37:04 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2020-05-18 13:34:19 +0200 |
commit | 6e6a221e3db5f384bcadeeef015676ef2b91d48e (patch) | |
tree | b2951a05490c0ee77db2c56f82e54ec00a616e52 /unix/xserver | |
parent | ecb016fe3ff6fdcd8f9d98f5e1003d037888703e (diff) | |
download | tigervnc-6e6a221e3db5f384bcadeeef015676ef2b91d48e.tar.gz tigervnc-6e6a221e3db5f384bcadeeef015676ef2b91d48e.zip |
Get rid of magical assignment to Region
Might as well make these explicit so the cost is apparent.
Diffstat (limited to 'unix/xserver')
-rw-r--r-- | unix/xserver/hw/vnc/vncExtInit.cc | 30 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/vncExtInit.h | 8 | ||||
-rw-r--r-- | unix/xserver/hw/vnc/vncHooks.c | 2 |
3 files changed, 17 insertions, 23 deletions
diff --git a/unix/xserver/hw/vnc/vncExtInit.cc b/unix/xserver/hw/vnc/vncExtInit.cc index 6ab306b1..d05bf85b 100644 --- a/unix/xserver/hw/vnc/vncExtInit.cc +++ b/unix/xserver/hw/vnc/vncExtInit.cc @@ -150,9 +150,6 @@ void vncExtensionInit(void) if (vncGetScreenCount() > MAXSCREENS) vncFatalError("vncExtensionInit: too many screens"); - if (sizeof(ShortRect) != sizeof(struct UpdateRect)) - vncFatalError("vncExtensionInit: Incompatible ShortRect size"); - vncAddExtension(); vncSelectionInit(); @@ -372,25 +369,24 @@ void vncSetLEDState(unsigned long leds) desktop[scr]->setLEDState(state); } -void vncAddChanged(int scrIdx, const struct UpdateRect *extents, - int nRects, const struct UpdateRect *rects) +void vncAddChanged(int scrIdx, int nRects, + const struct UpdateRect *rects) { - Region reg; - - reg.setExtentsAndOrderedRects((const ShortRect*)extents, - nRects, (const ShortRect*)rects); - desktop[scrIdx]->add_changed(reg); + for (int i = 0;i < nRects;i++) { + desktop[scrIdx]->add_changed(Region(Rect(rects[i].x1, rects[i].y1, + rects[i].x2, rects[i].y2))); + } } -void vncAddCopied(int scrIdx, const struct UpdateRect *extents, - int nRects, const struct UpdateRect *rects, +void vncAddCopied(int scrIdx, int nRects, + const struct UpdateRect *rects, int dx, int dy) { - Region reg; - - reg.setExtentsAndOrderedRects((const ShortRect*)extents, - nRects, (const ShortRect*)rects); - desktop[scrIdx]->add_copied(reg, rfb::Point(dx, dy)); + for (int i = 0;i < nRects;i++) { + desktop[scrIdx]->add_copied(Region(Rect(rects[i].x1, rects[i].y1, + rects[i].x2, rects[i].y2)), + Point(dx, dy)); + } } void vncSetCursor(int width, int height, int hotX, int hotY, diff --git a/unix/xserver/hw/vnc/vncExtInit.h b/unix/xserver/hw/vnc/vncExtInit.h index 1fb87c19..23c0c669 100644 --- a/unix/xserver/hw/vnc/vncExtInit.h +++ b/unix/xserver/hw/vnc/vncExtInit.h @@ -73,10 +73,10 @@ struct UpdateRect { short x1, y1, x2, y2; }; -void vncAddChanged(int scrIdx, const struct UpdateRect *extents, - int nRects, const struct UpdateRect *rects); -void vncAddCopied(int scrIdx, const struct UpdateRect *extents, - int nRects, const struct UpdateRect *rects, +void vncAddChanged(int scrIdx, int nRects, + const struct UpdateRect *rects); +void vncAddCopied(int scrIdx, int nRects, + const struct UpdateRect *rects, int dx, int dy); void vncSetCursor(int width, int height, int hotX, int hotY, diff --git a/unix/xserver/hw/vnc/vncHooks.c b/unix/xserver/hw/vnc/vncHooks.c index f631941b..a8ab917b 100644 --- a/unix/xserver/hw/vnc/vncHooks.c +++ b/unix/xserver/hw/vnc/vncHooks.c @@ -340,7 +340,6 @@ static inline void add_changed(ScreenPtr pScreen, RegionPtr reg) if (RegionNil(reg)) return; vncAddChanged(pScreen->myNum, - (const struct UpdateRect*)RegionExtents(reg), RegionNumRects(reg), (const struct UpdateRect*)RegionRects(reg)); } @@ -354,7 +353,6 @@ static inline void add_copied(ScreenPtr pScreen, RegionPtr dst, if (RegionNil(dst)) return; vncAddCopied(pScreen->myNum, - (const struct UpdateRect*)RegionExtents(dst), RegionNumRects(dst), (const struct UpdateRect*)RegionRects(dst), dx, dy); } |