diff --git a/inc/tizenvg.h b/inc/tizenvg.h index babca5d4..1aee6bb8 100644 --- a/inc/tizenvg.h +++ b/inc/tizenvg.h @@ -90,6 +90,7 @@ public: Canvas(RenderMethod*); virtual ~Canvas(); + int reserve(size_t n); virtual int push(std::unique_ptr paint) noexcept; virtual int clear() noexcept; virtual int update() noexcept; diff --git a/src/lib/tvgCanvas.cpp b/src/lib/tvgCanvas.cpp index 3bde24f6..96b58e0c 100644 --- a/src/lib/tvgCanvas.cpp +++ b/src/lib/tvgCanvas.cpp @@ -120,6 +120,14 @@ Canvas::~Canvas() } +int Canvas::reserve(size_t n) +{ + auto impl = pImpl.get(); + assert(impl); + return impl->reserve(n); +} + + int Canvas::push(unique_ptr paint) noexcept { auto impl = pImpl.get(); diff --git a/test/testMultiShapes.cpp b/test/testMultiShapes.cpp index 94d3c31f..6fc0469f 100644 --- a/test/testMultiShapes.cpp +++ b/test/testMultiShapes.cpp @@ -15,7 +15,7 @@ void tvgtest() //Create a Canvas auto canvas = tvg::SwCanvas::gen(buffer, WIDTH, HEIGHT); - //canvas->reserve(2); //reserve 2 shape nodes (optional) + canvas->reserve(3); //reserve 3 shape nodes (optional) //Prepare Round Rectangle auto shape1 = tvg::ShapeNode::gen(); diff --git a/test/testShape.cpp b/test/testShape.cpp index c806d990..b7fca2f9 100644 --- a/test/testShape.cpp +++ b/test/testShape.cpp @@ -18,7 +18,7 @@ void tvgtest() //Prepare a Shape (Rectangle) auto shape1 = tvg::ShapeNode::gen(); - shape1->appendRect(0, 0, 400, 400, 0); //x, y, w, h, cornerRadius + shape1->appendRect(100, 100, 400, 400, 0); //x, y, w, h, cornerRadius shape1->fill(255, 0, 0, 255); //r, g, b, a /* Push the shape into the Canvas drawing list