Format code files with dos2unix, ensure newline at EOF

This commit is contained in:
Rémi Verschelde 2022-05-23 18:35:10 +02:00 committed by Hermet Park
parent cb4bba83d9
commit 46c3fc1f94
30 changed files with 209 additions and 209 deletions

View file

@ -164,4 +164,4 @@ int main(int argc, char **argv)
cout << "engine is not supported" << endl;
}
return 0;
}
}

View file

@ -187,4 +187,4 @@ int main(int argc, char **argv)
cout << "engine is not supported" << endl;
}
return 0;
}
}

View file

@ -187,4 +187,4 @@ int main(int argc, char **argv)
cout << "engine is not supported" << endl;
}
return 0;
}
}

View file

@ -1,65 +1,65 @@
/*
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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
* SOFTWARE.
*/
#ifndef _TVG_GL_COMMON_H_
#define _TVG_GL_COMMON_H_
#include <assert.h>
#include <GLES2/gl2.h>
#include "tvgCommon.h"
#include "tvgRender.h"
#define GL_CHECK(x) \
x; \
do { \
GLenum glError = glGetError(); \
if(glError != GL_NO_ERROR) { \
TVGERR("GL_ENGINE", "glGetError() = %i (0x%.8x)", glError, glError); \
assert(0); \
} \
} while(0)
#define EGL_CHECK(x) \
x; \
do { \
EGLint eglError = eglGetError(); \
if(eglError != EGL_SUCCESS) { \
TVGERR("GL_ENGINE", "eglGetError() = %i (0x%.8x)", eglError, eglError); \
assert(0); \
} \
} while(0)
class GlGeometry;
struct GlShape
{
const Shape* shape = nullptr;
float viewWd;
float viewHt;
RenderUpdateFlag updateFlag = None;
unique_ptr<GlGeometry> geometry;
};
#endif /* _TVG_GL_COMMON_H_ */
/*
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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
* SOFTWARE.
*/
#ifndef _TVG_GL_COMMON_H_
#define _TVG_GL_COMMON_H_
#include <assert.h>
#include <GLES2/gl2.h>
#include "tvgCommon.h"
#include "tvgRender.h"
#define GL_CHECK(x) \
x; \
do { \
GLenum glError = glGetError(); \
if(glError != GL_NO_ERROR) { \
TVGERR("GL_ENGINE", "glGetError() = %i (0x%.8x)", glError, glError); \
assert(0); \
} \
} while(0)
#define EGL_CHECK(x) \
x; \
do { \
EGLint eglError = eglGetError(); \
if(eglError != EGL_SUCCESS) { \
TVGERR("GL_ENGINE", "eglGetError() = %i (0x%.8x)", eglError, eglError); \
assert(0); \
} \
} while(0)
class GlGeometry;
struct GlShape
{
const Shape* shape = nullptr;
float viewWd;
float viewHt;
RenderUpdateFlag updateFlag = None;
unique_ptr<GlGeometry> geometry;
};
#endif /* _TVG_GL_COMMON_H_ */

View file

@ -52,4 +52,4 @@ void GlGpuBuffer::updateBufferData(Target target, uint32_t size, const void* dat
void GlGpuBuffer::unbind(Target target)
{
GL_CHECK(glBindBuffer(static_cast<uint32_t>(target), 0));
}
}

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
* 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;
}
return mathClipBBox(clipRegion, renderRegion);
}
}

View file

@ -153,4 +153,4 @@ bool mpoolTerm(SwMpool* mpool)
free(mpool);
return true;
}
}

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy

View file

@ -61,4 +61,4 @@ static bool inline cRasterTranslucentRect(SwSurface* surface, const SwBBox& regi
}
}
return true;
}
}

View file

@ -599,4 +599,4 @@ static bool _rasterTexmapPolygon(SwSurface* surface, const SwImage* image, const
_rasterPolygonImage(surface, image, region, opacity, polygon, blendMethod, aaSpans);
return _apply(surface, aaSpans);
}
}

View file

@ -1040,4 +1040,4 @@ void rleClipRect(SwRleData *rle, const SwBBox* clip)
_replaceClipSpan(rle, spans, spansEnd - spans);
TVGLOG("SW_ENGINE", "Using ClipRect!");
}
}

View file

@ -1,4 +1,4 @@
/*
/*
* Copyright (c) 2020 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy

View file

@ -81,4 +81,4 @@ Accessor::Accessor()
unique_ptr<Accessor> Accessor::gen() noexcept
{
return unique_ptr<Accessor>(new Accessor);
}
}

View file

@ -112,4 +112,4 @@ Fill* Fill::duplicate() const noexcept
uint32_t Fill::identifier() const noexcept
{
return pImpl->id;
}
}

View file

@ -118,4 +118,4 @@ const uint32_t* Picture::data(uint32_t* w, uint32_t* h) const noexcept
}
if (pImpl->surface) return pImpl->surface->buffer;
else return nullptr;
}
}

View file

@ -94,4 +94,4 @@ unique_ptr<RadialGradient> RadialGradient::gen() noexcept
uint32_t RadialGradient::identifier() noexcept
{
return TVG_CLASS_ID_RADIAL;
}
}

View file

@ -70,4 +70,4 @@ RenderTransform::RenderTransform()
RenderTransform::RenderTransform(const RenderTransform* lhs, const RenderTransform* rhs)
{
m = mathMultiply(&lhs->m, &rhs->m);
}
}

View file

@ -73,4 +73,4 @@ Result Scene::clear(bool free) noexcept
pImpl->clear(free);
return Result::Success;
}
}

View file

@ -424,4 +424,4 @@ Result Shape::fill(FillRule r) noexcept
FillRule Shape::fillRule() const noexcept
{
return pImpl->rule;
}
}

View file

@ -102,4 +102,4 @@ unique_ptr<SwCanvas> SwCanvas::gen() noexcept
return unique_ptr<SwCanvas>(new SwCanvas);
#endif
return nullptr;
}
}

View file

@ -134,4 +134,4 @@ void JpgLoader::run(unsigned tid)
image = nullptr;
}
image = jpgdDecompress(decoder);
}
}

View file

@ -2644,4 +2644,4 @@ void lodepng_state_cleanup(LodePNGState* state)
{
lodepng_color_mode_cleanup(&state->info_raw);
lodepng_info_cleanup(&state->info_png);
}
}

View file

@ -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_inspect(unsigned* w, unsigned* h, LodePNGState* state, const unsigned char* in, size_t insize);
#endif //_TVG_LODEPNG_H_
#endif //_TVG_LODEPNG_H_

View file

@ -51,4 +51,4 @@ public:
};
#endif //_TVG_TVG_COMMON_H_
#endif //_TVG_TVG_COMMON_H_

View file

@ -1,115 +1,115 @@
/*
* Copyright (c) 2021 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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
* SOFTWARE.
*/
#include <thorvg_capi.h>
#include "../catch.hpp"
TEST_CASE("Create a Scene", "[capiScene]")
{
Tvg_Paint* scene = tvg_scene_new();
REQUIRE(scene);
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
}
TEST_CASE("Paints Into a Scene", "[capiScene]")
{
Tvg_Paint* scene = tvg_scene_new();
REQUIRE(scene);
//Pushing Paints
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_scene_new()) == TVG_RESULT_SUCCESS);
//Pushing Null Pointer
REQUIRE(tvg_scene_push(scene, NULL) == TVG_RESULT_INVALID_ARGUMENT);
REQUIRE(tvg_scene_push(NULL, NULL) == TVG_RESULT_INVALID_ARGUMENT);
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
}
TEST_CASE("Scene Reservation", "[capiScene]")
{
Tvg_Paint* scene = tvg_scene_new();
REQUIRE(scene);
//Check Growth / Reduction
REQUIRE(tvg_scene_reserve(scene, 100) == 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, 0) == TVG_RESULT_SUCCESS);
//Invalid scene
REQUIRE(tvg_scene_reserve(NULL, 1) == TVG_RESULT_INVALID_ARGUMENT);
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
}
TEST_CASE("Clear the Scene", "[capiScene]")
{
Tvg_Paint* scene = tvg_scene_new();
REQUIRE(scene);
REQUIRE(tvg_scene_push(scene, tvg_shape_new()) == TVG_RESULT_SUCCESS);
REQUIRE(tvg_scene_clear(scene, true) == TVG_RESULT_SUCCESS);
//Invalid scene
REQUIRE(tvg_scene_clear(NULL, false) == TVG_RESULT_INVALID_ARGUMENT);
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
}
TEST_CASE("Scene reusing paints", "[capiScene]")
{
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
Tvg_Canvas* canvas = tvg_swcanvas_create();
REQUIRE(canvas);
uint32_t* buffer = (uint32_t*) malloc(sizeof(uint32_t) * 200 * 200);
REQUIRE(buffer);
REQUIRE(tvg_swcanvas_set_target(canvas, buffer, 200, 200, 200, TVG_COLORSPACE_ARGB8888) == TVG_RESULT_SUCCESS);
Tvg_Paint* scene = tvg_scene_new();
REQUIRE(scene);
Tvg_Paint* shape = tvg_shape_new();
REQUIRE(shape);
REQUIRE(tvg_scene_push(scene, shape) == TVG_RESULT_SUCCESS);
REQUIRE(tvg_canvas_push(canvas, scene) == TVG_RESULT_SUCCESS);
REQUIRE(tvg_canvas_update(canvas) == TVG_RESULT_SUCCESS);
//No deallocate shape.
REQUIRE(tvg_scene_clear(scene, false) == TVG_RESULT_SUCCESS);
//Reuse shape.
REQUIRE(tvg_scene_push(scene, shape) == TVG_RESULT_SUCCESS);
REQUIRE(tvg_canvas_destroy(canvas) == TVG_RESULT_SUCCESS);
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
free(buffer);
}
/*
* Copyright (c) 2021 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* 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
* SOFTWARE.
*/
#include <thorvg_capi.h>
#include "../catch.hpp"
TEST_CASE("Create a Scene", "[capiScene]")
{
Tvg_Paint* scene = tvg_scene_new();
REQUIRE(scene);
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
}
TEST_CASE("Paints Into a Scene", "[capiScene]")
{
Tvg_Paint* scene = tvg_scene_new();
REQUIRE(scene);
//Pushing Paints
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_scene_new()) == TVG_RESULT_SUCCESS);
//Pushing Null Pointer
REQUIRE(tvg_scene_push(scene, NULL) == TVG_RESULT_INVALID_ARGUMENT);
REQUIRE(tvg_scene_push(NULL, NULL) == TVG_RESULT_INVALID_ARGUMENT);
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
}
TEST_CASE("Scene Reservation", "[capiScene]")
{
Tvg_Paint* scene = tvg_scene_new();
REQUIRE(scene);
//Check Growth / Reduction
REQUIRE(tvg_scene_reserve(scene, 100) == 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, 0) == TVG_RESULT_SUCCESS);
//Invalid scene
REQUIRE(tvg_scene_reserve(NULL, 1) == TVG_RESULT_INVALID_ARGUMENT);
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
}
TEST_CASE("Clear the Scene", "[capiScene]")
{
Tvg_Paint* scene = tvg_scene_new();
REQUIRE(scene);
REQUIRE(tvg_scene_push(scene, tvg_shape_new()) == TVG_RESULT_SUCCESS);
REQUIRE(tvg_scene_clear(scene, true) == TVG_RESULT_SUCCESS);
//Invalid scene
REQUIRE(tvg_scene_clear(NULL, false) == TVG_RESULT_INVALID_ARGUMENT);
REQUIRE(tvg_paint_del(scene) == TVG_RESULT_SUCCESS);
}
TEST_CASE("Scene reusing paints", "[capiScene]")
{
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
Tvg_Canvas* canvas = tvg_swcanvas_create();
REQUIRE(canvas);
uint32_t* buffer = (uint32_t*) malloc(sizeof(uint32_t) * 200 * 200);
REQUIRE(buffer);
REQUIRE(tvg_swcanvas_set_target(canvas, buffer, 200, 200, 200, TVG_COLORSPACE_ARGB8888) == TVG_RESULT_SUCCESS);
Tvg_Paint* scene = tvg_scene_new();
REQUIRE(scene);
Tvg_Paint* shape = tvg_shape_new();
REQUIRE(shape);
REQUIRE(tvg_scene_push(scene, shape) == TVG_RESULT_SUCCESS);
REQUIRE(tvg_canvas_push(canvas, scene) == TVG_RESULT_SUCCESS);
REQUIRE(tvg_canvas_update(canvas) == TVG_RESULT_SUCCESS);
//No deallocate shape.
REQUIRE(tvg_scene_clear(scene, false) == TVG_RESULT_SUCCESS);
//Reuse shape.
REQUIRE(tvg_scene_push(scene, shape) == TVG_RESULT_SUCCESS);
REQUIRE(tvg_canvas_destroy(canvas) == TVG_RESULT_SUCCESS);
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
free(buffer);
}

View file

@ -51,4 +51,4 @@ TEST_CASE("Negative termination", "[tvgInitializer]")
TEST_CASE("Invalid engine", "[tvgInitializer]")
{
REQUIRE(Initializer::init(CanvasEngine(0), 0) == Result::InvalidArguments);
}
}

View file

@ -213,4 +213,4 @@ TEST_CASE("Composition", "[tvgPaint]")
REQUIRE(shape->composite(&pComp2) == CompositeMethod::InvAlphaMask);
REQUIRE(pComp == pComp2);
}
}

View file

@ -206,4 +206,4 @@ TEST_CASE("Shape Filling", "[tvgShape]")
REQUIRE(shape->fillRule() == FillRule::Winding);
REQUIRE(shape->fill(FillRule::EvenOdd) == Result::Success);
REQUIRE(shape->fillRule() == FillRule::EvenOdd);
}
}