mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
Format code files with dos2unix, ensure newline at EOF
This commit is contained in:
parent
cb4bba83d9
commit
46c3fc1f94
30 changed files with 209 additions and 209 deletions
|
@ -164,4 +164,4 @@ int main(int argc, char **argv)
|
||||||
cout << "engine is not supported" << endl;
|
cout << "engine is not supported" << endl;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,4 +187,4 @@ int main(int argc, char **argv)
|
||||||
cout << "engine is not supported" << endl;
|
cout << "engine is not supported" << endl;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,4 +187,4 @@ int main(int argc, char **argv)
|
||||||
cout << "engine is not supported" << endl;
|
cout << "engine is not supported" << endl;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,65 +1,65 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
* in the Software without restriction, including without limitation the rights
|
* in the Software without restriction, including without limitation the rights
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
* furnished to do so, subject to the following conditions:
|
* furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
* copies or substantial portions of the Software.
|
* copies or substantial portions of the Software.
|
||||||
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _TVG_GL_COMMON_H_
|
#ifndef _TVG_GL_COMMON_H_
|
||||||
#define _TVG_GL_COMMON_H_
|
#define _TVG_GL_COMMON_H_
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <GLES2/gl2.h>
|
#include <GLES2/gl2.h>
|
||||||
#include "tvgCommon.h"
|
#include "tvgCommon.h"
|
||||||
#include "tvgRender.h"
|
#include "tvgRender.h"
|
||||||
|
|
||||||
|
|
||||||
#define GL_CHECK(x) \
|
#define GL_CHECK(x) \
|
||||||
x; \
|
x; \
|
||||||
do { \
|
do { \
|
||||||
GLenum glError = glGetError(); \
|
GLenum glError = glGetError(); \
|
||||||
if(glError != GL_NO_ERROR) { \
|
if(glError != GL_NO_ERROR) { \
|
||||||
TVGERR("GL_ENGINE", "glGetError() = %i (0x%.8x)", glError, glError); \
|
TVGERR("GL_ENGINE", "glGetError() = %i (0x%.8x)", glError, glError); \
|
||||||
assert(0); \
|
assert(0); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define EGL_CHECK(x) \
|
#define EGL_CHECK(x) \
|
||||||
x; \
|
x; \
|
||||||
do { \
|
do { \
|
||||||
EGLint eglError = eglGetError(); \
|
EGLint eglError = eglGetError(); \
|
||||||
if(eglError != EGL_SUCCESS) { \
|
if(eglError != EGL_SUCCESS) { \
|
||||||
TVGERR("GL_ENGINE", "eglGetError() = %i (0x%.8x)", eglError, eglError); \
|
TVGERR("GL_ENGINE", "eglGetError() = %i (0x%.8x)", eglError, eglError); \
|
||||||
assert(0); \
|
assert(0); \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
class GlGeometry;
|
class GlGeometry;
|
||||||
|
|
||||||
struct GlShape
|
struct GlShape
|
||||||
{
|
{
|
||||||
const Shape* shape = nullptr;
|
const Shape* shape = nullptr;
|
||||||
float viewWd;
|
float viewWd;
|
||||||
float viewHt;
|
float viewHt;
|
||||||
RenderUpdateFlag updateFlag = None;
|
RenderUpdateFlag updateFlag = None;
|
||||||
unique_ptr<GlGeometry> geometry;
|
unique_ptr<GlGeometry> geometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* _TVG_GL_COMMON_H_ */
|
#endif /* _TVG_GL_COMMON_H_ */
|
||||||
|
|
|
@ -52,4 +52,4 @@ void GlGpuBuffer::updateBufferData(Target target, uint32_t size, const void* dat
|
||||||
void GlGpuBuffer::unbind(Target target)
|
void GlGpuBuffer::unbind(Target target)
|
||||||
{
|
{
|
||||||
GL_CHECK(glBindBuffer(static_cast<uint32_t>(target), 0));
|
GL_CHECK(glBindBuffer(static_cast<uint32_t>(target), 0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
@ -499,4 +499,4 @@ bool mathUpdateOutlineBBox(const SwOutline* outline, const SwBBox& clipRegion, S
|
||||||
renderRegion.max.y = (yMax + 63) >> 6;
|
renderRegion.max.y = (yMax + 63) >> 6;
|
||||||
}
|
}
|
||||||
return mathClipBBox(clipRegion, renderRegion);
|
return mathClipBBox(clipRegion, renderRegion);
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,4 +153,4 @@ bool mpoolTerm(SwMpool* mpool)
|
||||||
free(mpool);
|
free(mpool);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
|
|
@ -61,4 +61,4 @@ static bool inline cRasterTranslucentRect(SwSurface* surface, const SwBBox& regi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -599,4 +599,4 @@ static bool _rasterTexmapPolygon(SwSurface* surface, const SwImage* image, const
|
||||||
_rasterPolygonImage(surface, image, region, opacity, polygon, blendMethod, aaSpans);
|
_rasterPolygonImage(surface, image, region, opacity, polygon, blendMethod, aaSpans);
|
||||||
|
|
||||||
return _apply(surface, aaSpans);
|
return _apply(surface, aaSpans);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1040,4 +1040,4 @@ void rleClipRect(SwRleData *rle, const SwBBox* clip)
|
||||||
_replaceClipSpan(rle, spans, spansEnd - spans);
|
_replaceClipSpan(rle, spans, spansEnd - spans);
|
||||||
|
|
||||||
TVGLOG("SW_ENGINE", "Using ClipRect!");
|
TVGLOG("SW_ENGINE", "Using ClipRect!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
|
|
@ -81,4 +81,4 @@ Accessor::Accessor()
|
||||||
unique_ptr<Accessor> Accessor::gen() noexcept
|
unique_ptr<Accessor> Accessor::gen() noexcept
|
||||||
{
|
{
|
||||||
return unique_ptr<Accessor>(new Accessor);
|
return unique_ptr<Accessor>(new Accessor);
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,4 +112,4 @@ Fill* Fill::duplicate() const noexcept
|
||||||
uint32_t Fill::identifier() const noexcept
|
uint32_t Fill::identifier() const noexcept
|
||||||
{
|
{
|
||||||
return pImpl->id;
|
return pImpl->id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,4 +118,4 @@ const uint32_t* Picture::data(uint32_t* w, uint32_t* h) const noexcept
|
||||||
}
|
}
|
||||||
if (pImpl->surface) return pImpl->surface->buffer;
|
if (pImpl->surface) return pImpl->surface->buffer;
|
||||||
else return nullptr;
|
else return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,4 +94,4 @@ unique_ptr<RadialGradient> RadialGradient::gen() noexcept
|
||||||
uint32_t RadialGradient::identifier() noexcept
|
uint32_t RadialGradient::identifier() noexcept
|
||||||
{
|
{
|
||||||
return TVG_CLASS_ID_RADIAL;
|
return TVG_CLASS_ID_RADIAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,4 +70,4 @@ RenderTransform::RenderTransform()
|
||||||
RenderTransform::RenderTransform(const RenderTransform* lhs, const RenderTransform* rhs)
|
RenderTransform::RenderTransform(const RenderTransform* lhs, const RenderTransform* rhs)
|
||||||
{
|
{
|
||||||
m = mathMultiply(&lhs->m, &rhs->m);
|
m = mathMultiply(&lhs->m, &rhs->m);
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,4 +73,4 @@ Result Scene::clear(bool free) noexcept
|
||||||
pImpl->clear(free);
|
pImpl->clear(free);
|
||||||
|
|
||||||
return Result::Success;
|
return Result::Success;
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,4 +424,4 @@ Result Shape::fill(FillRule r) noexcept
|
||||||
FillRule Shape::fillRule() const noexcept
|
FillRule Shape::fillRule() const noexcept
|
||||||
{
|
{
|
||||||
return pImpl->rule;
|
return pImpl->rule;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,4 +102,4 @@ unique_ptr<SwCanvas> SwCanvas::gen() noexcept
|
||||||
return unique_ptr<SwCanvas>(new SwCanvas);
|
return unique_ptr<SwCanvas>(new SwCanvas);
|
||||||
#endif
|
#endif
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,4 +134,4 @@ void JpgLoader::run(unsigned tid)
|
||||||
image = nullptr;
|
image = nullptr;
|
||||||
}
|
}
|
||||||
image = jpgdDecompress(decoder);
|
image = jpgdDecompress(decoder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2644,4 +2644,4 @@ void lodepng_state_cleanup(LodePNGState* state)
|
||||||
{
|
{
|
||||||
lodepng_color_mode_cleanup(&state->info_raw);
|
lodepng_color_mode_cleanup(&state->info_raw);
|
||||||
lodepng_info_cleanup(&state->info_png);
|
lodepng_info_cleanup(&state->info_png);
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,4 +171,4 @@ void lodepng_state_cleanup(LodePNGState* state);
|
||||||
unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize);
|
unsigned lodepng_decode(unsigned char** out, unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize);
|
||||||
unsigned lodepng_inspect(unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize);
|
unsigned lodepng_inspect(unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize);
|
||||||
|
|
||||||
#endif //_TVG_LODEPNG_H_
|
#endif //_TVG_LODEPNG_H_
|
||||||
|
|
|
@ -51,4 +51,4 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //_TVG_TVG_COMMON_H_
|
#endif //_TVG_TVG_COMMON_H_
|
||||||
|
|
|
@ -1,115 +1,115 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
* Copyright (c) 2021 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
|
||||||
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
* in the Software without restriction, including without limitation the rights
|
* in the Software without restriction, including without limitation the rights
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
* furnished to do so, subject to the following conditions:
|
* furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
* The above copyright notice and this permission notice shall be included in all
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
* copies or substantial portions of the Software.
|
* copies or substantial portions of the Software.
|
||||||
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <thorvg_capi.h>
|
#include <thorvg_capi.h>
|
||||||
#include "../catch.hpp"
|
#include "../catch.hpp"
|
||||||
|
|
||||||
TEST_CASE("Create a Scene", "[capiScene]")
|
TEST_CASE("Create a Scene", "[capiScene]")
|
||||||
{
|
{
|
||||||
Tvg_Paint* scene = tvg_scene_new();
|
Tvg_Paint* scene = tvg_scene_new();
|
||||||
REQUIRE(scene);
|
REQUIRE(scene);
|
||||||
|
|
||||||
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Paints Into a Scene", "[capiScene]")
|
TEST_CASE("Paints Into a Scene", "[capiScene]")
|
||||||
{
|
{
|
||||||
Tvg_Paint* scene = tvg_scene_new();
|
Tvg_Paint* scene = tvg_scene_new();
|
||||||
REQUIRE(scene);
|
REQUIRE(scene);
|
||||||
|
|
||||||
//Pushing Paints
|
//Pushing Paints
|
||||||
REQUIRE(tvg_scene_push(scene, tvg_shape_new()) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_push(scene, tvg_shape_new()) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(tvg_scene_push(scene, tvg_picture_new()) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_push(scene, tvg_picture_new()) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(tvg_scene_push(scene, tvg_scene_new()) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_push(scene, tvg_scene_new()) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
//Pushing Null Pointer
|
//Pushing Null Pointer
|
||||||
REQUIRE(tvg_scene_push(scene, NULL) == TVG_RESULT_INVALID_ARGUMENT);
|
REQUIRE(tvg_scene_push(scene, NULL) == TVG_RESULT_INVALID_ARGUMENT);
|
||||||
REQUIRE(tvg_scene_push(NULL, NULL) == TVG_RESULT_INVALID_ARGUMENT);
|
REQUIRE(tvg_scene_push(NULL, NULL) == TVG_RESULT_INVALID_ARGUMENT);
|
||||||
|
|
||||||
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Scene Reservation", "[capiScene]")
|
TEST_CASE("Scene Reservation", "[capiScene]")
|
||||||
{
|
{
|
||||||
Tvg_Paint* scene = tvg_scene_new();
|
Tvg_Paint* scene = tvg_scene_new();
|
||||||
REQUIRE(scene);
|
REQUIRE(scene);
|
||||||
|
|
||||||
//Check Growth / Reduction
|
//Check Growth / Reduction
|
||||||
REQUIRE(tvg_scene_reserve(scene, 100) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_reserve(scene, 100) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(tvg_scene_reserve(scene, 1000) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_reserve(scene, 1000) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(tvg_scene_reserve(scene, 100) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_reserve(scene, 100) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(tvg_scene_reserve(scene, 0) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_reserve(scene, 0) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
//Invalid scene
|
//Invalid scene
|
||||||
REQUIRE(tvg_scene_reserve(NULL, 1) == TVG_RESULT_INVALID_ARGUMENT);
|
REQUIRE(tvg_scene_reserve(NULL, 1) == TVG_RESULT_INVALID_ARGUMENT);
|
||||||
|
|
||||||
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Clear the Scene", "[capiScene]")
|
TEST_CASE("Clear the Scene", "[capiScene]")
|
||||||
{
|
{
|
||||||
Tvg_Paint* scene = tvg_scene_new();
|
Tvg_Paint* scene = tvg_scene_new();
|
||||||
REQUIRE(scene);
|
REQUIRE(scene);
|
||||||
|
|
||||||
REQUIRE(tvg_scene_push(scene, tvg_shape_new()) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_push(scene, tvg_shape_new()) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(tvg_scene_clear(scene, true) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_clear(scene, true) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
//Invalid scene
|
//Invalid scene
|
||||||
REQUIRE(tvg_scene_clear(NULL, false) == TVG_RESULT_INVALID_ARGUMENT);
|
REQUIRE(tvg_scene_clear(NULL, false) == TVG_RESULT_INVALID_ARGUMENT);
|
||||||
|
|
||||||
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Scene reusing paints", "[capiScene]")
|
TEST_CASE("Scene reusing paints", "[capiScene]")
|
||||||
{
|
{
|
||||||
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
Tvg_Canvas* canvas = tvg_swcanvas_create();
|
Tvg_Canvas* canvas = tvg_swcanvas_create();
|
||||||
REQUIRE(canvas);
|
REQUIRE(canvas);
|
||||||
|
|
||||||
uint32_t* buffer = (uint32_t*) malloc(sizeof(uint32_t) * 200 * 200);
|
uint32_t* buffer = (uint32_t*) malloc(sizeof(uint32_t) * 200 * 200);
|
||||||
REQUIRE(buffer);
|
REQUIRE(buffer);
|
||||||
|
|
||||||
REQUIRE(tvg_swcanvas_set_target(canvas, buffer, 200, 200, 200, TVG_COLORSPACE_ARGB8888) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_swcanvas_set_target(canvas, buffer, 200, 200, 200, TVG_COLORSPACE_ARGB8888) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
Tvg_Paint* scene = tvg_scene_new();
|
Tvg_Paint* scene = tvg_scene_new();
|
||||||
REQUIRE(scene);
|
REQUIRE(scene);
|
||||||
|
|
||||||
Tvg_Paint* shape = tvg_shape_new();
|
Tvg_Paint* shape = tvg_shape_new();
|
||||||
REQUIRE(shape);
|
REQUIRE(shape);
|
||||||
|
|
||||||
REQUIRE(tvg_scene_push(scene, shape) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_push(scene, shape) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(tvg_canvas_push(canvas, scene) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_canvas_push(canvas, scene) == TVG_RESULT_SUCCESS);
|
||||||
REQUIRE(tvg_canvas_update(canvas) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_canvas_update(canvas) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
//No deallocate shape.
|
//No deallocate shape.
|
||||||
REQUIRE(tvg_scene_clear(scene, false) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_clear(scene, false) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
//Reuse shape.
|
//Reuse shape.
|
||||||
REQUIRE(tvg_scene_push(scene, shape) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_scene_push(scene, shape) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
REQUIRE(tvg_canvas_destroy(canvas) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_canvas_destroy(canvas) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,4 +51,4 @@ TEST_CASE("Negative termination", "[tvgInitializer]")
|
||||||
TEST_CASE("Invalid engine", "[tvgInitializer]")
|
TEST_CASE("Invalid engine", "[tvgInitializer]")
|
||||||
{
|
{
|
||||||
REQUIRE(Initializer::init(CanvasEngine(0), 0) == Result::InvalidArguments);
|
REQUIRE(Initializer::init(CanvasEngine(0), 0) == Result::InvalidArguments);
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,4 +213,4 @@ TEST_CASE("Composition", "[tvgPaint]")
|
||||||
|
|
||||||
REQUIRE(shape->composite(&pComp2) == CompositeMethod::InvAlphaMask);
|
REQUIRE(shape->composite(&pComp2) == CompositeMethod::InvAlphaMask);
|
||||||
REQUIRE(pComp == pComp2);
|
REQUIRE(pComp == pComp2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,4 +206,4 @@ TEST_CASE("Shape Filling", "[tvgShape]")
|
||||||
REQUIRE(shape->fillRule() == FillRule::Winding);
|
REQUIRE(shape->fillRule() == FillRule::Winding);
|
||||||
REQUIRE(shape->fill(FillRule::EvenOdd) == Result::Success);
|
REQUIRE(shape->fill(FillRule::EvenOdd) == Result::Success);
|
||||||
REQUIRE(shape->fillRule() == FillRule::EvenOdd);
|
REQUIRE(shape->fillRule() == FillRule::EvenOdd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue