Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15760c9d authored by Mike Reed's avatar Mike Reed
Browse files

switch to new SkPathDirection enum

Test: make

Change-Id: If88814c12d12280d362078c1d8bc7f66558f82e2
parent 3cda6a23
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -132,14 +132,14 @@ public:
    static void addRect(JNIEnv* env, jclass clazz, jlong objHandle,
            jfloat left, jfloat top, jfloat right, jfloat bottom, jint dirHandle) {
        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
        SkPathDirection dir = static_cast<SkPathDirection>(dirHandle);
        obj->addRect(left, top, right, bottom, dir);
    }

    static void addOval(JNIEnv* env, jclass clazz, jlong objHandle,
            jfloat left, jfloat top, jfloat right, jfloat bottom, jint dirHandle) {
        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
        SkPathDirection dir = static_cast<SkPathDirection>(dirHandle);
        SkRect oval = SkRect::MakeLTRB(left, top, right, bottom);
        obj->addOval(oval, dir);
    }
@@ -147,7 +147,7 @@ public:
    static void addCircle(JNIEnv* env, jclass clazz, jlong objHandle, jfloat x, jfloat y,
            jfloat radius, jint dirHandle) {
        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
        SkPathDirection dir = static_cast<SkPathDirection>(dirHandle);
        obj->addCircle(x, y, radius, dir);
    }

@@ -162,7 +162,7 @@ public:
            jfloat right, jfloat bottom, jfloat rx, jfloat ry, jint dirHandle) {
        SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
        SkPathDirection dir = static_cast<SkPathDirection>(dirHandle);
        obj->addRoundRect(rect, rx, ry, dir);
    }

@@ -170,7 +170,7 @@ public:
                jfloat right, jfloat bottom, jfloatArray array, jint dirHandle) {
        SkRect rect = SkRect::MakeLTRB(left, top, right, bottom);
        SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
        SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
        SkPathDirection dir = static_cast<SkPathDirection>(dirHandle);
        AutoJavaFloatArray  afa(env, array, 8);
#ifdef SK_SCALAR_IS_FLOAT
        const float* src = afa.ptr();
@@ -555,8 +555,8 @@ static const JNINativeMethod methods[] = {
int register_android_graphics_Path(JNIEnv* env) {
    return RegisterMethodsOrDie(env, "android/graphics/Path", methods, NELEM(methods));

    static_assert(0  == SkPath::kCW_Direction,  "direction_mismatch");
    static_assert(1  == SkPath::kCCW_Direction, "direction_mismatch");
    static_assert(0 == (int)SkPathDirection::kCW,  "direction_mismatch");
    static_assert(1 == (int)SkPathDirection::kCCW, "direction_mismatch");
}

}
+3 −3
Original line number Diff line number Diff line
@@ -85,9 +85,9 @@ const static TestData sTestDataSet[] = {
             outPath->rCubicTo(8.0, 8.0, 8.0, 8.0, 8.0, 8.0);
             outPath->cubicTo(16.0, 16.0, 9.0, 9.0, 9.0, 9.0);
             outPath->rCubicTo(0.0, 0.0, 9.0, 9.0, 9.0, 9.0);
             outPath->arcTo(10.0, 10.0, 0.0, SkPath::kLarge_ArcSize, SkPath::kCW_Direction, 10.0,
             outPath->arcTo(10.0, 10.0, 0.0, SkPath::kLarge_ArcSize, SkPathDirection::kCW, 10.0,
                            10.0);
             outPath->arcTo(10.0, 10.0, 0.0, SkPath::kLarge_ArcSize, SkPath::kCW_Direction, 20.0,
             outPath->arcTo(10.0, 10.0, 0.0, SkPath::kLarge_ArcSize, SkPathDirection::kCW, 20.0,
                            20.0);
         }},

@@ -159,7 +159,7 @@ const static TestData sTestDataSet[] = {
         },
         [](SkPath* outPath) {
             outPath->moveTo(300.0, 70.0);
             outPath->arcTo(230.0, 230.0, 0.0, SkPath::kLarge_ArcSize, SkPath::kCCW_Direction,
             outPath->arcTo(230.0, 230.0, 0.0, SkPath::kLarge_ArcSize, SkPathDirection::kCCW,
                            301.0, 70.0);
             outPath->close();
             outPath->moveTo(300.0, 70.0);
+2 −2
Original line number Diff line number Diff line
@@ -300,7 +300,7 @@ void PathResolver::addCommand(SkPath* outPath, char previousCmd, char cmd,
                // (rx ry x-axis-rotation large-arc-flag sweep-flag x y)
                outPath->arcTo(points->at(k + 0), points->at(k + 1), points->at(k + 2),
                               (SkPath::ArcSize) (points->at(k + 3) != 0),
                               (SkPath::Direction) (points->at(k + 4) == 0), 
                               (SkPathDirection) (points->at(k + 4) == 0),
                               points->at(k + 5) + currentX, points->at(k + 6) + currentY);
                currentX += points->at(k + 5);
                currentY += points->at(k + 6);
@@ -310,7 +310,7 @@ void PathResolver::addCommand(SkPath* outPath, char previousCmd, char cmd,
            case 'A':  // Draws an elliptical arc
                outPath->arcTo(points->at(k + 0), points->at(k + 1), points->at(k + 2),
                               (SkPath::ArcSize) (points->at(k + 3) != 0),
                               (SkPath::Direction) (points->at(k + 4) == 0), 
                               (SkPathDirection) (points->at(k + 4) == 0),
                               points->at(k + 5), points->at(k + 6));
                currentX = points->at(k + 5);
                currentY = points->at(k + 6);