Giter Site home page Giter Site logo

rlottie's Issues

[rlottie] Fix drawBitmap() implementaion.

As drawBitmap() api dosen't use any brush for getting fill information . it dosen't update the brush data.
If the last drawing has some brush data like transform matrix it affects the drawBitmap() implementaion.
So clear the previous brush data by setting a empty brush before rendering bitmap

bodymovin upgrade test

Bodymovin 5.5.2 version is released, there is a report rlottie doens't work on it.
Need to verify rlottie with any sample resource exported that version whether it's working or not

Windows: wrong cast of functions returnedd by GetProcAddress

../src/vector/vimageloader.cpp:53:79: error: cast between incompatible function types from 'FARPROC' {aka 'long long int ()()'} to 'lottie_image_load_f' {aka 'unsigned char ()(const char, int*, int*, int*, int)'} [-Werror=cast-function-type]

Add WINAPI in front of the function, like that :

using lottie_image_load_f = unsigned char *(WINAPI *)(const char *filename, int *x,
int *y, int *comp, int req_comp);
using lottie_image_load_data_f = unsigned char *(WINAPI *)(const char *data, int len,
int *x, int *y, int *comp,
int req_comp);
using lottie_image_free_f = void (WINAPI *)(unsigned char *);

[rlottie] Support sub surface rendering.

One requested lottie renders the frame image to the exact surface size.
There may be the case when the surface size and the required rendering size is different.
So planning to add a viewport api which will set the viewport area of the surface.
Now lottie will use the viewport size to generate the image for that frame and render it in the viewport area
of the surface

03eb0d21d54c6afa3e94c72097891b32ae25ae51 breaks compilation with MSYS2

Dependency threads found: YES
Program cmake found: YES (E:\Documents\programmes_x64\msys2\usr\bin/cmake.EXE)
Program cmake found: YES (E:\Documents\programmes_x64\msys2\usr\bin/cmake.EXE)
error retrieving cmake informations: returnCode=255 stdout= stderr=System is unknown to cmake, create:
Platform/MINGW64_NT-6.1-7601 to use this system, please send your config file to [email protected] so it can be added to cmake
System is unknown to cmake, create:
Platform/MINGW64_NT-6.1-7601 to use this system, please send your config file to [email protected] so it can be added to cmake
CMake Error at /usr/share/cmake-3.14.5/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

"/mingw64/bin/cc.exe"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: /home/vtorri/gitroot_64/rlottie_vtorri/builddir/__cmake_systeminformation/CMakeFiles/CMakeTmp

Run Build Command(s):/mingw64/bin/ninja.exe cmTC_4b2cb
[1/2] Building C object CMakeFiles/cmTC_4b2cb.dir/testCCompiler.c.obj
FAILED: CMakeFiles/cmTC_4b2cb.dir/testCCompiler.c.obj
/mingw64/bin/cc.exe    -o CMakeFiles/cmTC_4b2cb.dir/testCCompiler.c.obj   -c testCCompiler.c
CreateProcess failed: The system cannot find the file specified.
ninja: build stopped: subcommand failed.

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:6 (project)

Error: --system-information failed on internal CMake!

meson.build:58:10: ERROR: Unable to find cmake

Never include Windows.h, instead include windows.h

in src/vector/vimageloader.cpp, Windows.h is included.

When cross-compilation is done on Unix (case sensitive file system), then the compilation will fail, as windows.h and not Windows.h is provided

CAPI render image test doesn't work

/TEST Rlottie/
#include "unistd.h"
#include "stdlib.h"
#include "stdio.h"
#include "rlottie_capi.h"

int main ()
{
double duration;
size_t i, k, frame, frame_number, width = 64U, height = 64U, bytes_per_line = width * sizeof(uint32_t);
uint32_t* p_render;
uint32_t* buffer;

Lottie_Animation* animation = lottie_animation_from_file("example/resource/abstract_circle.json");

if (animation == NULL)
{
    perror("Lottie animation is NULL.\n");
    return 1;
}

lottie_animation_get_size(animation, &width, &height);

if ((width > 1024) || (height > 1024))
{
    perror("Returned size too large\n");
    return 1;
}

buffer       = (uint32_t*)calloc(bytes_per_line * height, sizeof(uint32_t));
duration     = lottie_animation_get_duration(animation);
frame_number = lottie_animation_get_totalframe(animation);
frame        = lottie_animation_get_frame_at_pos(animation, 1);

if (frame_number == 0U)
{
    perror("Lottie resource have no animation.\n");
    return 1;
}

printf ("Sufrace Buffer = %p\n", buffer);
printf ("Running test app... animation ptr (%p) duration [%lf] frame [%lu]\n", animation, duration, frame);

for (i = 0; i < frame_number; i++)
{
    lottie_animation_render_async(animation, i, &buffer[0], width, height, bytes_per_line);
    p_render = lottie_animation_render_flush(animation);

    if (p_render != buffer)
    {
        perror ("Render flash mismatch output\n");
    }

    for (k = 0U; k < bytes_per_line * height; k++)
    {
        if (buffer[k] != 0U)
        {
            printf("Buffer Delta found at idx %lu.\n", k);
            break;
        }
    }
}

printf ("\n");
return 0;

}

can rlottie support width and height Scaling at not the same scale,I edit this function to do this,but I dont know is there any problems here.

bool LOTCompItem::update(int frameNo)
{
// check if cached frame is same as requested frame.
if (!mUpdateViewBox && (mCurFrameNo == frameNo)) return false;

/*
 * if viewbox dosen't scale exactly to the viewport
 * we scale the viewbox keeping AspectRatioPreserved and then align the
 * viewbox to the viewport using AlignCenter rule.
 */
VSize viewPort = mViewSize;
VSize viewBox = mCompData->size();

float sx = float(viewPort.width()) / viewBox.width();
float sy = float(viewPort.height()) / viewBox.height();
float scale = fmin(sx, sy);
float tx = (viewPort.width() - viewBox.width() * sx) * 0.5;
float ty = (viewPort.height() - viewBox.height() * sy) * 0.5;

VMatrix m;
m.translate(tx, ty).scale(sx, sy);
mRootLayer->update(frameNo, m, 1.0);

mCurFrameNo = frameNo;
mUpdateViewBox = false;
return true;

}

SIGSEGV on valid json

rlottie crashes with SIGSEGV on specifically crafted json files like the one below:

{
   "fr":1,
   "op":1,
   "w":1,
   "h":1,
   "layers":[{}]
}

LOT_BUILD is not correctly defined

LOT_BUILD should not be defined for the entire project :

LOT_BUILD must be defined for the library and NOT the programs.

in addition DLL_EXPORT must be defined only when the shared library is built, though, on Windows, only shared lib should be built

I have a patch for this, i will create a PR

cmake make fail on Mac

make -j 2

Scanning dependencies of target rlottie-image-loader
Scanning dependencies of target rlottie
[ 2%] Building CXX object src/vector/stb/CMakeFiles/rlottie-image-loader.dir/stb_image.cpp.o
[ 5%] Building CXX object CMakeFiles/rlottie.dir/src/vector/freetype/v_ft_math.cpp.o
[ 8%] Building CXX object CMakeFiles/rlottie.dir/src/vector/freetype/v_ft_raster.cpp.o
[ 10%] Linking CXX shared library librlottie-image-loader.dylib
[ 10%] Built target rlottie-image-loader
[ 13%] Building CXX object CMakeFiles/rlottie.dir/src/vector/freetype/v_ft_stroker.cpp.o
[ 16%] Building CXX object CMakeFiles/rlottie.dir/src/vector/pixman/vregion.cpp.o
[ 18%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vrect.cpp.o
[ 21%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdasher.cpp.o
[ 24%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vbrush.cpp.o
[ 27%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vbitmap.cpp.o
[ 29%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vpainter.cpp.o
[ 32%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vcompositionfunctions.cpp.o
[ 35%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdrawhelper.cpp.o
[ 37%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdrawhelper_sse2.cpp.o
[ 40%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdrawhelper_neon.cpp.o
[ 43%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vrle.cpp.o
[ 45%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vpath.cpp.o
[ 48%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vpathmesure.cpp.o
[ 51%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vmatrix.cpp.o
[ 54%] Building CXX object CMakeFiles/rlottie.dir/src/vector/velapsedtimer.cpp.o
[ 56%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdebug.cpp.o
[ 59%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vinterpolator.cpp.o
[ 62%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vbezier.cpp.o
[ 64%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vraster.cpp.o
[ 67%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vdrawable.cpp.o
[ 70%] Building CXX object CMakeFiles/rlottie.dir/src/vector/vimageloader.cpp.o
[ 72%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottieitem.cpp.o
[ 75%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottieloader.cpp.o
[ 78%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottiemodel.cpp.o
[ 81%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottieproxymodel.cpp.o
[ 83%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottieparser.cpp.o
[ 86%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottieanimation.cpp.o
[ 89%] Building CXX object CMakeFiles/rlottie.dir/src/lottie/lottiekeypath.cpp.o
[ 91%] Building CXX object CMakeFiles/rlottie.dir/src/binding/c/lottieanimation_capi.cpp.o
[ 94%] Linking CXX shared library librlottie.dylib
ld: unknown option: --no-undefined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [librlottie.0.0.1.dylib] Error 1
make[1]: *** [CMakeFiles/rlottie.dir/all] Error 2
make: *** [all] Error 2

[rlottie] C API does not render pixel data in the surface buffer.

main.zip
Attached the test source code.

Expectation: After executing the code, I expect to see some pixel data in the surface buffer.
Actual behaviour: After flushing the rendering data, the buffer content is still zero.
See attached GDB picture.

To build the source code:
gcc -Lbuild/src/ -Wall -g -Og -o vtest main.c -lrlottie

BufferContentAfterRendering

A way to clear cache?

Is it any way to somehow wipe current cache in rlottie's public API?
It can be useful in the case of preventing memory leakage in long-running apps, or, say, in the case of a need to forcefully reload cached animation with new data.

Compilation broken with clang-8.0.0 (using meson)

Hi there!
I faced broken compilation because of forced -Werror and the fact that clang throwing a -Wdefaulted-function-deleted warning:

../rlottie-715c8450bf995f6a92fac1b64df77bd16effc7b0/src/vector/vbrush.h:41:5: error: explicitly defaulted default constructor is implicitly deleted [-Werror,-Wdefaulted-function-deleted]
    VGradient() = default;
    ^
../rlottie-715c8450bf995f6a92fac1b64df77bd16effc7b0/src/vector/vbrush.h:57:16: note: default constructor of 'VGradient' is implicitly deleted because variant field 'linear' has a non-trivial default constructor
        Linear linear;
               ^
1 error generated.

Well, adding -Wno-error to CXXFLAGS allows me to build the library, but since you forcing -Werror, I guess you'd like to know about such warning.

request an interface to get each layer's start / end frame data

The request scenario is, app and designers could make consensus that a special design,

let's say it's "button"

And this resource may have 3 states: normal, focus in, focus out and the animation frame would be,
0 : normal
1 - 100 : focus in
101 - 200 : focus out

If specific layers could contain focus in, focus out animation frame, app doesn't need to hard code for these focus in/out animation implementation. They just read each layer's frame start/end and play those animation with them.

This is a example why they want layers' frame info.
We could discuss whether we will support or not, how to support it.

Memory Leaks

Hi guys. thanks you for awesome work. I have using rlottie on macos. but it seems have memory leaks.
For example i released everying what connected with lottie but i still see objects in memory leaker.

See screenshot

image

cmake error for install command on windows

I'm try build it by cmake on my win10。but it error form this install command of cmake.here is the error infomation.

1552620984(1)

and the official documents of cmake (https://cmake.org/cmake/help/v3.14/command/install.html) say to us,

For DLL platforms (all Windows-based systems including Cygwin), the DLL import library is treated as an ARCHIVE target. For non- DLL platforms shared libraries are treated as LIBRARY targets.
so this cmake code change to
`IF(WIN32)

install(TARGETS rlottie-image-loader
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)
ELSE(WIN32)
install(TARGETS rlottie-image-loader
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
)
ENDIF(WIN32)`

^_^ the last command : cmake .. -Dexample=true -DLIB_INSTALL_DIR="D:/out"
it's work well

Suspicious difference pixel colors.

UX Samples Masking result (Color RGB values) is a little different with Online Lottie viewer.

F Masks_All_01_1920x1080.json
F Masks_All_02_1920x1080.json

Please take a screenshot and pick any pixels with an image editor tools.

release ?

hello

do you think that you will proveide a release tarball soon ?

thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.