Drop LodePNG
This commit is contained in:
parent
98221ec036
commit
8d8f299aec
6 changed files with 7 additions and 7891 deletions
|
@ -16,9 +16,9 @@ DEP=dep
|
|||
EXE=bin
|
||||
OBJ=objs
|
||||
LIB=libs
|
||||
DIR_LIST=${DEP} ${EXE} ${OBJ} ${LIB} ${DEP}/lodepng ${OBJ}/lodepng
|
||||
DIR_LIST=${DEP} ${EXE} ${OBJ} ${LIB}
|
||||
|
||||
PLUGIN_OBJECTS=${OBJ}/tgp-net.o ${OBJ}/tgp-timers.o ${OBJ}/msglog.o ${OBJ}/telegram-base.o ${OBJ}/telegram-purple.o ${OBJ}/tgp-2prpl.o ${OBJ}/tgp-structs.o ${OBJ}/tgp-utils.o ${OBJ}/tgp-chat.o ${OBJ}/tgp-ft.o ${OBJ}/tgp-msg.o ${OBJ}/tgp-request.o ${OBJ}/tgp-blist.o ${OBJ}/lodepng/lodepng.o
|
||||
PLUGIN_OBJECTS=${OBJ}/tgp-net.o ${OBJ}/tgp-timers.o ${OBJ}/msglog.o ${OBJ}/telegram-base.o ${OBJ}/telegram-purple.o ${OBJ}/tgp-2prpl.o ${OBJ}/tgp-structs.o ${OBJ}/tgp-utils.o ${OBJ}/tgp-chat.o ${OBJ}/tgp-ft.o ${OBJ}/tgp-msg.o ${OBJ}/tgp-request.o ${OBJ}/tgp-blist.o
|
||||
ALL_OBJS=${PLUGIN_OBJECTS}
|
||||
|
||||
LOCALES=$(patsubst %.po, %.mo, $(wildcard po/*.po))
|
||||
|
@ -48,7 +48,7 @@ DEPENDENCE_LIST=${DEPENDENCE}
|
|||
# The dependency on tgl/libs/libtgl.a ensures that "make -C tgl" was called,
|
||||
# and most importantly: It ensures that all automatic headers exist.
|
||||
${PLUGIN_OBJECTS}: ${OBJ}/%.o: ${srcdir}/%.c ${LIB}/libtgl.a | create_dirs
|
||||
echo $@ && ${CC} ${CFLAGS} ${CPPFLAGS} -I ${srcdir}/tgl -I ${srcdir}/lodepng -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
|
||||
echo $@ && ${CC} ${CFLAGS} ${CPPFLAGS} -I ${srcdir}/tgl -c -MP -MD -MF ${DEP}/$*.d -MQ ${OBJ}/$*.o -o $@ $<
|
||||
|
||||
tgl/Makefile.in:
|
||||
@echo "tgl/Makefile.in not found. Maybe you need to 'git submodule update --init --recursive' ?" && exit 1
|
||||
|
|
|
@ -256,5 +256,3 @@ Acknowledgements
|
|||
----------------
|
||||
|
||||
This software is based on the library [Libtgl](https://github.com/vysheng/tgl), which was written by Vitaly Valtman <mail@vysheng.ru> and others, see (https://github.com/vysheng/tgl/)
|
||||
|
||||
For PNG rendering, it includes the [lodepng library](http://lodev.org/lodepng/).
|
||||
|
|
6150
lodepng/lodepng.c
6150
lodepng/lodepng.c
File diff suppressed because it is too large
Load diff
1711
lodepng/lodepng.h
1711
lodepng/lodepng.h
File diff suppressed because it is too large
Load diff
|
@ -25,7 +25,6 @@
|
|||
#include <gcrypt.h>
|
||||
|
||||
#include "telegram-base.h"
|
||||
#include "lodepng/lodepng.h"
|
||||
|
||||
// O_BINARY exists on windows and must be defined, but doesn't exist on unix-based systems
|
||||
#ifndef O_BINARY
|
||||
|
@ -538,15 +537,8 @@ int tgp_visualize_key (struct tgl_state *TLS, unsigned char* sha1_key) {
|
|||
}
|
||||
}
|
||||
}
|
||||
unsigned char* png;
|
||||
size_t pngsize;
|
||||
unsigned error = lodepng_encode32 (&png, &pngsize, image, img_size, img_size);
|
||||
int imgStoreId = -1;
|
||||
if(!error)
|
||||
{
|
||||
imgStoreId = purple_imgstore_add_with_id (png, pngsize, NULL);
|
||||
used_images_add ((connection_data*)TLS->ev_base, imgStoreId);
|
||||
}
|
||||
int imgStoreId = p2tgl_imgstore_add_with_id_raw(image, img_size, img_size);
|
||||
used_images_add ((connection_data*)TLS->ev_base, imgStoreId);
|
||||
g_free (image);
|
||||
return imgStoreId;
|
||||
}
|
||||
|
|
17
tgp-2prpl.c
17
tgp-2prpl.c
|
@ -22,7 +22,6 @@
|
|||
|
||||
#ifdef HAVE_LIBWEBP
|
||||
#include <webp/decode.h>
|
||||
#include "lodepng/lodepng.h"
|
||||
#endif
|
||||
|
||||
PurpleAccount *tls_get_pa (struct tgl_state *TLS) {
|
||||
|
@ -305,21 +304,9 @@ int p2tgl_imgstore_add_with_id_webp (const char *filename) {
|
|||
g_free ((gchar *)data);
|
||||
const uint8_t *decoded = config.output.u.RGBA.rgba;
|
||||
|
||||
// convert to png
|
||||
unsigned char* png = NULL;
|
||||
size_t pnglen;
|
||||
unsigned error = lodepng_encode32 (&png, &pnglen, decoded, config.options.scaled_width, config.options.scaled_height);
|
||||
// convert and add
|
||||
int imgStoreId = p2tgl_imgstore_add_with_id_raw(decoded, config.options.scaled_width, config.options.scaled_height);
|
||||
WebPFreeDecBuffer (&config.output);
|
||||
if (error) {
|
||||
warning ("error encoding webp as png: %s", filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// will be owned by libpurple imgstore, which uses glib functions for managing memory
|
||||
void *pngdub = g_memdup (png, (guint)pnglen);
|
||||
free (png);
|
||||
|
||||
int imgStoreId = purple_imgstore_add_with_id (pngdub, pnglen, NULL);
|
||||
return imgStoreId;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue