summaryrefslogtreecommitdiffstats
path: root/unix/xserver/hw/vnc/vncHooks.c
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2018-09-13 12:31:59 +0200
committerPierre Ossman <ossman@cendio.se>2018-09-13 12:31:59 +0200
commit04510322c51c8ddaf8b7c1ea684f918274539c6e (patch)
treebaf1a55f7667e9d0c00c401a95cab1c47f8e72dd /unix/xserver/hw/vnc/vncHooks.c
parent9c88e0dd266292b4dec7857f073b811137b6b30d (diff)
downloadtigervnc-04510322c51c8ddaf8b7c1ea684f918274539c6e.tar.gz
tigervnc-04510322c51c8ddaf8b7c1ea684f918274539c6e.zip
Stop tracking changes for each glyph
We get a whole bunch of very tiny areas, which is very inefficient to deal with. Instead create a rectangle around every "list" of connected glyphs (usually each line).
Diffstat (limited to 'unix/xserver/hw/vnc/vncHooks.c')
-rw-r--r--unix/xserver/hw/vnc/vncHooks.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/unix/xserver/hw/vnc/vncHooks.c b/unix/xserver/hw/vnc/vncHooks.c
index f3c2520a..5cf2c0d1 100644
--- a/unix/xserver/hw/vnc/vncHooks.c
+++ b/unix/xserver/hw/vnc/vncHooks.c
@@ -815,20 +815,6 @@ static void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
RENDER_EPILOGUE(Composite);
}
-static int
-GlyphCount(int nlist, GlyphListPtr list, GlyphPtr * glyphs)
-{
- int count;
-
- count = 0;
- while (nlist--) {
- count += list->len;
- list++;
- }
-
- return count;
-}
-
static RegionPtr
GlyphsToRegion(ScreenPtr pScreen, int nlist, GlyphListPtr list, GlyphPtr *glyphs)
{
@@ -836,7 +822,7 @@ GlyphsToRegion(ScreenPtr pScreen, int nlist, GlyphListPtr list, GlyphPtr *glyphs
GlyphPtr glyph;
int x, y;
- int nrects = GlyphCount(nlist, list, glyphs);
+ int nrects = nlist;
xRectangle rects[nrects];
xRectanglePtr rect;
@@ -844,20 +830,48 @@ GlyphsToRegion(ScreenPtr pScreen, int nlist, GlyphListPtr list, GlyphPtr *glyphs
y = 0;
rect = &rects[0];
while (nlist--) {
+ int left, right, top, bottom;
+
x += list->xOff;
y += list->yOff;
n = list->len;
list++;
+
+ left = INT_MAX;
+ top = INT_MAX;
+ right = -INT_MAX;
+ bottom = -INT_MAX;
while (n--) {
+ int gx, gy, gw, gh;
+
glyph = *glyphs++;
- rect->x = x - glyph->info.x;
- rect->y = y - glyph->info.y;
- rect->width = glyph->info.width;
- rect->height = glyph->info.height;
+ gx = x - glyph->info.x;
+ gy = y - glyph->info.y;
+ gw = glyph->info.width;
+ gh = glyph->info.height;
x += glyph->info.xOff;
y += glyph->info.yOff;
- rect++;
+
+ if (gx < left)
+ left = gx;
+ if (gy < top)
+ top = gy;
+ if (gx + gw > right)
+ right = gx + gw;
+ if (gy + gh > bottom)
+ bottom = gy + gh;
+ }
+
+ rect->x = left;
+ rect->y = top;
+ if ((right > left) && (bottom > top)) {
+ rect->width = right - left;
+ rect->height = bottom - top;
+ } else {
+ rect->width = 0;
+ rect->height = 0;
}
+ rect++;
}
return RECTS_TO_REGION(pScreen, nrects, rects, CT_NONE);