Conversation
6955f0f to
e6fd9a3
Compare
tvgTvgHelper.h is a base file used for .tvg saver/loader module.
1c86fc0 to
c50b982
Compare
inc/thorvg.h
Outdated
| }; | ||
|
|
||
| enum class TVG_EXPORT LoaderResult { InvalidType, Success, SizeCorruption, MemoryCorruption, LogicalCorruption }; | ||
|
|
There was a problem hiding this comment.
why can't you use the Result enum?
There was a problem hiding this comment.
I prefere a special enum type with InvalidType before Success to compare if (return > Success) return;
There was a problem hiding this comment.
Moved enum from thorvg.h
| * | ||
| * @BETA_API | ||
| */ | ||
| Result paint(std::unique_ptr<Paint> paint) noexcept; |
There was a problem hiding this comment.
I'm not a big fun of such an api...
if a user needs a scene, he can use Scene::gen()
and we have an api to set a composition
src/lib/tvgLoaderMgr.h
Outdated
| #include "tvgLoader.h" | ||
|
|
||
| enum class FileType { Svg = 0, Raw, Png, Unknown }; | ||
| enum class FileType { Svg = 0, Tvg, Raw, Png, Unknown }; |
There was a problem hiding this comment.
it's a tiny thing, but please add this before Unknown, not in the middle
src/loaders/tvg/tvgTvgLoadParser.cpp
Outdated
| { | ||
| case TVG_FILL_RADIAL_GRADIENT_INDICATOR : | ||
| { // radial gradient | ||
| if (block.lenght != 12) return LoaderResult::SizeCorruption; |
There was a problem hiding this comment.
please do not use 12/8/4 and so on... if something changes it'll be horrible to find which of these vlues should be changes as well
src/loaders/tvg/tvgTvgLoadParser.cpp
Outdated
| _read_tvg_float(&x1, block.data); | ||
| _read_tvg_float(&y1, block.data + 4); | ||
| _read_tvg_float(&x2, block.data + 8); | ||
| _read_tvg_float(&y2, block.data + 12); |
src/loaders/tvg/tvgTvgLoadParser.cpp
Outdated
| * Returns true on success and moves pointer to next position or false if corrupted. | ||
| * Details: see tvgParseShape() in tvgShapeImpl.h | ||
| */ | ||
| LoaderResult tvg_read_paint(tvg_block base_block, Paint **paint) |
There was a problem hiding this comment.
why did you change the naming convention?
src/loaders/tvg/tvgTvgLoader.cpp
Outdated
| #include "tvgTvgLoader.h" | ||
| #include "tvgTvgLoadParser.h" | ||
|
|
||
| TvgLoader::TvgLoader() |
There was a problem hiding this comment.
I think it's not recommended to use an empty constr
src/loaders/tvg/tvgTvgLoader.cpp
Outdated
| if (this->buffer) | ||
| { | ||
| free(this->buffer); | ||
| this->buffer = NULL; |
src/loaders/tvg/tvgTvgLoadParser.cpp
Outdated
|
|
||
| #include <stdio.h> | ||
| #include <string.h> | ||
| #include <map> |
src/loaders/tvg/tvgTvgLoadParser.cpp
Outdated
| if (result > LoaderResult::Success) return false; | ||
| if (result == LoaderResult::Success) { | ||
| if (scene->push(unique_ptr<Paint>(paint)) != Result::Success) { | ||
| return LoaderResult::MemoryCorruption; |
There was a problem hiding this comment.
it does not compile -> no conversion rules
Tvg loader module introduction
Introduced sync loading possibility
c50b982 to
fe03b8e
Compare
For review: TVG Loader moduler