Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ThorVG: Update from v0.11.2 to v0.11.6 #86623

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion thirdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ instead of `miniz.h` as an external dependency.
## thorvg

- Upstream: https://github.com/thorvg/thorvg
- Version: 0.11.2 (b01fe9bf4461146304d3520d6dc699cf580a3744, 2023)
- Version: 0.11.6 (3dba4f12f8f05f86acbc51096ca3a15f5d96bc06, 2023)
- License: MIT

Files extracted from upstream source:
Expand Down
2 changes: 1 addition & 1 deletion thirdparty/thorvg/inc/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
// For internal debugging:
//#define THORVG_LOG_ENABLED

#define THORVG_VERSION_STRING "0.11.2"
#define THORVG_VERSION_STRING "0.11.6"
#endif
37 changes: 31 additions & 6 deletions thirdparty/thorvg/inc/thorvg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1664,14 +1664,14 @@ class TVG_API Animation
* @param[in] no The index of the animation frame to be displayed. The index should be less than the totalFrame().
*
* @retval Result::Success Successfully set the frame.
* @retval Result::InsufficientCondition No animatable data loaded from the Picture.
* @retval Result::NonSupport The Picture data does not support animations.
* @retval Result::InsufficientCondition if the given @p no is the same as the current frame value.
* @retval Result::NonSupport The current Picture data does not support animations.
*
* @see totalFrame()
*
* @BETA_API
*/
Result frame(uint32_t no) noexcept;
Result frame(float no) noexcept;

/**
* @brief Retrieves a picture instance associated with this animation instance.
Expand All @@ -1695,12 +1695,12 @@ class TVG_API Animation
*
* @note If the Picture is not properly configured, this function will return 0.
*
* @see Animation::frame(uint32_t no)
* @see Animation::frame(float no)
* @see Animation::totalFrame()
*
* @BETA_API
*/
uint32_t curFrame() const noexcept;
float curFrame() const noexcept;

/**
* @brief Retrieves the total number of frames in the animation.
Expand All @@ -1712,7 +1712,7 @@ class TVG_API Animation
*
* @BETA_API
*/
uint32_t totalFrame() const noexcept;
float totalFrame() const noexcept;

/**
* @brief Retrieves the duration of the animation in seconds.
Expand Down Expand Up @@ -1784,6 +1784,31 @@ class TVG_API Saver final
*/
Result save(std::unique_ptr<Paint> paint, const std::string& path, bool compress = true) noexcept;

/**
* @brief Export the provided animation data to the specified file path.
*
* This function exports the given animation data to the provided file path. You can also specify the desired frame rate in frames per second (FPS) by providing the fps parameter.
*
* @param[in] animation The animation to be saved, including all associated properties.
* @param[in] path The path to the file where the animation will be saved.
* @param[in] quality The encoded quality level. @c 0 is the minimum, @c 100 is the maximum value(recommended).
* @param[in] fps The desired frames per second (FPS). For example, to encode data at 60 FPS, pass 60. Pass 0 to keep the original frame data.
*
* @return Result::Success if the export succeeds.
* @return Result::InsufficientCondition if there are ongoing resource-saving operations.
* @return Result::NonSupport if an attempt is made to save the file with an unknown extension or in an unsupported format.
* @return Result::MemoryCorruption in case of an internal error.
* @return Result::Unknown if attempting to save an empty paint.
*
* @note A higher frames per second (FPS) would result in a larger file size. It is recommended to use the default value.
* @note Saving can be asynchronous if the assigned thread number is greater than zero. To guarantee the saving is done, call sync() afterwards.
*
* @see Saver::sync()
*
* @note: Experimental API
*/
Result save(std::unique_ptr<Animation> animation, const std::string& path, uint32_t quality = 100, uint32_t fps = 0) noexcept;

/**
* @brief Guarantees that the saving task is finished.
*
Expand Down
1 change: 1 addition & 0 deletions thirdparty/thorvg/src/common/tvgArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <memory.h>
#include <cstdint>
#include <cstdlib>

namespace tvg
{
Expand Down
6 changes: 3 additions & 3 deletions thirdparty/thorvg/src/loaders/external_png/tvgPngLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ unique_ptr<Surface> PngLoader::bitmap()
//TODO: It's better to keep this surface instance in the loader side
auto surface = new Surface;
surface->buf32 = content;
surface->stride = w;
surface->w = w;
surface->h = h;
surface->stride = (uint32_t)w;
surface->w = (uint32_t)w;
surface->h = (uint32_t)h;
surface->cs = cs;
surface->channelSize = sizeof(uint32_t);
surface->owner = true;
Expand Down
6 changes: 5 additions & 1 deletion thirdparty/thorvg/src/loaders/jpg/tvgJpgd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,11 @@ void jpeg_decoder::locate_sof_marker()
int c = process_markers();

switch (c) {
case M_SOF2: m_progressive_flag = true;
case M_SOF2: {
m_progressive_flag = true;
read_sof_marker();
break;
}
case M_SOF0: /* baseline DCT */
case M_SOF1: { /* extended sequential DCT */
read_sof_marker();
Expand Down
11 changes: 10 additions & 1 deletion thirdparty/thorvg/src/renderer/sw_engine/tvgSwCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,16 @@ static double timeStamp()
#define SW_ANGLE_PI (180L << 16)
#define SW_ANGLE_2PI (SW_ANGLE_PI << 1)
#define SW_ANGLE_PI2 (SW_ANGLE_PI >> 1)
#define SW_ANGLE_PI4 (SW_ANGLE_PI >> 2)

using SwCoord = signed long;
using SwFixed = signed long long;


static inline float TO_FLOAT(SwCoord val)
{
return static_cast<float>(val) / 64.0f;
}

struct SwPoint
{
SwCoord x, y;
Expand Down Expand Up @@ -92,6 +97,10 @@ struct SwPoint
else return false;
}

Point toPoint() const
{
return {TO_FLOAT(x), TO_FLOAT(y)};
}
};

struct SwSize
Expand Down
Loading
Loading