Beispiel #1
0
XPoint getBeizerPoint(XPoint* p, float t, int l, int n){

#ifdef DEBUG
    printf("called! : _get BeizerPoint\n");
#endif
    if (n >= l/2) {
#ifdef DEBUG
        printf("RETURN! : p[%d].x %hd, p[%d].y %hd /// p2[%d].x %hd, p[%d].y %hd\n",n ,p[n].x, n, p[n].y,n+1 ,p[n+1].x ,n+1, p[n+1].y);
#endif
        return dividePoints(p[n], p[n+1], t);
    } else {
#ifdef DEBUG
        printf("call2 : p[%d].x %hd, p[%d].y %hd /// p2[%d].x %hd, p[%d].y %hd\n",n ,p[n].x, n, p[n].y,n+1 ,p[n+1].x ,n+1, p[n+1].y);
#endif
        p[n+1] = dividePoints(p[n], p[n+1], t);
#ifdef DEBUG
        printf("call2 : p[%d].x %hd, p[%d].y %hd /// p2[%d].x %hd, p[%d].y %hd\n",l-n ,p[l-n].x, l-n, p[l-n].y,l-n-1 ,p[l-n-1].x ,l-n-1, p[l-n-1].y);
#endif
        p[l-n-1] = dividePoints(p[l-n-1], p[l-n], t);
        return getBeizerPoint(p, t, l, n+1);
    }
}
void KisInputManager::Private::saveTabletEvent(const QTabletEvent *event)
{
    delete lastTabletEvent;

#if HAVE_X11
    /**
     * There is a bug in Qt-x11 when working in 2 tablets + 2 monitors
     * setup. The hiResGlobalPos() value gets scaled wrongly somehow.
     * Happily, the error is linear (without the offset) so we can simply
     * scale it a bit.
     */

    if (event->type() == QEvent::TabletPress) {
        if ((event->globalPos() - event->hiResGlobalPos()).manhattanLength() > 4) {
            hiResEventsWorkaroundCoeff = dividePoints(event->globalPos(), event->hiResGlobalPos());
        } else {
            hiResEventsWorkaroundCoeff = QPointF(1.0, 1.0);
        }
    }
#endif

    lastTabletEvent =
<<<<<<< HEAD
        new QTabletEvent(event->type(),
                         event->pos(),
                         event->globalPos(),
#if HAVE_X11
                         multiplyPoints(event->hiResGlobalPos(), hiResEventsWorkaroundCoeff),
#else
                         event->hiResGlobalPos(),
#endif
                         event->device(),
                         event->pointerType(),
                         event->pressure(),
                         event->xTilt(),
                         event->yTilt(),
                         event->tangentialPressure(),
                         event->rotation(),
                         event->z(),
                         event->modifiers(),
                         event->uniqueId());
=======
            new QTabletEvent(event->type(),