?? vnchooks.cc
字號(hào):
if (npt == 0) { (*pGC->ops->PolyPoint) (pDrawable, pGC, mode, npt, 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 < npt; 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 < npt; 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->PolyPoint) (pDrawable, pGC, mode, npt, pts); vncHooksScreen->desktop->add_changed(changed.reg);}// Polylines - changed region is the union of the bounding rects of each line,// clipped by pCompositeClip. If there are more than MAX_RECTS_PER_OP lines,// just use the bounding rect of all the lines.static void vncHooksPolylines(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppts){ GC_OP_UNWRAPPER(pDrawable, pGC, Polylines); if (npt == 0) { (*pGC->ops->Polylines) (pDrawable, pGC, mode, npt, ppts); return; } int nRegRects = npt - 1; xRectangle regRects[MAX_RECTS_PER_OP]; int lw = pGC->lineWidth; if (lw == 0) lw = 1; if (npt == 1) { // a single point nRegRects = 1; regRects[0].x = pDrawable->x + ppts[0].x - lw; regRects[0].y = pDrawable->y + ppts[0].y - lw; regRects[0].width = 2*lw; regRects[0].height = 2*lw; } else { /* * mitered joins can project quite a way from * the line end; the 11 degree miter limit limits * this extension to lw / (2 * tan(11/2)), rounded up * and converted to int yields 6 * lw */ int extra = lw / 2; if (pGC->joinStyle == JoinMiter) { extra = 6 * lw; } int prevX, prevY, curX, curY; int rectX1, rectY1, rectX2, rectY2; int minX, minY, maxX, maxY; prevX = ppts[0].x + pDrawable->x; prevY = ppts[0].y + pDrawable->y; minX = maxX = prevX; minY = maxY = prevY; for (int i = 0; i < nRegRects; i++) { if (mode == CoordModeOrigin) { curX = pDrawable->x + ppts[i+1].x; curY = pDrawable->y + ppts[i+1].y; } else { curX = prevX + ppts[i+1].x; curY = prevY + ppts[i+1].y; } if (prevX > curX) { rectX1 = curX - extra; rectX2 = prevX + extra + 1; } else { rectX1 = prevX - extra; rectX2 = curX + extra + 1; } if (prevY > curY) { rectY1 = curY - extra; rectY2 = prevY + extra + 1; } else { rectY1 = prevY - extra; rectY2 = curY + extra + 1; } if (nRegRects <= MAX_RECTS_PER_OP) { regRects[i].x = rectX1; regRects[i].y = rectY1; regRects[i].width = rectX2 - rectX1; regRects[i].height = rectY2 - rectY1; } else { if (rectX1 < minX) minX = rectX1; if (rectY1 < minY) minY = rectY1; if (rectX2 > maxX) maxX = rectX2; if (rectY2 > maxY) maxY = rectY2; } prevX = curX; prevY = curY; } if (nRegRects > 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->Polylines) (pDrawable, pGC, mode, npt, ppts); vncHooksScreen->desktop->add_changed(changed.reg);}// PolySegment - changed region is the union of the bounding rects of each// segment, clipped by pCompositeClip. If there are more than MAX_RECTS_PER_OP// segments, just use the bounding rect of all the segments.static void vncHooksPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *segs){ GC_OP_UNWRAPPER(pDrawable, pGC, PolySegment); if (nseg == 0) { (*pGC->ops->PolySegment) (pDrawable, pGC, nseg, segs); return; } xRectangle regRects[MAX_RECTS_PER_OP]; int nRegRects = nseg; int lw = pGC->lineWidth; int extra = lw / 2; int rectX1, rectY1, rectX2, rectY2; int minX, minY, maxX, maxY; minX = maxX = segs[0].x1; minY = maxY = segs[0].y1; for (int i = 0; i < nseg; i++) { if (segs[i].x1 > segs[i].x2) { rectX1 = pDrawable->x + segs[i].x2 - extra; rectX2 = pDrawable->x + segs[i].x1 + extra + 1; } else { rectX1 = pDrawable->x + segs[i].x1 - extra; rectX2 = pDrawable->x + segs[i].x2 + extra + 1; } if (segs[i].y1 > segs[i].y2) { rectY1 = pDrawable->y + segs[i].y2 - extra; rectY2 = pDrawable->y + segs[i].y1 + extra + 1; } else { rectY1 = pDrawable->y + segs[i].y1 - extra; rectY2 = pDrawable->y + segs[i].y2 + extra + 1; } if (nseg <= MAX_RECTS_PER_OP) { regRects[i].x = rectX1; regRects[i].y = rectY1; regRects[i].width = rectX2 - rectX1; regRects[i].height = rectY2 - rectY1; } else { if (rectX1 < minX) minX = rectX1; if (rectY1 < minY) minY = rectY1; if (rectX2 > maxX) maxX = rectX2; if (rectY2 > maxY) maxY = rectY2; } } if (nseg > 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->PolySegment) (pDrawable, pGC, nseg, segs); vncHooksScreen->desktop->add_changed(changed.reg);}// PolyRectangle - changed region is the union of the bounding rects around// each side of the outline 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 vncHooksPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle *rects){ GC_OP_UNWRAPPER(pDrawable, pGC, PolyRectangle); if (nrects == 0) { (*pGC->ops->PolyRectangle) (pDrawable, pGC, nrects, rects); return; } xRectangle regRects[MAX_RECTS_PER_OP*4]; int nRegRects = nrects * 4; int lw = pGC->lineWidth; int extra = lw / 2; 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*4].x = rects[i].x - extra + pDrawable->x; regRects[i*4].y = rects[i].y - extra + pDrawable->y; regRects[i*4].width = rects[i].width + 1 + 2 * extra; regRects[i*4].height = 1 + 2 * extra; regRects[i*4+1].x = rects[i].x - extra + pDrawable->x; regRects[i*4+1].y = rects[i].y - extra + pDrawable->y; regRects[i*4+1].width = 1 + 2 * extra; regRects[i*4+1].height = rects[i].height + 1 + 2 * extra; regRects[i*4+2].x = rects[i].x + rects[i].width - extra + pDrawable->x; regRects[i*4+2].y = rects[i].y - extra + pDrawable->y; regRects[i*4+2].width = 1 + 2 * extra; regRects[i*4+2].height = rects[i].height + 1 + 2 * extra; regRects[i*4+3].x = rects[i].x - extra + pDrawable->x; regRects[i*4+3].y = rects[i].y + rects[i].height - extra + pDrawable->y; regRects[i*4+3].width = rects[i].width + 1 + 2 * extra; regRects[i*4+3].height = 1 + 2 * extra; } else { rectX1 = pDrawable->x + rects[i].x - extra; rectY1 = pDrawable->y + rects[i].y - extra; rectX2 = pDrawable->x + rects[i].x + rects[i].width + extra+1; rectY2 = pDrawable->y + rects[i].y + rects[i].height + extra+1; 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->PolyRectangle) (pDrawable, pGC, nrects, rects); vncHooksScreen->desktop->add_changed(changed.reg);}// PolyArc - 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 vncHooksPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *arcs){ GC_OP_UNWRAPPER(pDrawable, pGC, PolyArc); if (narcs == 0) { (*pGC->ops->PolyArc) (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->PolyArc) (pDrawable, pGC, narcs, arcs); vncHooksScreen->desktop->add_changed(changed.reg);}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -