Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

# Conflicts:
#	submodules/TelegramCore/TelegramCore/CacheStorageSettings.swift
This commit is contained in:
overtake 2019-09-02 18:31:04 +03:00
commit a75a5fc898
309 changed files with 3917 additions and 7068 deletions

View File

@ -28,6 +28,9 @@
<FileRef
location = "group:submodules/libphonenumber/libphonenumber_Xcode.xcodeproj">
</FileRef>
<FileRef
location = "group:/Users/peter/build/telegram-temp/telegram-ios/submodules/rlottie/RLottieBinding_Xcode.xcodeproj">
</FileRef>
</Group>
<Group
location = "container:"

View File

@ -7,7 +7,6 @@
objects = {
/* Begin PBXBuildFile section */
D03E3E4A2304B4CC0049C28B /* RLottie.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D03E3E492304B4CC0049C28B /* RLottie.framework */; };
D03E3E4F2304B50A0049C28B /* AnimatedStickerNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03E3E4D2304B50A0049C28B /* AnimatedStickerNode.swift */; };
D03E3E502304B50A0049C28B /* AnimatedStickerUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = D03E3E4E2304B50A0049C28B /* AnimatedStickerUtils.swift */; };
D03E3E522304B51A0049C28B /* Postbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D03E3E512304B51A0049C28B /* Postbox.framework */; };
@ -30,6 +29,7 @@
D06018AB22F361FC00796784 /* AsyncDisplayKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D06018AA22F361FC00796784 /* AsyncDisplayKit.framework */; };
D06018AD22F361FF00796784 /* Lottie.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D06018AC22F361FF00796784 /* Lottie.framework */; };
D06018AF22F3641F00796784 /* FrameworkBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06018AE22F3641F00796784 /* FrameworkBundle.swift */; };
D0AA5791231BE2E6000F88F3 /* RLottieBinding.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0AA5790231BE2E6000F88F3 /* RLottieBinding.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -58,6 +58,7 @@
D06018AA22F361FC00796784 /* AsyncDisplayKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = AsyncDisplayKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D06018AC22F361FF00796784 /* Lottie.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Lottie.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D06018AE22F3641F00796784 /* FrameworkBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FrameworkBundle.swift; sourceTree = "<group>"; };
D0AA5790231BE2E6000F88F3 /* RLottieBinding.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RLottieBinding.framework; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -65,6 +66,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D0AA5791231BE2E6000F88F3 /* RLottieBinding.framework in Frameworks */,
D03E3E8E2304B6EC0049C28B /* YuvConversion.framework in Frameworks */,
D03E3E642304B5640049C28B /* MobileCoreServices.framework in Frameworks */,
D03E3E622304B55F0049C28B /* SwiftSignalKit.framework in Frameworks */,
@ -76,7 +78,6 @@
D03E3E562304B52F0049C28B /* libcompression.tbd in Frameworks */,
D03E3E542304B51E0049C28B /* TelegramCore.framework in Frameworks */,
D03E3E522304B51A0049C28B /* Postbox.framework in Frameworks */,
D03E3E4A2304B4CC0049C28B /* RLottie.framework in Frameworks */,
D06018AD22F361FF00796784 /* Lottie.framework in Frameworks */,
D06018AB22F361FC00796784 /* AsyncDisplayKit.framework in Frameworks */,
D06018A922F361F900796784 /* UIKit.framework in Frameworks */,
@ -122,6 +123,7 @@
D06018A522F361F400796784 /* Frameworks */ = {
isa = PBXGroup;
children = (
D0AA5790231BE2E6000F88F3 /* RLottieBinding.framework */,
D03E3E8D2304B6EC0049C28B /* YuvConversion.framework */,
D03E3E632304B5640049C28B /* MobileCoreServices.framework */,
D03E3E612304B55F0049C28B /* SwiftSignalKit.framework */,

View File

@ -5,7 +5,7 @@ import TelegramCore
import Compression
import Display
import AsyncDisplayKit
import RLottie
import RLottieBinding
import GZip
import Tuples
import MediaResources

View File

@ -6,7 +6,7 @@ import Display
import TelegramCore
import Compression
import GZip
import RLottie
import RLottieBinding
import MediaResources
import MobileCoreServices
import MediaResources

File diff suppressed because it is too large Load Diff

View File

@ -1,35 +0,0 @@
dist: trusty
sudo: false
language: cpp
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
matrix:
include:
- os: linux
compiler: clang
env:
build_type=release
options=""
- MATRIX_EVAL="CC=clang-5.0 && CXX=clang++"
- os: linux
compiler: gcc
env:
build_type=release
options=""
- MATRIX_EVAL="CC=gcc-5 && CXX=g++-5"
before_install:
- eval "${MATRIX_EVAL}"
script:
- cmake -DLIB_INSTALL_DIR=/usr/lib .
- cmake --build . -- -j2

View File

@ -1,62 +0,0 @@
common_source = files('evasapp.cpp')
common_source += files('lottieview.cpp')
demo_sources = files('demo.cpp')
demo_sources += common_source
executable('lottie2gif',
'lottie2gif.cpp',
include_directories : inc,
link_with : rlottie_lib)
executable('vectorTest',
'vectortest.cpp',
include_directories : inc,
dependencies : [library_deps])
demo_dep = dependency('elementary', required : false)
if (demo_dep.found())
executable('demo',
demo_sources,
include_directories : inc,
link_with : rlottie_lib,
dependencies : demo_dep)
lottieview_test_src = files('lottieviewtest.cpp')
lottieview_test_src += common_source
executable('lottieviewTest',
lottieview_test_src,
include_directories : inc,
link_with : rlottie_lib,
dependencies : demo_dep)
uxsample_test_src = files('uxsampletest.cpp')
uxsample_test_src += common_source
executable('uxsampleTest',
uxsample_test_src,
include_directories : inc,
link_with : rlottie_lib,
dependencies : demo_dep)
lottieviewer_sources = files('lottieviewer.cpp')
lottieviewer_sources += common_source
executable('lottieviewer',
lottieviewer_sources,
include_directories : inc,
link_with : rlottie_lib,
dependencies : demo_dep)
if (meson.get_compiler('cpp').has_header('elementary-1/efl_ui_animation_view.h'))
executable('efl_animview',
'efl_animview.cpp',
include_directories : inc,
link_with : rlottie_lib,
dependencies : demo_dep)
endif
endif

File diff suppressed because one or more lines are too long

View File

@ -1,31 +0,0 @@
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include<iostream>
#include "vinterpolator.h"
int main()
{
VInterpolator ip({0.667, 1}, {0.333 , 0});
for (float i = 0.0 ; i < 1.0 ; i+=0.05) {
std::cout<<ip.value(i)<<"\t";
}
std::cout<<std::endl;
return 0;
}

View File

@ -1,41 +0,0 @@
project('rlottie library',
'cpp',
license : 'Apache')
rlottie_lib_version = '0.0.1'
add_global_arguments('-DDEMO_DIR="@0@/example/resource/"'.format(meson.current_source_dir()), language : 'cpp')
compiler_flags = ['-std=c++14', '-Os', '-Wall', '-Werror', '-Wextra', '-fno-exceptions', '-fno-rtti',
'-fno-unwind-tables' , '-fno-asynchronous-unwind-tables',
'-Wnon-virtual-dtor', '-Woverloaded-virtual', '-Wno-unused-parameter', '-fvisibility=hidden']
if (build_machine.system() == 'linux')
compiler_flags += ['-pthread']
add_global_link_arguments('-pthread', language: 'cpp')
endif
add_global_arguments(compiler_flags, language: 'cpp')
inc = include_directories('inc')
subdir('inc')
subdir('src')
if get_option('example') == true
subdir('example')
endif
if get_option('test') == true
subdir('test')
endif
pkg_mod = import('pkgconfig')
pkg_mod.generate( libraries : rlottie_lib,
version : rlottie_lib_version,
name : 'librlottie',
filebase : 'rlottie',
description : 'A Library for rendering lottie files.'
)

View File

@ -1,15 +0,0 @@
option('test',
type: 'boolean',
value: false,
description: 'Enable building unit tests')
option('example',
type: 'boolean',
value: true,
description: 'Enable building examples')
option('text',
type: 'boolean',
value: false,
description: 'Enable text module')

View File

@ -1,127 +0,0 @@
/*
* Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "lottieloader.h"
#include "lottieparser.h"
#include <cstring>
#include <fstream>
#include <unordered_map>
using namespace std;
#ifdef LOTTIE_CACHE_SUPPORT
class LottieFileCache {
public:
static LottieFileCache &instance()
{
static LottieFileCache CACHE;
return CACHE;
}
std::shared_ptr<LOTModel> find(const std::string &key)
{
auto search = mHash.find(key);
if (search != mHash.end()) {
return search->second;
} else {
return nullptr;
}
}
void add(const std::string &key, std::shared_ptr<LOTModel> value)
{
mHash[key] = std::move(value);
}
private:
LottieFileCache() = default;
std::unordered_map<std::string, std::shared_ptr<LOTModel>> mHash;
};
#else
class LottieFileCache {
public:
static LottieFileCache &instance()
{
static LottieFileCache CACHE;
return CACHE;
}
std::shared_ptr<LOTModel> find(const std::string &) { return nullptr; }
void add(const std::string &, std::shared_ptr<LOTModel>) {}
};
#endif
static std::string dirname(const std::string &path)
{
const char *ptr = strrchr(path.c_str(), '/');
int len = int(ptr + 1 - path.c_str()); // +1 to include '/'
return std::string(path, 0, len);
}
bool LottieLoader::load(const std::string &path)
{
mModel = LottieFileCache::instance().find(path);
if (mModel) return true;
std::ifstream f;
f.open(path);
if (!f.is_open()) {
vCritical << "failed to open file = " << path.c_str();
return false;
} else {
std::stringstream buf;
buf << f.rdbuf();
LottieParser parser(const_cast<char *>(buf.str().data()),
dirname(path).c_str());
mModel = parser.model();
if (!mModel) return false;
LottieFileCache::instance().add(path, mModel);
f.close();
}
return true;
}
bool LottieLoader::loadFromData(std::string &&jsonData, const std::string &key,
const std::string &resourcePath)
{
mModel = LottieFileCache::instance().find(key);
if (mModel) return true;
LottieParser parser(const_cast<char *>(jsonData.c_str()),
resourcePath.c_str());
mModel = parser.model();
if (!mModel) return false;
LottieFileCache::instance().add(key, mModel);
return true;
}
std::shared_ptr<LOTModel> LottieLoader::model()
{
return mModel;
}

View File

@ -1,14 +0,0 @@
source_file = files('lottieparser.cpp')
source_file += files('lottieloader.cpp')
source_file += files('lottiemodel.cpp')
source_file += files('lottieproxymodel.cpp')
source_file += files('lottieanimation.cpp')
source_file += files('lottieitem.cpp')
source_file += files('lottiekeypath.cpp')
lottie_dep = declare_dependency(
include_directories : include_directories('.'),
sources : source_file
)

View File

@ -1,14 +0,0 @@
subdir('vector')
subdir('lottie')
subdir('binding')
library_deps = vector_dep
library_deps += lottie_dep
library_deps += binding_dep
rlottie_lib = shared_library('rlottie',
include_directories : inc,
version : rlottie_lib_version,
dependencies : library_deps,
install : true
)

View File

@ -1,39 +0,0 @@
subdir('freetype')
subdir('pixman')
subdir('stb')
vector_dep = [freetype_dep]
vector_dep += pixman_dep
source_file = files('vdasher.cpp')
source_file += files('vbrush.cpp')
source_file += files('vbitmap.cpp')
source_file += files('vpainter.cpp')
source_file += files('vcompositionfunctions.cpp')
source_file += files('vdrawhelper.cpp')
source_file += files('vdrawhelper_sse2.cpp')
source_file += files('vdrawhelper_neon.cpp')
source_file += files('vdrawable.cpp')
source_file += files('vrect.cpp')
source_file += files('vrle.cpp')
source_file += files('vpath.cpp')
source_file += files('vpathmesure.cpp')
source_file += files('vmatrix.cpp')
source_file += files('velapsedtimer.cpp')
source_file += files('vdebug.cpp')
source_file += files('vinterpolator.cpp')
source_file += files('vbezier.cpp')
source_file += files('vraster.cpp')
source_file += files('vimageloader.cpp')
# dl dependancy for dlopen, dlsym, dlclose symbol
cc = meson.get_compiler('cpp')
vector_dep += cc.find_library('dl', required : true)
vector_dep += declare_dependency( include_directories : include_directories('.'),
sources : source_file
)

View File

@ -1,2 +0,0 @@
clang: error: clang: error: no such file or directory: '2'
no such file or directory: '2'

File diff suppressed because it is too large Load Diff

View File

@ -1,418 +0,0 @@
/*
* Copyright © 2009 Nokia Corporation
*
* 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 (including the next
* paragraph) 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.
*
* Author: Siarhei Siamashka (siarhei.siamashka@nokia.com)
*/
/*
* This file contains implementations of NEON optimized pixel processing
* functions. There is no full and detailed tutorial, but some functions
* (those which are exposing some new or interesting features) are
* extensively commented and can be used as examples.
*
* You may want to have a look at the comments for following functions:
* - pixman_composite_over_8888_0565_asm_neon
* - pixman_composite_over_n_8_0565_asm_neon
*/
/* Prevent the stack from becoming executable for no reason... */
#if defined(__linux__) && defined(__ELF__)
.section .note.GNU-stack,"",%progbits
#endif
.text
.arch armv8-a
.altmacro
.p2align 2
/* Supplementary macro for setting function attributes */
.macro pixman_asm_function fname
.func fname
.global fname
#ifdef __ELF__
.hidden fname
.type fname, %function
#endif
fname:
.endm
#include "pixman-arma64-neon-asm.h"
/* Global configuration options and preferences */
/*
* The code can optionally make use of unaligned memory accesses to improve
* performance of handling leading/trailing pixels for each scanline.
* Configuration variable RESPECT_STRICT_ALIGNMENT can be set to 0 for
* example in linux if unaligned memory accesses are not configured to
* generate.exceptions.
*/
.set RESPECT_STRICT_ALIGNMENT, 1
/*
* Set default prefetch type. There is a choice between the following options:
*
* PREFETCH_TYPE_NONE (may be useful for the ARM cores where PLD is set to work
* as NOP to workaround some HW bugs or for whatever other reason)
*
* PREFETCH_TYPE_SIMPLE (may be useful for simple single-issue ARM cores where
* advanced prefetch intruduces heavy overhead)
*
* PREFETCH_TYPE_ADVANCED (useful for superscalar cores such as ARM Cortex-A8
* which can run ARM and NEON instructions simultaneously so that extra ARM
* instructions do not add (many) extra cycles, but improve prefetch efficiency)
*
* Note: some types of function can't support advanced prefetch and fallback
* to simple one (those which handle 24bpp pixels)
*/
.set PREFETCH_TYPE_DEFAULT, PREFETCH_TYPE_ADVANCED
/* Prefetch distance in pixels for simple prefetch */
.set PREFETCH_DISTANCE_SIMPLE, 64
/*
* Implementation of pixman_composite_over_8888_0565_asm_neon
*
* This function takes a8r8g8b8 source buffer, r5g6b5 destination buffer and
* performs OVER compositing operation. Function fast_composite_over_8888_0565
* from pixman-fast-path.c does the same in C and can be used as a reference.
*
* First we need to have some NEON assembly code which can do the actual
* operation on the pixels and provide it to the template macro.
*
* Template macro quite conveniently takes care of emitting all the necessary
* code for memory reading and writing (including quite tricky cases of
* handling unaligned leading/trailing pixels), so we only need to deal with
* the data in NEON registers.
*
* NEON registers allocation in general is recommented to be the following:
* v0, v1, v2, v3 - contain loaded source pixel data
* v4, v5, v6, v7 - contain loaded destination pixels (if they are needed)
* v24, v25, v26, v27 - contain loading mask pixel data (if mask is used)
* v28, v29, v30, v31 - place for storing the result (destination pixels)
*
* As can be seen above, four 64-bit NEON registers are used for keeping
* intermediate pixel data and up to 8 pixels can be processed in one step
* for 32bpp formats (16 pixels for 16bpp, 32 pixels for 8bpp).
*
* This particular function uses the following registers allocation:
* v0, v1, v2, v3 - contain loaded source pixel data
* v4, v5 - contain loaded destination pixels (they are needed)
* v28, v29 - place for storing the result (destination pixels)
*/
/*
* Step one. We need to have some code to do some arithmetics on pixel data.
* This is implemented as a pair of macros: '*_head' and '*_tail'. When used
* back-to-back, they take pixel data from {v0, v1, v2, v3} and {v4, v5},
* perform all the needed calculations and write the result to {v28, v29}.
* The rationale for having two macros and not just one will be explained
* later. In practice, any single monolitic function which does the work can
* be split into two parts in any arbitrary way without affecting correctness.
*
* There is one special trick here too. Common template macro can optionally
* make our life a bit easier by doing R, G, B, A color components
* deinterleaving for 32bpp pixel formats (and this feature is used in
* 'pixman_composite_over_8888_0565_asm_neon' function). So it means that
* instead of having 8 packed pixels in {v0, v1, v2, v3} registers, we
* actually use v0 register for blue channel (a vector of eight 8-bit
* values), v1 register for green, v2 for red and v3 for alpha. This
* simple conversion can be also done with a few NEON instructions:
*
* Packed to planar conversion: // vuzp8 is a wrapper macro
* vuzp8 v0, v1
* vuzp8 v2, v3
* vuzp8 v1, v3
* vuzp8 v0, v2
*
* Planar to packed conversion: // vzip8 is a wrapper macro
* vzip8 v0, v2
* vzip8 v1, v3
* vzip8 v2, v3
* vzip8 v0, v1
*
* But pixel can be loaded directly in planar format using LD4 / b NEON
* instruction. It is 1 cycle slower than LD1 / s, so this is not always
* desirable, that's why deinterleaving is optional.
*
* But anyway, here is the code:
*/
.macro pixman_composite_out_reverse_8888_8888_process_pixblock_head
mvn v24.8b, v3.8b /* get inverted alpha */
/* do alpha blending */
umull v8.8h, v24.8b, v4.8b
umull v9.8h, v24.8b, v5.8b
umull v10.8h, v24.8b, v6.8b
umull v11.8h, v24.8b, v7.8b
.endm
.macro pixman_composite_out_reverse_8888_8888_process_pixblock_tail
urshr v14.8h, v8.8h, #8
urshr v15.8h, v9.8h, #8
urshr v16.8h, v10.8h, #8
urshr v17.8h, v11.8h, #8
raddhn v28.8b, v14.8h, v8.8h
raddhn v29.8b, v15.8h, v9.8h
raddhn v30.8b, v16.8h, v10.8h
raddhn v31.8b, v17.8h, v11.8h
.endm
/******************************************************************************/
.macro pixman_composite_over_8888_8888_process_pixblock_head
pixman_composite_out_reverse_8888_8888_process_pixblock_head
.endm
.macro pixman_composite_over_8888_8888_process_pixblock_tail
pixman_composite_out_reverse_8888_8888_process_pixblock_tail
uqadd v28.8b, v0.8b, v28.8b
uqadd v29.8b, v1.8b, v29.8b
uqadd v30.8b, v2.8b, v30.8b
uqadd v31.8b, v3.8b, v31.8b
.endm
.macro pixman_composite_over_8888_8888_process_pixblock_tail_head
ld4 {v4.8b, v5.8b, v6.8b, v7.8b}, [DST_R], #32
urshr v14.8h, v8.8h, #8
PF add PF_X, PF_X, #8
PF tst PF_CTL, #0xF
urshr v15.8h, v9.8h, #8
urshr v16.8h, v10.8h, #8
urshr v17.8h, v11.8h, #8
PF beq 10f
PF add PF_X, PF_X, #8
PF sub PF_CTL, PF_CTL, #1
10:
raddhn v28.8b, v14.8h, v8.8h
raddhn v29.8b, v15.8h, v9.8h
PF cmp PF_X, ORIG_W
raddhn v30.8b, v16.8h, v10.8h
raddhn v31.8b, v17.8h, v11.8h
uqadd v28.8b, v0.8b, v28.8b
uqadd v29.8b, v1.8b, v29.8b
uqadd v30.8b, v2.8b, v30.8b
uqadd v31.8b, v3.8b, v31.8b
fetch_src_pixblock
PF lsl DUMMY, PF_X, #src_bpp_shift
PF prfm PREFETCH_MODE, [PF_SRC, DUMMY]
mvn v22.8b, v3.8b
PF lsl DUMMY, PF_X, #dst_bpp_shift
PF prfm PREFETCH_MODE, [PF_DST, DUMMY]
st4 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32
PF ble 10f
PF sub PF_X, PF_X, ORIG_W
10:
umull v8.8h, v22.8b, v4.8b
PF ble 10f
PF subs PF_CTL, PF_CTL, #0x10
10:
umull v9.8h, v22.8b, v5.8b
PF ble 10f
PF lsl DUMMY, SRC_STRIDE, #src_bpp_shift
PF ldrsb DUMMY, [PF_SRC, DUMMY]
PF add PF_SRC, PF_SRC, #1
10:
umull v10.8h, v22.8b, v6.8b
PF ble 10f
PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift
PF ldrsb DUMMY, [PF_DST, DUMMY]
PF add PF_DST, PF_DST, #1
10:
umull v11.8h, v22.8b, v7.8b
.endm
generate_composite_function \
pixman_composite_over_8888_8888_asm_neon, 32, 0, 32, \
FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \
8, /* number of pixels, processed in a single block */ \
5, /* prefetch distance */ \
default_init, \
default_cleanup, \
pixman_composite_over_8888_8888_process_pixblock_head, \
pixman_composite_over_8888_8888_process_pixblock_tail, \
pixman_composite_over_8888_8888_process_pixblock_tail_head
generate_composite_function_single_scanline \
pixman_composite_scanline_over_asm_neon, 32, 0, 32, \
FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \
8, /* number of pixels, processed in a single block */ \
default_init, \
default_cleanup, \
pixman_composite_over_8888_8888_process_pixblock_head, \
pixman_composite_over_8888_8888_process_pixblock_tail, \
pixman_composite_over_8888_8888_process_pixblock_tail_head
/******************************************************************************/
.macro pixman_composite_over_n_8888_process_pixblock_head
/* deinterleaved source pixels in {v0, v1, v2, v3} */
/* inverted alpha in {v24} */
/* destination pixels in {v4, v5, v6, v7} */
umull v8.8h, v24.8b, v4.8b
umull v9.8h, v24.8b, v5.8b
umull v10.8h, v24.8b, v6.8b
umull v11.8h, v24.8b, v7.8b
.endm
.macro pixman_composite_over_n_8888_process_pixblock_tail
urshr v14.8h, v8.8h, #8
urshr v15.8h, v9.8h, #8
urshr v16.8h, v10.8h, #8
urshr v17.8h, v11.8h, #8
raddhn v28.8b, v14.8h, v8.8h
raddhn v29.8b, v15.8h, v9.8h
raddhn v30.8b, v16.8h, v10.8h
raddhn v31.8b, v17.8h, v11.8h
uqadd v28.8b, v0.8b, v28.8b
uqadd v29.8b, v1.8b, v29.8b
uqadd v30.8b, v2.8b, v30.8b
uqadd v31.8b, v3.8b, v31.8b
.endm
.macro pixman_composite_over_n_8888_process_pixblock_tail_head
urshr v14.8h, v8.8h, #8
urshr v15.8h, v9.8h, #8
urshr v16.8h, v10.8h, #8
urshr v17.8h, v11.8h, #8
raddhn v28.8b, v14.8h, v8.8h
raddhn v29.8b, v15.8h, v9.8h
raddhn v30.8b, v16.8h, v10.8h
raddhn v31.8b, v17.8h, v11.8h
ld4 {v4.8b, v5.8b, v6.8b, v7.8b}, [DST_R], #32
uqadd v28.8b, v0.8b, v28.8b
PF add PF_X, PF_X, #8
PF tst PF_CTL, #0x0F
PF beq 10f
PF add PF_X, PF_X, #8
PF sub PF_CTL, PF_CTL, #1
10:
uqadd v29.8b, v1.8b, v29.8b
uqadd v30.8b, v2.8b, v30.8b
uqadd v31.8b, v3.8b, v31.8b
PF cmp PF_X, ORIG_W
umull v8.8h, v24.8b, v4.8b
PF lsl DUMMY, PF_X, #dst_bpp_shift
PF prfm PREFETCH_MODE, [PF_DST, DUMMY]
umull v9.8h, v24.8b, v5.8b
PF ble 10f
PF sub PF_X, PF_X, ORIG_W
10:
umull v10.8h, v24.8b, v6.8b
PF subs PF_CTL, PF_CTL, #0x10
umull v11.8h, v24.8b, v7.8b
PF ble 10f
PF lsl DUMMY, DST_STRIDE, #dst_bpp_shift
PF ldrsb DUMMY, [PF_DST, DUMMY]
PF add PF_DST, PF_DST, #1
10:
st4 {v28.8b, v29.8b, v30.8b, v31.8b}, [DST_W], #32
.endm
.macro pixman_composite_over_n_8888_init
mov v3.s[0], w4
dup v0.8b, v3.b[0]
dup v1.8b, v3.b[1]
dup v2.8b, v3.b[2]
dup v3.8b, v3.b[3]
mvn v24.8b, v3.8b /* get inverted alpha */
.endm
generate_composite_function \
pixman_composite_over_n_8888_asm_neon, 0, 0, 32, \
FLAG_DST_READWRITE | FLAG_DEINTERLEAVE_32BPP, \
8, /* number of pixels, processed in a single block */ \
5, /* prefetch distance */ \
pixman_composite_over_n_8888_init, \
default_cleanup, \
pixman_composite_over_8888_8888_process_pixblock_head, \
pixman_composite_over_8888_8888_process_pixblock_tail, \
pixman_composite_over_n_8888_process_pixblock_tail_head
/******************************************************************************/
.macro pixman_composite_src_n_8888_process_pixblock_head
.endm
.macro pixman_composite_src_n_8888_process_pixblock_tail
.endm
.macro pixman_composite_src_n_8888_process_pixblock_tail_head
st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [DST_W], #32
.endm
.macro pixman_composite_src_n_8888_init
mov v0.s[0], w4
dup v3.2s, v0.s[0]
dup v2.2s, v0.s[0]
dup v1.2s, v0.s[0]
dup v0.2s, v0.s[0]
.endm
.macro pixman_composite_src_n_8888_cleanup
.endm
generate_composite_function \
pixman_composite_src_n_8888_asm_neon, 0, 0, 32, \
FLAG_DST_WRITEONLY, \
8, /* number of pixels, processed in a single block */ \
0, /* prefetch distance */ \
pixman_composite_src_n_8888_init, \
pixman_composite_src_n_8888_cleanup, \
pixman_composite_src_n_8888_process_pixblock_head, \
pixman_composite_src_n_8888_process_pixblock_tail, \
pixman_composite_src_n_8888_process_pixblock_tail_head, \
0, /* dst_w_basereg */ \
0, /* dst_r_basereg */ \
0, /* src_basereg */ \
0 /* mask_basereg */
/******************************************************************************/
.macro pixman_composite_src_8888_8888_process_pixblock_head
.endm
.macro pixman_composite_src_8888_8888_process_pixblock_tail
.endm
.macro pixman_composite_src_8888_8888_process_pixblock_tail_head
st1 {v0.2s, v1.2s, v2.2s, v3.2s}, [DST_W], #32
fetch_src_pixblock
cache_preload 8, 8
.endm
generate_composite_function \
pixman_composite_src_8888_8888_asm_neon, 32, 0, 32, \
FLAG_DST_WRITEONLY, \
8, /* number of pixels, processed in a single block */ \
10, /* prefetch distance */ \
default_init, \
default_cleanup, \
pixman_composite_src_8888_8888_process_pixblock_head, \
pixman_composite_src_8888_8888_process_pixblock_tail, \
pixman_composite_src_8888_8888_process_pixblock_tail_head, \
0, /* dst_w_basereg */ \
0, /* dst_r_basereg */ \
0, /* src_basereg */ \
0 /* mask_basereg */
/******************************************************************************/

View File

@ -1,7 +0,0 @@
add_library(rlottie-image-loader SHARED
stb_image.cpp
)
install(TARGETS rlottie-image-loader
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
)

View File

@ -1,8 +0,0 @@
rlottie_image_loader_sources = ['stb_image.cpp']
rlottie_image_loader_lib = shared_library('rlottie-image-loader',
rlottie_image_loader_sources,
install : true
)

View File

@ -1,28 +0,0 @@
#include "vimageloader.h"
#include "config.h"
#include "vdebug.h"
#ifndef WIN32
#include <dlfcn.h>
#else
#include <Windows.h>
#endif
#include <cstring>
#include "vimageloader.h"
struct VImageLoader::Impl {
};
VImageLoader::VImageLoader() : mImpl(std::make_unique<VImageLoader::Impl>()) {}
VImageLoader::~VImageLoader() {}
VBitmap VImageLoader::load(const char *fileName)
{
return VBitmap();
}
VBitmap VImageLoader::load(const char *data, int len)
{
return VBitmap();
}

View File

@ -1,25 +0,0 @@
vector_test_sources = files('testsuite.cpp')
vector_test_sources += files('test_vpath.cpp')
gtest_dep = dependency('gtest')
vector_testsuite = executable('vectorTestSuite',
vector_test_sources,
include_directories : inc,
dependencies : [gtest_dep, library_deps])
test('Vector Testsuite', vector_testsuite)
animation_test_sources = files('testsuite.cpp')
animation_test_sources += files('test_lottieanimation.cpp')
animation_test_sources += files('test_lottieanimation_capi.cpp')
animation_testsuite = executable('animationTestSuite',
animation_test_sources,
include_directories : inc,
link_with : rlottie_lib,
dependencies : gtest_dep)
test('Animation Testsuite', animation_testsuite)

View File

@ -11,7 +11,7 @@ public struct CacheStorageSettings: PreferencesEntry, Equatable {
public let defaultCacheStorageTimeout: Int32
public static var defaultSettings: CacheStorageSettings {
return CacheStorageSettings(defaultCacheStorageTimeout: 1 * 31 * 24 * 60 * 60)
return CacheStorageSettings(defaultCacheStorageTimeout: Int32.max)
}
init(defaultCacheStorageTimeout: Int32) {
@ -19,7 +19,7 @@ public struct CacheStorageSettings: PreferencesEntry, Equatable {
}
public init(decoder: PostboxDecoder) {
self.defaultCacheStorageTimeout = decoder.decodeInt32ForKey("dt", orElse: 0)
self.defaultCacheStorageTimeout = decoder.decodeInt32ForKey("dt", orElse: Int32.max)
}
public func encode(_ encoder: PostboxEncoder) {

View File

@ -370,8 +370,14 @@ public final class ChatMessageItem: ListViewItem, CustomStringConvertible {
loop: for media in self.message.media {
if let telegramFile = media as? TelegramMediaFile {
if telegramFile.isAnimatedSticker, let size = telegramFile.size, size > 0 && size <= 128 * 1024 {
viewClassName = ChatMessageAnimatedStickerItemNode.self
if telegramFile.isAnimatedSticker, !telegramFile.previewRepresentations.isEmpty, let size = telegramFile.size, size > 0 && size <= 128 * 1024 {
if self.message.id.peerId.namespace == Namespaces.Peer.SecretChat {
if telegramFile.fileId.namespace == Namespaces.Media.CloudFile {
viewClassName = ChatMessageAnimatedStickerItemNode.self
}
} else {
viewClassName = ChatMessageAnimatedStickerItemNode.self
}
break loop
}
for attribute in telegramFile.attributes {

View File

@ -74,7 +74,6 @@
D00818CD22B595CB008A895F /* LightweightAccountData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00818CC22B595CB008A895F /* LightweightAccountData.framework */; };
D00ACA4B20222C280045D427 /* libtgvoip.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D00ACA4C20222C280045D427 /* libtgvoip.framework */; };
D00ACA5A2022897D0045D427 /* ProcessedPeerRestrictionText.swift in Sources */ = {isa = PBXBuildFile; fileRef = D00ACA592022897D0045D427 /* ProcessedPeerRestrictionText.swift */; };
D010E17D22C238BC009324D4 /* RLottie.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D010E17C22C238BC009324D4 /* RLottie.framework */; };
D015E04F225D2E5900CB9E8A /* WebP.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D015E04E225D2E5900CB9E8A /* WebP.framework */; };
D017734C22049BF800DA06A7 /* UpgradedAccounts.swift in Sources */ = {isa = PBXBuildFile; fileRef = D017734B22049BF800DA06A7 /* UpgradedAccounts.swift */; };
D01776BE1F1E76920044446D /* PeerMediaCollectionSectionsNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D01776BD1F1E76920044446D /* PeerMediaCollectionSectionsNode.swift */; };
@ -236,6 +235,7 @@
D09E77A922FA5CEA00B9CCA7 /* TextFormat.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D09E77A822FA5CEA00B9CCA7 /* TextFormat.framework */; };
D09E77AB22FA5CEA00B9CCA7 /* Tuples.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D09E77AA22FA5CEA00B9CCA7 /* Tuples.framework */; };
D09E77AD22FA5CEA00B9CCA7 /* UrlEscaping.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D09E77AC22FA5CEA00B9CCA7 /* UrlEscaping.framework */; };
D0AA5793231BE2FD000F88F3 /* RLottieBinding.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0AA5792231BE2FD000F88F3 /* RLottieBinding.framework */; };
D0AA840C1FEB2BA3005C6E91 /* OverlayPlayerControlsNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AA840B1FEB2BA3005C6E91 /* OverlayPlayerControlsNode.swift */; };
D0AB262921C307D7008F6685 /* ChatMessagePollBubbleContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0AB262821C307D7008F6685 /* ChatMessagePollBubbleContentNode.swift */; };
D0ACCB1C1EC5FF4B0079D8BF /* ChatMessageCallBubbleContentNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0ACCB1B1EC5FF4B0079D8BF /* ChatMessageCallBubbleContentNode.swift */; };
@ -895,6 +895,7 @@
D09E77A822FA5CEA00B9CCA7 /* TextFormat.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = TextFormat.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D09E77AA22FA5CEA00B9CCA7 /* Tuples.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Tuples.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D09E77AC22FA5CEA00B9CCA7 /* UrlEscaping.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = UrlEscaping.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D0AA5792231BE2FD000F88F3 /* RLottieBinding.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = RLottieBinding.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D0AA840B1FEB2BA3005C6E91 /* OverlayPlayerControlsNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverlayPlayerControlsNode.swift; sourceTree = "<group>"; };
D0AB0BB01D6718DA002C78E7 /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; };
D0AB0BB21D6718EB002C78E7 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
@ -1169,6 +1170,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
D0AA5793231BE2FD000F88F3 /* RLottieBinding.framework in Frameworks */,
09B4A9BA231519CD005C2E08 /* VideoToolbox.framework in Frameworks */,
D072F38423155EAF0009E66F /* MessageReactionListUI.framework in Frameworks */,
D03E495D230868DF0049C28B /* PersistentStringHash.framework in Frameworks */,
@ -1302,7 +1304,6 @@
D060184222F35D2000796784 /* ActivityIndicator.framework in Frameworks */,
D060184022F35D1C00796784 /* MergeLists.framework in Frameworks */,
D0D3281422F31B3000D07EE2 /* TelegramUpdateUI.framework in Frameworks */,
D010E17D22C238BC009324D4 /* RLottie.framework in Frameworks */,
D03AE67522B945D30078411C /* BuildConfig.framework in Frameworks */,
D03AE67322B9459C0078411C /* HockeySDK.framework in Frameworks */,
D02D634A22B85B94006BE519 /* PushKit.framework in Frameworks */,
@ -1774,6 +1775,7 @@
D08D45281D5E340200A7428A /* Frameworks */ = {
isa = PBXGroup;
children = (
D0AA5792231BE2FD000F88F3 /* RLottieBinding.framework */,
09B4A9B9231519CD005C2E08 /* VideoToolbox.framework */,
D072F38323155EAF0009E66F /* MessageReactionListUI.framework */,
D03E495C230868DF0049C28B /* PersistentStringHash.framework */,

View File

View File

@ -1,6 +1,6 @@
#import "LottieInstance.h"
#include <rlottie.h>
#include "rlottie.h"
@interface LottieInstance () {
std::unique_ptr<rlottie::Animation> _animation;

View File

@ -9,11 +9,10 @@
#import <UIKit/UIKit.h>
//! Project version number for RLottie.
FOUNDATION_EXPORT double RLottieVersionNumber;
FOUNDATION_EXPORT double RLottieBindingVersionNumber;
//! Project version string for RLottie.
FOUNDATION_EXPORT const unsigned char RLottieVersionString[];
#import <RLottie/LottieInstance.h>
FOUNDATION_EXPORT const unsigned char RLottieBindingVersionString[];
#import <RLottieBinding/LottieInstance.h>

File diff suppressed because it is too large Load Diff

View File

Before

Width:  |  Height:  |  Size: 5.6 MiB

After

Width:  |  Height:  |  Size: 5.6 MiB

View File

Before

Width:  |  Height:  |  Size: 1.0 MiB

After

Width:  |  Height:  |  Size: 1.0 MiB

View File

@ -0,0 +1,23 @@
os: Visual Studio 2017
platform:
- x86
environment:
matrix:
- ARCH: x86
PYTHON: "C:\\Python35"
- ARCH: x64
PYTHON: "C:\\Python35-x64"
skip_branch_with_pr: true
install:
- git submodule update --init --recursive
- set PATH=%cd%;%PYTHON%;%PYTHON%\Scripts;%PATH%
- pip install meson==0.50.0 ninja
- call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" %ARCH%
build_script:
- meson -Dwerror=false --backend=ninja --prefix=%cd% build
- where link
- ninja -C build
test_script:
- ninja -C build test
after_build:
- ninja -C build install

View File

@ -9,3 +9,4 @@ latex
tmp
.cproject
.project
.vs

View File

@ -0,0 +1,20 @@
sudo: false
os:
- linux
language:
- cpp
services:
- docker
before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull smohantty/rlottie-ci-setup; fi
script:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM smohantty/rlottie-ci-setup > Dockerfile; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit .; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true meson -Dtest=true builddir && ninja -C builddir test && ninja -C builddir install"; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true cmake -DLOTTIE_TEST=ON -Bbuilddir -H. && make -C builddir -j$(nproc) all test && make -C builddir install"; fi

View File

@ -6,3 +6,6 @@ Bryce Harrington <bryce@bryceharrington.org>
Junsu Choi <jsuya.choi@samsung.com>
Yuangu <lifulinghan@aol.com>
Mihai Serban <mihai.serban@gmail.com>
Shinwoo Kim <cinoo.kim@samsung.com>
Vincent Torri <vincent.torri@gmail.com>
Nicholas Guriev <guriev-ns@ya.ru>

View File

@ -1,10 +1,20 @@
cmake_minimum_required( VERSION 3.2 )
cmake_minimum_required( VERSION 3.3 )
#declare project
project( rlottie VERSION 0.0.1 LANGUAGES C CXX ASM)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE MinSizeRel)
endif()
if (NOT DEFINED BUILD_SHARED_LIBS)
# Keep the previous behavior of the build system, consistent with Meson.
set(BUILD_SHARED_LIBS ON)
endif()
#declare target
add_library( rlottie SHARED "" )
add_library( rlottie )
set_target_properties( rlottie PROPERTIES DEFINE_SYMBOL LOT_BUILD )
#declare version of the target
set(player_version_major 0)
@ -19,12 +29,23 @@ set_target_properties(rlottie PROPERTIES
#declare alias so that library can be used inside the build tree, e.g. when testing
add_library(rlottie::rlottie ALIAS rlottie)
option(LOTTIE_MODULE "Enable LOTTIE MODULE SUPPORT" ON)
option(LOTTIE_THREAD "Enable LOTTIE THREAD SUPPORT" ON)
option(LOTTIE_CACHE "Enable LOTTIE CACHE SUPPORT" ON)
option(LOTTIE_TEST "Build LOTTIE AUTOTESTS" OFF)
CONFIGURE_FILE(${CMAKE_CURRENT_LIST_DIR}/cmake/config.h.in config.h)
target_include_directories(rlottie
PRIVATE
"${CMAKE_CURRENT_BINARY_DIR}"
)
#declare target compilation options
target_compile_options(rlottie
PUBLIC
PRIVATE
-std=c++14
-Os
-fno-exceptions
-fno-unwind-tables
-fno-asynchronous-unwind-tables
@ -47,10 +68,10 @@ target_link_libraries(rlottie
"${CMAKE_THREAD_LIBS_INIT}"
)
# for dlopen, dlsym and dlclose dependancy
target_link_libraries(rlottie
PRIVATE
${CMAKE_DL_LIBS})
if (LOTTIE_MODULE)
# for dlopen, dlsym and dlclose dependancy
target_link_libraries(rlottie PRIVATE ${CMAKE_DL_LIBS})
endif()
if(APPLE)
target_link_libraries(rlottie
@ -74,6 +95,11 @@ add_subdirectory(inc)
add_subdirectory(src)
add_subdirectory(example)
if (LOTTIE_TEST)
enable_testing()
add_subdirectory(test)
endif()
SET(PREFIX ${CMAKE_INSTALL_PREFIX})
SET(EXEC_DIR ${PREFIX})
SET(LIBDIR ${LIB_INSTALL_DIR})

View File

@ -2,6 +2,8 @@
# rlottie
[![Build Status](https://travis-ci.org/Samsung/rlottie.svg?branch=master)](https://travis-ci.org/Samsung/rlottie)
[![Build status](https://ci.appveyor.com/api/projects/status/n3xonxk1ooo6s7nr?svg=true&passingText=windows%20-%20passing)](https://ci.appveyor.com/project/smohantty/rlottie-mliua)
rlottie is a platform independent standalone c++ library for rendering vector based animations and art in realtime.

View File

@ -0,0 +1,17 @@
#cmakedefine LOTTIE_MODULE
#ifdef LOTTIE_MODULE
#define LOTTIE_IMAGE_MODULE_SUPPORT
#endif
#cmakedefine LOTTIE_THREAD
#ifdef LOTTIE_THREAD
#define LOTTIE_THREAD_SUPPORT
#endif
#cmakedefine LOTTIE_CACHE
#ifdef LOTTIE_CACHE
#define LOTTIE_CACHE_SUPPORT
#endif

View File

@ -24,16 +24,14 @@
#define WIDTH 400
#define HEIGHT 400
Eo *slider = NULL;
void
win_del(void *data, Eo *o, void *ev)
win_del(void *data EINA_UNUSED, Eo *o EINA_UNUSED, void *event_info EINA_UNUSED)
{
elm_exit();
}
static void
btn_clicked_cb(void *data, Eo *obj, void *event_info)
btn_clicked_cb(void *data, Eo *obj, void *event_info EINA_UNUSED)
{
Eo *anim_view = (Eo *) data;
const char *text = elm_object_text_get(obj);
@ -53,14 +51,14 @@ btn_clicked_cb(void *data, Eo *obj, void *event_info)
}
static void
check_changed_cb(void *data, Eo *obj, void *event_info)
check_changed_cb(void *data, Eo *obj, void *event_info EINA_UNUSED)
{
Eo *anim_view = (Eo *) data;
elm_animation_view_auto_repeat_set(anim_view, elm_check_state_get(obj));
}
static void
speed_changed_cb(void *data, Eo *obj, void *event_info)
speed_changed_cb(void *data, Eo *obj, void *event_info EINA_UNUSED)
{
Eo *anim_view = (Eo *) data;
double speed = 1;
@ -94,40 +92,40 @@ update_anim_view_state(Eo *anim_view, Eo *label)
}
static void
_play_done(void *data, Eo *obj, void *ev)
_play_done(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
printf("done!\n");
}
static void
_play_updated(void *data, Eo *obj, void *ev)
_play_updated(void *data, Eo *obj, void *event_info EINA_UNUSED)
{
Eo *slider = (Eo *) data;
elm_slider_value_set(slider, elm_animation_view_progress_get(obj));
}
static void
_state_update(void *data, Eo *obj, void *ev)
_state_update(void *data, Eo *obj, void *event_info EINA_UNUSED)
{
Eo *label = (Eo *) data;
update_anim_view_state(obj, label);
}
static void
_play_repeated(void *data, Eo *obj, void *ev)
_play_repeated(void *data EINA_UNUSED, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
printf("repeated!\n");
}
static void
_slider_drag_cb(void *data, Eo *obj, void *ev)
_slider_drag_cb(void *data, Eo *obj, void *event_info EINA_UNUSED)
{
Eo *anim_view = (Eo *) data;
elm_animation_view_progress_set(anim_view, elm_slider_value_get(obj));
}
static void
_slider_reset(void *data, Eo *obj, void *ev)
_slider_reset(void *data, Eo *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Eo *slider = (Eo *) data;
elm_slider_value_set(slider, 0);

View File

@ -2,9 +2,16 @@
#include <rlottie.h>
#include<iostream>
#include<string>
#include<vector>
#include<array>
#ifndef _WIN32
#include<libgen.h>
#else
#include <windows.h>
#include <stdlib.h>
#endif
class GifBuilder {
public:
@ -78,7 +85,7 @@ public:
auto buffer = std::unique_ptr<uint32_t[]>(new uint32_t[w * h]);
size_t frameCount = player->totalFrame();
GifBuilder builder(baseName.data(), w, h, bgColor);
GifBuilder builder(gifName.data(), w, h, bgColor);
for (size_t i = 0; i < frameCount ; i++) {
rlottie::Surface surface(buffer.get(), w, h, w * 4);
player->renderSync(i, surface);
@ -89,31 +96,48 @@ public:
int setup(int argc, char **argv)
{
if (argc > 1) fileName = argv[1];
char *path{nullptr};
if (argc > 1) path = argv[1];
if (argc > 2) bgColor = strtol(argv[2], NULL, 16);
if (!fileName) return help();
if (!path) return help();
fileName = realpath(fileName, absoloutePath.data());
std::array<char, 5000> memory;
if (!fileName || !jsonFile(fileName) ) return help();
#ifdef _WIN32
path = _fullpath(memory.data(), path, memory.size());
#else
path = realpath(path, memory.data());
#endif
if (!path) return help();
baseName = absoloutePath;
char *base = basename(baseName.data());
snprintf(baseName.data(), baseName.size(), "%s.gif",base);
fileName = std::string(path);
if (!jsonFile()) return help();
gifName = basename(fileName);
gifName.append(".gif");
return 0;
}
private:
std::string basename(const std::string &str)
{
return str.substr(str.find_last_of("/\\") + 1);
}
bool jsonFile(const char *filename) {
const char *dot = strrchr(filename, '.');
if(!dot || dot == filename) return false;
return !strcmp(dot + 1, "json");
bool jsonFile() {
std::string extn = ".json";
if ( fileName.size() <= extn.size() ||
fileName.substr(fileName.size()- extn.size()) != extn )
return false;
return true;
}
int result() {
std::cout<<"Generated GIF file : "<<baseName.data()<<std::endl;
std::cout<<"Generated GIF file : "<<gifName<<std::endl;
return 0;
}
@ -123,10 +147,9 @@ private:
}
private:
char *fileName{nullptr};
int bgColor = 0xffffffff;
std::array<char, 5000> absoloutePath;
std::array<char, 5000> baseName;
std::string fileName;
std::string gifName;
};
int

View File

@ -409,7 +409,7 @@ public:
const float *data = node->mPath.ptPtr;
if (!data) return;
for (int i = 0; i < node->mPath.elmCount; i++) {
for (size_t i = 0; i < node->mPath.elmCount; i++) {
switch (node->mPath.elmPtr[i]) {
case 0:
evas_vg_shape_append_move_to(shape, data[0], data[1]);

View File

@ -0,0 +1,63 @@
override_default = ['warning_level=2', 'werror=false']
common_source = files('evasapp.cpp')
common_source += files('lottieview.cpp')
demo_sources = files('demo.cpp')
demo_sources += common_source
executable('lottie2gif',
'lottie2gif.cpp',
include_directories : inc,
override_options : override_default,
link_with : rlottie_lib)
demo_dep = dependency('elementary', required : false, disabler : true)
executable('demo',
demo_sources,
include_directories : inc,
override_options : override_default,
link_with : rlottie_lib,
dependencies : demo_dep)
lottieview_test_src = files('lottieviewtest.cpp')
lottieview_test_src += common_source
executable('lottieviewTest',
lottieview_test_src,
include_directories : inc,
override_options : override_default,
link_with : rlottie_lib,
dependencies : demo_dep)
uxsample_test_src = files('uxsampletest.cpp')
uxsample_test_src += common_source
executable('uxsampleTest',
uxsample_test_src,
include_directories : inc,
override_options : override_default,
link_with : rlottie_lib,
dependencies : demo_dep)
lottieviewer_sources = files('lottieviewer.cpp')
lottieviewer_sources += common_source
executable('lottieviewer',
lottieviewer_sources,
include_directories : inc,
override_options : override_default,
link_with : rlottie_lib,
dependencies : demo_dep)
if (meson.get_compiler('cpp').has_header('elementary-1/efl_ui_animation_view.h'))
executable('efl_animview',
'efl_animview.cpp',
include_directories : inc,
link_with : rlottie_lib,
override_options : override_default,
dependencies : demo_dep)
endif

Some files were not shown because too many files have changed in this diff Show More