Пример #1
0
void GraphicsContext::strokeArc(const IntRect& r, int startAngle, int angleSpan)
{
    if (paintingDisabled())
        return;

    SkPaint paint;
    SkRect oval = r;
    if (strokeStyle() == NoStroke) {
        // Stroke using the fill color.
        // TODO(brettw) is this really correct? It seems unreasonable.
        platformContext()->setupPaintForFilling(&paint);
        paint.setStyle(SkPaint::kStroke_Style);
        paint.setStrokeWidth(WebCoreFloatToSkScalar(strokeThickness()));
    } else
        platformContext()->setupPaintForStroking(&paint, 0, 0);

    // We do this before converting to scalar, so we don't overflow SkFixed.
    startAngle = fastMod(startAngle, 360);
    angleSpan = fastMod(angleSpan, 360);

    SkPath path;
    path.addArc(oval, SkIntToScalar(-startAngle), SkIntToScalar(-angleSpan));
    if (!isPathSkiaSafe(getCTM(), path))
        return;
    platformContext()->canvas()->drawPath(path, paint);
}
Пример #2
0
void number_test()
{
	cout << "----------- number test -----------" << endl;
	cout << "fast mod" << "7 ^ 100 % 10 =" << fastMod(7, 100, 10) << ", " <<
			(fastMod(7, 100, 10) == 6 ? "YES" : "NO") << endl;
	cout << "gcd" << "gcd(16, 12) = " << gcd(16, 12) << ", " <<
			(gcd(16, 12) == 4 ? "YES" : "NO") << endl;
}
Пример #3
0
void handleString(FILE *fp, char *readIn,ll exponent, unsigned long modulus) {
    int length = strlen(readIn) / 6;
    ll *res = malloc((length * sizeof(ll) + 20) * 2);
    memset(res, 0, length * sizeof(ll));

    for (int i = 0 ; i < length ; ++i) {
        for (int j = 0 ; j < 6; ++j) {
            res[i] = res[i] * 41 + value(readIn[i * 6 + j]);
        }
    }

    for (int i = 0; i < length; ++i)
        res[i] = fastMod(res[i], exponent, modulus);

    for (int i = 0; i < length; ++i) {
        ll temp = res[i];
        int tempLength = log(modulus) / log(41) + 10;
            int arr[6];
        char tempRes[6];
        memset(arr,0, sizeof(arr));
        memset(tempRes, 0, sizeof(tempRes));

        //extract number
        int i = 0, j = 0;
        while (temp > 0) {
            arr[i++] = temp % 41;
            temp /= 41;
        }

        int __i = i;

        for (int ii = 0; ii < 6; ++ii) {
            fprintf(fp, "%c", reValue(arr[5 - ii]));
        }
    }
    fprintf(fp,"\n");
    //printf("%s\n",output);

    free(res);
}