Skip to content

Commit

Permalink
71
Browse files Browse the repository at this point in the history
71
  • Loading branch information
umerov1999 committed Sep 7, 2024
1 parent 6f89adc commit 7d41e97
Show file tree
Hide file tree
Showing 157 changed files with 1,712 additions and 1,411 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@ class JsonBuilder internal constructor(json: Json) {
* Removes JSON specification restriction (RFC-4627) and makes parser
* more liberal to the malformed input. In lenient mode, unquoted JSON keys and string values are allowed.
*
* Example of invalid JSON that is accepted with this flag set:
* `{key: value}` can be parsed into `@Serializable class Data(val key: String)`.
*
* Its relaxations can be expanded in the future, so that lenient parser becomes even more
* permissive to invalid values in the input.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class JsonConfiguration @OptIn(ExperimentalSerializationApi::class) internal con
* Defines which classes and objects should have their serial name included in the json as so-called class discriminator.
*
* Class discriminator is a JSON field added by kotlinx.serialization that has [JsonBuilder.classDiscriminator] as a key (`type` by default),
* and class' serial name as a value (fully-qualified name by default, can be changed with SerialName annotation).
* and class' serial name as a value (fully qualified name by default, can be changed with SerialName annotation).
*
* Class discriminator is important for serializing and deserializing [polymorphic class hierarchies](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/polymorphism.md#sealed-classes).
* Default [ClassDiscriminatorMode.POLYMORPHIC] mode adds discriminator only to polymorphic classes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@ class JsonBuilder internal constructor(json: Json) {
* Removes JSON specification restriction (RFC-4627) and makes parser
* more liberal to the malformed input. In lenient mode, unquoted JSON keys and string values are allowed.
*
* Example of invalid JSON that is accepted with this flag set:
* `{key: value}` can be parsed into `@Serializable class Data(val key: String)`.
*
* Its relaxations can be expanded in the future, so that lenient parser becomes even more
* permissive to invalid values in the input.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class JsonConfiguration @OptIn(ExperimentalSerializationApi::class) internal con
* Defines which classes and objects should have their serial name included in the json as so-called class discriminator.
*
* Class discriminator is a JSON field added by kotlinx.serialization that has [JsonBuilder.classDiscriminator] as a key (`type` by default),
* and class' serial name as a value (fully-qualified name by default, can be changed with SerialName annotation).
* and class' serial name as a value (fully qualified name by default, can be changed with SerialName annotation).
*
* Class discriminator is important for serializing and deserializing [polymorphic class hierarchies](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/polymorphism.md#sealed-classes).
* Default [ClassDiscriminatorMode.POLYMORPHIC] mode adds discriminator only to polymorphic classes.
Expand Down
30 changes: 15 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {

ext.appCompileSDK = 35
ext.appBuildTools = "35.0.0"
ext.appNdk = "27.0.12077973"
ext.appNdk = "27.1.12297006"
ext.appMinSDK = is_developer_build ? 29 : 21
ext.appTargetSDK = 31
ext.appFenrirVersionCode = 999
Expand All @@ -13,15 +13,15 @@ buildscript {
ext.appFileGalleryVersionName = "1.999"

//androidx libraries
ext.activityVersion = "1.9.1"
ext.activityVersion = "1.9.2"
ext.annotationVersion = "1.8.2"
ext.appcompatVersion = "1.7.0"
ext.biometricVersion = "1.4.0-alpha02"
ext.browserVersion = "1.8.0"
ext.cardviewVersion = "1.0.0"
ext.collectionVersion = "1.4.3"
ext.collectionVersion = "1.5.0-alpha01"
ext.concurentVersion = "1.2.0"
ext.constraintlayoutVersion = "2.2.0-alpha14"
ext.constraintlayoutVersion = "2.2.0-beta01"
ext.coordinatorlayoutVersion = "1.3.0-alpha02"
ext.coreVersion = "1.13.1"
ext.customviewVersion = "1.2.0-alpha02"
Expand All @@ -30,9 +30,9 @@ buildscript {
ext.drawerlayoutVersion = "1.2.0"
ext.dynamicanimationVersion = "1.1.0-alpha03"
ext.exifinterfaceVersion = "1.3.7"
ext.fragmentVersion = "1.8.2"
ext.graphicsVersion = "1.0.0"
ext.lifecycleVersion = "2.8.4"
ext.fragmentVersion = "1.8.3"
ext.graphicsVersion = "1.0.1"
ext.lifecycleVersion = "2.8.5"
ext.mediaVersion = "1.7.0"
ext.media3Version = "1.4.1"
ext.resourceInspectionAnnotation = "1.0.1"
Expand All @@ -41,8 +41,8 @@ buildscript {
ext.tracingVersion = "1.2.0"
ext.transitionVersion = "1.5.1"
ext.vectordrawableVersion = "1.2.0"
ext.webkitVersion = "1.12.0-beta01"
ext.workVersion = "2.10.0-alpha02"
ext.webkitVersion = "1.12.0-rc01"
ext.workVersion = "2.10.0-alpha03"

//firebase libraries
ext.firebaseDatatransportVersion = "19.0.0"
Expand All @@ -51,7 +51,7 @@ buildscript {
//firebase common libraries
ext.firebaseCommonVersion = "21.0.0"
ext.firebaseInstallationsInteropVersion = "17.2.0"
ext.firebaseComponentsVersion = "18.0.0"
ext.firebaseComponentsVersion = "18.0.1"
ext.firebaseAnnotationsVersion = "16.2.0"
ext.playServicesTasksVersion = "18.2.0"
ext.playServicesBase = "18.5.0"
Expand All @@ -60,15 +60,15 @@ buildscript {
//common libraries
ext.kotlin_version = "2.0.20"
ext.kotlin_coroutines = "1.9.0-RC.2"
ext.kotlin_serializer = "1.7.1"
ext.kotlin_serializer = "1.7.2"
ext.okhttpLibraryVersion = "5.0.0-SNAPSHOT"
//ext.okhttpLibraryVersion = "5.0.0-alpha.14"
ext.okioVersion = "3.9.0"
ext.guavaVersion = "33.3.0-android"
ext.errorProneVersion = "2.30.0"
ext.errorProneVersion = "2.31.0"
ext.checkerCompatQualVersion = "2.5.6"
ext.checkerQualAndroidVersion = "3.46.0"
ext.desugarLibraryVersion = "2.1.0"
ext.checkerQualAndroidVersion = "3.47.0"
ext.desugarLibraryVersion = "2.1.2"

//APP_PROPS
ext.targetAbi = is_developer_build ? ["arm64-v8a", "x86_64"] : ["arm64-v8a", "armeabi-v7a", "x86_64"]
Expand All @@ -93,7 +93,7 @@ buildscript {
//maven { url 'https://s01.oss.sonatype.org/content/repositories/snapshots/' }
}
dependencies {
classpath "com.android.tools.build:gradle:8.6.0-rc01"
classpath "com.android.tools.build:gradle:8.6.0"
classpath "com.google.gms:google-services:4.4.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
Expand Down
2 changes: 1 addition & 1 deletion libfenrir/ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rm -r -f ".git"

ENABLED_DECODERS=(mpeg4 h264 hevc mp3 aac ac3 eac3 flac vorbis alac)
HOST_PLATFORM="linux-x86_64"
NDK_PATH="$HOME/Android/Sdk/ndk/27.0.12077973"
NDK_PATH="$HOME/Android/Sdk/ndk/27.1.12297006"

echo 'Please input platform version (Example 21 - Android 5.0): '
read ANDROID_PLATFORM
Expand Down
3 changes: 2 additions & 1 deletion libfenrir/src/main/jni/animation/thorvg/inc/thorvg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1745,6 +1745,7 @@ class TVG_API WgCanvas final : public Canvas
* @param[in] surface WGPUSurface, handle to a presentable surface.
* @param[in] w The width of the surface.
* @param[in] h The height of the surface.
* @param[in] device WGPUDevice, a desired handle for the wgpu device. If it is @c nullptr, ThorVG will assign an appropriate device internally.
*
* @retval Result::InsufficientCondition if the canvas is performing rendering. Please ensure the canvas is synced.
* @retval Result::NonSupport In case the wg engine is not supported.
Expand All @@ -1754,7 +1755,7 @@ class TVG_API WgCanvas final : public Canvas
* @see Canvas::viewport()
* @see Canvas::sync()
*/
Result target(void* instance, void* surface, uint32_t w, uint32_t h) noexcept;
Result target(void* instance, void* surface, uint32_t w, uint32_t h, void* device = nullptr) noexcept;

/**
* @brief Creates a new WgCanvas object.
Expand Down
16 changes: 12 additions & 4 deletions libfenrir/src/main/jni/animation/thorvg/src/common/tvgMath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,8 @@ bool inverse(const Matrix* m, Matrix* out)
m->e12 * (m->e21 * m->e33 - m->e23 * m->e31) +
m->e13 * (m->e21 * m->e32 - m->e22 * m->e31);

if (tvg::zero(det)) return false;

auto invDet = 1 / det;
auto invDet = 1.0f / det;
if (std::isinf(invDet)) return false;

out->e11 = (m->e22 * m->e33 - m->e32 * m->e23) * invDet;
out->e12 = (m->e13 * m->e32 - m->e12 * m->e33) * invDet;
Expand Down Expand Up @@ -363,4 +362,13 @@ float Bezier::angle(float t) const
return rad2deg(tvg::atan2(pt.y, pt.x));
}

}

uint8_t lerp(const uint8_t &start, const uint8_t &end, float t)
{
auto result = static_cast<int>(start + (end - start) * t);
tvg::clamp(result, 0, 255);
return static_cast<uint8_t>(result);
}

}

11 changes: 10 additions & 1 deletion libfenrir/src/main/jni/animation/thorvg/src/common/tvgMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#define _USE_MATH_DEFINES

#include <float.h>
#include <math.h>
#include <cmath>
#include "tvgCommon.h"

namespace tvg
Expand Down Expand Up @@ -68,6 +68,13 @@ static inline bool equal(float a, float b)
}


template <typename T>
static inline void clamp(T& v, const T& min, const T& max)
{
if (v < min) v = min;
else if (v > max) v = max;
}

/************************************************************************/
/* Matrix functions */
/************************************************************************/
Expand Down Expand Up @@ -286,6 +293,8 @@ static inline T lerp(const T &start, const T &end, float t)
return static_cast<T>(start + (end - start) * t);
}

uint8_t lerp(const uint8_t &start, const uint8_t &end, float t);

}

#endif //_TVG_MATH_H_
10 changes: 0 additions & 10 deletions libfenrir/src/main/jni/animation/thorvg/src/common/tvgStr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,6 @@ float strToFloat(const char *nPtr, char **endPtr)
return 0.0f;
}


int str2int(const char* str, size_t n)
{
int ret = 0;
for(size_t i = 0; i < n; ++i) {
ret = ret * 10 + (str[i] - '0');
}
return ret;
}

char* strDuplicate(const char *str, size_t n)
{
auto len = strlen(str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ namespace tvg
{

float strToFloat(const char *nPtr, char **endPtr); //convert to float
int str2int(const char* str, size_t n); //convert to integer
char* strDuplicate(const char *str, size_t n); //copy the string
char* strDirname(const char* path); //return the full directory name

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,11 @@ static bool _hslToRgb(float hue, float saturation, float brightness, uint8_t* re
float _red = 0, _green = 0, _blue = 0;
uint32_t i = 0;

while (hue < 0) hue += 360.0f;
hue = fmod(hue, 360.0f);
saturation = saturation > 0 ? std::min(saturation, 1.0f) : 0.0f;
brightness = brightness > 0 ? std::min(brightness, 1.0f) : 0.0f;

if (tvg::zero(saturation)) _red = _green = _blue = brightness;
else {
if (tvg::equal(hue, 360.0)) hue = 0.0f;
Expand Down Expand Up @@ -718,7 +723,6 @@ static bool _toColor(const char* str, uint8_t* r, uint8_t* g, uint8_t* b, char**
const char* hue = nullptr;
if (_parseNumber(&content, &hue, &th) && hue) {
const char* saturation = nullptr;
th = float(uint32_t(th) % 360);
hue = _skipSpace(hue, nullptr);
hue = (char*)_skipComma(hue);
hue = _skipSpace(hue, nullptr);
Expand Down Expand Up @@ -3288,6 +3292,7 @@ static void _svgLoaderParserXmlClose(SvgLoaderData* loader, const char* content,
for (unsigned int i = 0; i < sizeof(graphicsTags) / sizeof(graphicsTags[0]); i++) {
if (!strncmp(tagName, graphicsTags[i].tag, sz)) {
loader->currentGraphicsNode = nullptr;
if (!strncmp(tagName, "text", 4)) loader->openedTag = OpenedTagType::Other;
loader->stack.pop();
break;
}
Expand Down Expand Up @@ -3361,11 +3366,9 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
node = method(loader, parent, attrs, attrsLength, simpleXmlParseAttributes);
if (node && !empty) {
if (!strcmp(tagName, "text")) loader->openedTag = OpenedTagType::Text;
else {
auto defs = _createDefsNode(loader, nullptr, nullptr, 0, nullptr);
loader->stack.push(defs);
loader->currentGraphicsNode = node;
}
auto defs = _createDefsNode(loader, nullptr, nullptr, 0, nullptr);
loader->stack.push(defs);
loader->currentGraphicsNode = node;
}
} else if ((gradientMethod = _findGradientFactory(tagName))) {
SvgStyleGradient* gradient;
Expand Down Expand Up @@ -3403,7 +3406,6 @@ static void _svgLoaderParserText(SvgLoaderData* loader, const char* content, uns
auto text = &loader->svgParse->node->node.text;
if (text->text) free(text->text);
text->text = strDuplicate(content, length);
loader->openedTag = OpenedTagType::Other;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ static inline uint32_t opBlendScreen(uint32_t s, uint32_t d, TVG_UNUSED uint8_t
return JOIN(255, c1, c2, c3);
}


static inline uint32_t opBlendMultiply(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a)
{
// s * d
Expand All @@ -410,7 +409,6 @@ static inline uint32_t opBlendMultiply(uint32_t s, uint32_t d, TVG_UNUSED uint8_
return JOIN(255, c1, c2, c3);
}


static inline uint32_t opBlendOverlay(uint32_t s, uint32_t d, TVG_UNUSED uint8_t a)
{
// if (2 * d < da) => 2 * s * d,
Expand Down Expand Up @@ -563,7 +561,7 @@ bool rasterShape(SwSurface* surface, SwShape* shape, uint8_t r, uint8_t g, uint8
bool rasterImage(SwSurface* surface, SwImage* image, const Matrix& transform, const SwBBox& bbox, uint8_t opacity);
bool rasterStroke(SwSurface* surface, SwShape* shape, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
bool rasterGradientStroke(SwSurface* surface, SwShape* shape, const Fill* fdata, uint8_t opacity);
bool rasterClear(SwSurface* surface, uint32_t x, uint32_t y, uint32_t w, uint32_t h);
bool rasterClear(SwSurface* surface, uint32_t x, uint32_t y, uint32_t w, uint32_t h, pixel_t val = 0);
void rasterPixel32(uint32_t *dst, uint32_t val, uint32_t offset, int32_t len);
void rasterGrayscale8(uint8_t *dst, uint8_t val, uint32_t offset, int32_t len);
void rasterUnpremultiply(Surface* surface);
Expand Down
Loading

0 comments on commit 7d41e97

Please sign in to comment.