?? vnchooks.cc
字號(hào):
// FillPolygon - changed region is the bounding rect around the polygon,// clipped by pCompositeClipstatic void vncHooksFillPolygon(DrawablePtr pDrawable, GCPtr pGC, int shape, int mode, int count, DDXPointPtr pts){ GC_OP_UNWRAPPER(pDrawable, pGC, FillPolygon); if (count == 0) { (*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, count, pts); return; } int minX = pts[0].x; int maxX = pts[0].x; int minY = pts[0].y; int maxY = pts[0].y; if (mode == CoordModePrevious) { int x = pts[0].x; int y = pts[0].y; for (int i = 1; i < count; i++) { x += pts[i].x; y += pts[i].y; if (x < minX) minX = x; if (x > maxX) maxX = x; if (y < minY) minY = y; if (y > maxY) maxY = y; } } else { for (int i = 1; i < count; i++) { if (pts[i].x < minX) minX = pts[i].x; if (pts[i].x > maxX) maxX = pts[i].x; if (pts[i].y < minY) minY = pts[i].y; if (pts[i].y > maxY) maxY = pts[i].y; } } BoxRec box; box.x1 = minX + pDrawable->x; box.y1 = minY + pDrawable->y; box.x2 = maxX + 1 + pDrawable->x; box.y2 = maxY + 1 + pDrawable->y; RegionHelper changed(pScreen, &box, 0); REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC)); (*pGC->ops->FillPolygon) (pDrawable, pGC, shape, mode, count, pts); vncHooksScreen->desktop->add_changed(changed.reg);}// PolyFillRect - changed region is the union of the rectangles, clipped by// pCompositeClip. If there are more than MAX_RECTS_PER_OP rectangles, just// use the bounding rect of all the rectangles.static void vncHooksPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle *rects){ GC_OP_UNWRAPPER(pDrawable, pGC, PolyFillRect); if (nrects == 0) { (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrects, rects); return; } xRectangle regRects[MAX_RECTS_PER_OP]; int nRegRects = nrects; int rectX1, rectY1, rectX2, rectY2; int minX, minY, maxX, maxY; minX = maxX = rects[0].x; minY = maxY = rects[0].y; for (int i = 0; i < nrects; i++) { if (nrects <= MAX_RECTS_PER_OP) { regRects[i].x = rects[i].x + pDrawable->x; regRects[i].y = rects[i].y + pDrawable->y; regRects[i].width = rects[i].width; regRects[i].height = rects[i].height; } else { rectX1 = pDrawable->x + rects[i].x; rectY1 = pDrawable->y + rects[i].y; rectX2 = pDrawable->x + rects[i].x + rects[i].width; rectY2 = pDrawable->y + rects[i].y + rects[i].height; if (rectX1 < minX) minX = rectX1; if (rectY1 < minY) minY = rectY1; if (rectX2 > maxX) maxX = rectX2; if (rectY2 > maxY) maxY = rectY2; } } if (nrects > MAX_RECTS_PER_OP) { regRects[0].x = minX; regRects[0].y = minY; regRects[0].width = maxX - minX; regRects[0].height = maxY - minY; nRegRects = 1; } RegionHelper changed(pScreen, nRegRects, regRects); REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC)); (*pGC->ops->PolyFillRect) (pDrawable, pGC, nrects, rects); vncHooksScreen->desktop->add_changed(changed.reg);}// PolyFillArc - changed region is the union of bounding rects around each arc,// clipped by pCompositeClip. If there are more than MAX_RECTS_PER_OP arcs,// just use the bounding rect of all the arcs.static void vncHooksPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *arcs){ GC_OP_UNWRAPPER(pDrawable, pGC, PolyFillArc); if (narcs == 0) { (*pGC->ops->PolyFillArc) (pDrawable, pGC, narcs, arcs); return; } xRectangle regRects[MAX_RECTS_PER_OP]; int nRegRects = narcs; int lw = pGC->lineWidth; if (lw == 0) lw = 1; int extra = lw / 2; int rectX1, rectY1, rectX2, rectY2; int minX, minY, maxX, maxY; minX = maxX = arcs[0].x; minY = maxY = arcs[0].y; for (int i = 0; i < narcs; i++) { if (narcs <= MAX_RECTS_PER_OP) { regRects[i].x = arcs[i].x - extra + pDrawable->x; regRects[i].y = arcs[i].y - extra + pDrawable->y; regRects[i].width = arcs[i].width + lw; regRects[i].height = arcs[i].height + lw; } else { rectX1 = pDrawable->x + arcs[i].x - extra; rectY1 = pDrawable->y + arcs[i].y - extra; rectX2 = pDrawable->x + arcs[i].x + arcs[i].width + lw; rectY2 = pDrawable->y + arcs[i].y + arcs[i].height + lw; if (rectX1 < minX) minX = rectX1; if (rectY1 < minY) minY = rectY1; if (rectX2 > maxX) maxX = rectX2; if (rectY2 > maxY) maxY = rectY2; } } if (narcs > MAX_RECTS_PER_OP) { regRects[0].x = minX; regRects[0].y = minY; regRects[0].width = maxX - minX; regRects[0].height = maxY - minY; nRegRects = 1; } RegionHelper changed(pScreen, nRegRects, regRects); REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC)); (*pGC->ops->PolyFillArc) (pDrawable, pGC, narcs, arcs); vncHooksScreen->desktop->add_changed(changed.reg);}// GetTextBoundingRect - calculate a bounding rectangle around n chars of a// font. Not particularly accurate, but good enough.static void GetTextBoundingRect(DrawablePtr pDrawable, FontPtr font, int x, int y, int nchars, BoxPtr box){ int ascent = __rfbmax(FONTASCENT(font), FONTMAXBOUNDS(font, ascent)); int descent = __rfbmax(FONTDESCENT(font), FONTMAXBOUNDS(font, descent)); int charWidth = __rfbmax(FONTMAXBOUNDS(font,rightSideBearing), FONTMAXBOUNDS(font,characterWidth)); box->x1 = pDrawable->x + x; box->y1 = pDrawable->y + y - ascent; box->x2 = box->x1 + charWidth * nchars; box->y2 = box->y1 + ascent + descent; if (FONTMINBOUNDS(font,leftSideBearing) < 0) box->x1 += FONTMINBOUNDS(font,leftSideBearing);}// PolyText8 - changed region is bounding rect around count chars, clipped by// pCompositeClipstatic int vncHooksPolyText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars){ GC_OP_UNWRAPPER(pDrawable, pGC, PolyText8); if (count == 0) return (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); BoxRec box; GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box); RegionHelper changed(pScreen, &box, 0); REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC)); int ret = (*pGC->ops->PolyText8) (pDrawable, pGC, x, y, count, chars); vncHooksScreen->desktop->add_changed(changed.reg); return ret;}// PolyText16 - changed region is bounding rect around count chars, clipped by// pCompositeClipstatic int vncHooksPolyText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars){ GC_OP_UNWRAPPER(pDrawable, pGC, PolyText16); if (count == 0) return (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); BoxRec box; GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box); RegionHelper changed(pScreen, &box, 0); REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC)); int ret = (*pGC->ops->PolyText16) (pDrawable, pGC, x, y, count, chars); vncHooksScreen->desktop->add_changed(changed.reg); return ret;}// ImageText8 - changed region is bounding rect around count chars, clipped by// pCompositeClipstatic void vncHooksImageText8(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars){ GC_OP_UNWRAPPER(pDrawable, pGC, ImageText8); if (count == 0) { (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); return; } BoxRec box; GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box); RegionHelper changed(pScreen, &box, 0); REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC)); (*pGC->ops->ImageText8) (pDrawable, pGC, x, y, count, chars); vncHooksScreen->desktop->add_changed(changed.reg);}// ImageText16 - changed region is bounding rect around count chars, clipped by// pCompositeClipstatic void vncHooksImageText16(DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, unsigned short *chars){ GC_OP_UNWRAPPER(pDrawable, pGC, ImageText16); if (count == 0) { (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); return; } BoxRec box; GetTextBoundingRect(pDrawable, pGC->font, x, y, count, &box); RegionHelper changed(pScreen, &box, 0); REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC)); (*pGC->ops->ImageText16) (pDrawable, pGC, x, y, count, chars); vncHooksScreen->desktop->add_changed(changed.reg);}// ImageGlyphBlt - changed region is bounding rect around nglyph chars, clipped// by pCompositeClipstatic void vncHooksImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase){ GC_OP_UNWRAPPER(pDrawable, pGC, ImageGlyphBlt); if (nglyph == 0) { (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci,pglyphBase); return; } BoxRec box; GetTextBoundingRect(pDrawable, pGC->font, x, y, nglyph, &box); RegionHelper changed(pScreen, &box, 0); REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC)); (*pGC->ops->ImageGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); vncHooksScreen->desktop->add_changed(changed.reg);}// PolyGlyphBlt - changed region is bounding rect around nglyph chars, clipped// by pCompositeClipstatic void vncHooksPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, int x, int y, unsigned int nglyph, CharInfoPtr *ppci, pointer pglyphBase){ GC_OP_UNWRAPPER(pDrawable, pGC, PolyGlyphBlt); if (nglyph == 0) { (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci,pglyphBase); return; } BoxRec box; GetTextBoundingRect(pDrawable, pGC->font, x, y, nglyph, &box); RegionHelper changed(pScreen, &box, 0); REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC)); (*pGC->ops->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); vncHooksScreen->desktop->add_changed(changed.reg);}// PushPixels - changed region is the given rectangle, clipped by// pCompositeClipstatic void vncHooksPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int w, int h, int x, int y){ GC_OP_UNWRAPPER(pDrawable, pGC, PushPixels); BoxRec box; box.x1 = x + pDrawable->x; box.y1 = y + pDrawable->y; box.x2 = box.x1 + w; box.y2 = box.y1 + h; RegionHelper changed(pScreen, &box, 0); REGION_INTERSECT(pScreen, changed.reg, changed.reg, COMPOSITE_CLIP(pGC)); (*pGC->ops->PushPixels) (pGC, pBitMap, pDrawable, w, h, x, y); vncHooksScreen->desktop->add_changed(changed.reg);}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -