From e60a52fdabad15248431da61c7460e2a089e4643 Mon Sep 17 00:00:00 2001 From: Hermet Park Date: Thu, 9 Sep 2021 11:57:07 +0900 Subject: [PATCH] api: set default value nullptr for user convenience. --- inc/thorvg.h | 2 +- src/examples/AnimateMasking.cpp | 2 +- test/testScene.cpp | 2 +- test/testSwCanvasBase.cpp | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/inc/thorvg.h b/inc/thorvg.h index eee73c8..a4ca04d 100644 --- a/inc/thorvg.h +++ b/inc/thorvg.h @@ -473,7 +473,7 @@ public: * * @note The Update behavior can be asynchronous if the assigned thread number is greater than zero. */ - virtual Result update(Paint* paint) noexcept; + virtual Result update(Paint* paint = nullptr) noexcept; /** * @brief Request the canvas to draw the Paint objects. diff --git a/src/examples/AnimateMasking.cpp b/src/examples/AnimateMasking.cpp index 4b506e2..7f1ba23 100644 --- a/src/examples/AnimateMasking.cpp +++ b/src/examples/AnimateMasking.cpp @@ -107,7 +107,7 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress) pMaskShape->translate(0 , progress * 300); pMask->translate(0 , progress * 300); - canvas->update(nullptr); + canvas->update(); } void transitSwCb(Elm_Transit_Effect *effect, Elm_Transit* transit, double progress) diff --git a/test/testScene.cpp b/test/testScene.cpp index f52c5d0..17fa3e5 100644 --- a/test/testScene.cpp +++ b/test/testScene.cpp @@ -90,7 +90,7 @@ TEST_CASE("Scene Clear And Reuse Shape", "[tvgScene]") REQUIRE(scene->push(move(shape)) == Result::Success); REQUIRE(canvas->push(move(scene)) == Result::Success); - REQUIRE(canvas->update(nullptr) == Result::Success); + REQUIRE(canvas->update() == Result::Success); //No deallocate shape. REQUIRE(pScene->clear(false) == Result::Success); diff --git a/test/testSwCanvasBase.cpp b/test/testSwCanvasBase.cpp index c1c8ae6..1f4927e 100644 --- a/test/testSwCanvasBase.cpp +++ b/test/testSwCanvasBase.cpp @@ -61,7 +61,7 @@ TEST_CASE("Pushing Paints", "[tvgSwCanvasBase]") REQUIRE(canvas->push(move(Scene::gen())) == Result::Success); //Cases by contexts. - REQUIRE(canvas->update(nullptr) == Result::Success); + REQUIRE(canvas->update() == Result::Success); REQUIRE(canvas->push(move(Shape::gen())) == Result::Success); REQUIRE(canvas->push(move(Shape::gen())) == Result::Success); @@ -135,11 +135,11 @@ TEST_CASE("Clear", "[tvgSwCanvasBase]") REQUIRE(canvas2->push(move(shape2)) == Result::Success); } - REQUIRE(canvas->update(nullptr) == Result::Success); + REQUIRE(canvas->update() == Result::Success); REQUIRE(canvas->clear() == Result::Success); REQUIRE(canvas->clear(false) == Result::Success); - REQUIRE(canvas2->update(nullptr) == Result::Success); + REQUIRE(canvas2->update() == Result::Success); REQUIRE(canvas2->clear(false) == Result::Success); REQUIRE(canvas2->clear() == Result::Success); @@ -158,7 +158,7 @@ TEST_CASE("Update", "[tvgSwCanvasBase]") uint32_t buffer[100*100]; REQUIRE(canvas->target(buffer, 100, 100, 100, SwCanvas::Colorspace::ARGB8888) == Result::Success); - REQUIRE(canvas->update(nullptr) == Result::InsufficientCondition); + REQUIRE(canvas->update() == Result::InsufficientCondition); REQUIRE(canvas->push(move(Shape::gen())) == Result::Success); @@ -170,9 +170,9 @@ TEST_CASE("Update", "[tvgSwCanvasBase]") auto ptr = shape.get(); REQUIRE(canvas->push(move(shape)) == Result::Success); REQUIRE(canvas->update(ptr) == Result::Success); - REQUIRE(canvas->update(nullptr) == Result::Success); + REQUIRE(canvas->update() == Result::Success); REQUIRE(canvas->draw() == Result::Success); - REQUIRE(canvas->update(nullptr) == Result::InsufficientCondition); + REQUIRE(canvas->update() == Result::InsufficientCondition); REQUIRE(canvas->clear() == Result::Success); @@ -243,4 +243,4 @@ TEST_CASE("Asynchronized Drawing", "[tvgSwCanvasBase]") REQUIRE(canvas->sync() == Result::Success); REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success); -} \ No newline at end of file +} -- 2.7.4