forked from enlightenment/efl
parent
3684e4ca50
commit
fa21e407c4
|
@ -1,7 +1,7 @@
|
|||
y##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
|
||||
m4_define([v_maj], [0])
|
||||
m4_define([v_min], [9])
|
||||
m4_define([v_min], [1])
|
||||
m4_define([v_mic], [999])
|
||||
m4_define([v_rev], m4_esyscmd([(svnversion "${SVN_REPO_PATH:-.}" | grep -v export || echo 0) | awk -F : '{printf("%s\n", $1);}' | tr -d ' :MSP\n']))
|
||||
m4_if(v_rev, [0], [m4_define([v_rev], m4_esyscmd([git log 2> /dev/null | (grep -m1 git-svn-id || echo 0) | sed -e 's/.*@\([0-9]*\).*/\1/' | tr -d '\n']))])
|
||||
|
@ -111,6 +111,7 @@ AC_CONFIG_FILES([
|
|||
Makefile
|
||||
src/Makefile
|
||||
src/bin/Makefile
|
||||
src/bin/common/Makefile
|
||||
src/bin/xcf/Makefile
|
||||
src/bin/pdf/Makefile
|
||||
])
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
SUBDIRS = xcf
|
||||
SUBDIRS = common \
|
||||
xcf
|
||||
|
||||
if HAVE_PDF
|
||||
SUBDIRS += pdf
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
EXTRA_DIST = shmfile.c shmfile.h
|
|
@ -0,0 +1,82 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <math.h>
|
||||
#include <netinet/in.h>
|
||||
#include <time.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int shm_fd = -1;
|
||||
int shm_size = 0;
|
||||
void *shm_addr = NULL;
|
||||
char shmfile[1024] = "";
|
||||
|
||||
void
|
||||
shm_alloc(int dsize)
|
||||
{
|
||||
#ifdef HAVE_SHM_OPEN
|
||||
srand(time(NULL));
|
||||
do
|
||||
{
|
||||
snprintf(shmfile, sizeof(shmfile), "/evas-loader-xcf.%i.%i",
|
||||
(int)getpid(), (int)rand());
|
||||
shm_fd = shm_open(shmfile, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||
}
|
||||
while (shm_fd < 0);
|
||||
|
||||
if (ftruncate(shm_fd, dsize) < 0)
|
||||
{
|
||||
close(shm_fd);
|
||||
shm_unlink(shmfile);
|
||||
shm_fd = -1;
|
||||
goto failed;
|
||||
}
|
||||
shm_addr = mmap(NULL, dsize, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
|
||||
if (shm_addr == MAP_FAILED)
|
||||
{
|
||||
close(shm_fd);
|
||||
shm_unlink(shmfile);
|
||||
shm_fd = -1;
|
||||
goto failed;
|
||||
}
|
||||
shm_size = dsize;
|
||||
return;
|
||||
failed:
|
||||
#endif
|
||||
shm_addr = malloc(dsize);
|
||||
}
|
||||
|
||||
void
|
||||
shm_free(void)
|
||||
{
|
||||
#ifdef HAVE_SHM_OPEN
|
||||
if (shm_fd >= 0)
|
||||
{
|
||||
munmap(shm_addr, shm_size);
|
||||
close(shm_fd);
|
||||
shm_fd = -1;
|
||||
shm_addr = NULL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
free(shm_addr);
|
||||
shm_addr = NULL;
|
||||
shm_fd = -1;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef SHMFILE_H
|
||||
#define SHMFILE_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int shm_fd;
|
||||
extern int shm_size;
|
||||
extern void *shm_addr;
|
||||
extern char *shmfile;
|
||||
|
||||
void shm_alloc (int dsize);
|
||||
void shm_free (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -4,6 +4,7 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/bin \
|
||||
-I$(top_srcdir)/src/bin/common \
|
||||
-I$(top_srcdir)/src/bin/pdf \
|
||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
|
||||
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||
|
@ -13,7 +14,9 @@ AM_CPPFLAGS = \
|
|||
|
||||
bin_PROGRAMS = evas_image_loader.pdf
|
||||
|
||||
evas_image_loader_pdf_SOURCES = main.cpp
|
||||
evas_image_loader_pdf_SOURCES = \
|
||||
main.cpp \
|
||||
$(top_srcdir)/src/bin/common/shmfile.c
|
||||
evas_image_loader_pdf_CFLAGS =
|
||||
evas_image_loader_pdf_LDADD = @POPPLER_LIBS@ @EINA_LIBS@ @SHM_OPEN_LIBS@
|
||||
evas_image_loader_pdf_LDFLAGS =
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include <Eina.h>
|
||||
|
||||
#include "shmfile.h"
|
||||
|
||||
#define DATA32 unsigned int
|
||||
|
||||
|
@ -36,66 +37,8 @@ int crop_width = 0, crop_height = 0;
|
|||
void *data = NULL;
|
||||
double dpi = -1.0;
|
||||
|
||||
static int shm_fd = -1;
|
||||
static int shm_size = 0;
|
||||
static void *shm_addr = NULL;
|
||||
static char shmfile[1024] = "";
|
||||
|
||||
#define DEF_DPI 72.0
|
||||
|
||||
static void
|
||||
shm_alloc(int dsize)
|
||||
{
|
||||
#ifdef HAVE_SHM_OPEN
|
||||
srand(time(NULL));
|
||||
do
|
||||
{
|
||||
snprintf(shmfile, sizeof(shmfile), "/evas-loader-xcf.%i.%i",
|
||||
(int)getpid(), (int)rand());
|
||||
shm_fd = shm_open(shmfile, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||
}
|
||||
while (shm_fd < 0);
|
||||
|
||||
if (ftruncate(shm_fd, dsize) < 0)
|
||||
{
|
||||
close(shm_fd);
|
||||
shm_unlink(shmfile);
|
||||
shm_fd = -1;
|
||||
goto failed;
|
||||
}
|
||||
shm_addr = mmap(NULL, dsize, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
|
||||
if (shm_addr == MAP_FAILED)
|
||||
{
|
||||
close(shm_fd);
|
||||
shm_unlink(shmfile);
|
||||
shm_fd = -1;
|
||||
goto failed;
|
||||
}
|
||||
shm_size = dsize;
|
||||
return;
|
||||
failed:
|
||||
#endif
|
||||
shm_addr = malloc(dsize);
|
||||
}
|
||||
|
||||
static void
|
||||
shm_free(void)
|
||||
{
|
||||
#ifdef HAVE_SHM_OPEN
|
||||
if (shm_fd >= 0)
|
||||
{
|
||||
munmap(shm_addr, shm_size);
|
||||
close(shm_fd);
|
||||
shm_fd = -1;
|
||||
shm_addr = NULL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
free(shm_addr);
|
||||
shm_addr = NULL;
|
||||
shm_fd = -1;
|
||||
}
|
||||
|
||||
Eina_Bool poppler_init(const char *file, int page_nbr, int size_w, int size_h)
|
||||
{
|
||||
Object obj;
|
||||
|
|
|
@ -4,6 +4,7 @@ AM_CPPFLAGS = \
|
|||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/bin \
|
||||
-I$(top_srcdir)/src/bin/common \
|
||||
-I$(top_srcdir)/src/bin/xcf \
|
||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
|
||||
-DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||
|
@ -12,7 +13,9 @@ AM_CPPFLAGS = \
|
|||
|
||||
bin_PROGRAMS = evas_image_loader.xcf
|
||||
|
||||
evas_image_loader_xcf_SOURCES = main.c pixelfuncs.c common.h
|
||||
evas_image_loader_xcf_SOURCES = \
|
||||
main.c pixelfuncs.c common.h \
|
||||
$(top_srcdir)/src/bin/common/shmfile.c
|
||||
evas_image_loader_xcf_CFLAGS = @EINA_CFLAGS@
|
||||
evas_image_loader_xcf_LDADD = @EINA_LIBS@ -lz -lm @SHM_OPEN_LIBS@
|
||||
evas_image_loader_xcf_LDFLAGS =
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
|
||||
*/
|
||||
#include "common.h"
|
||||
#include "shmfile.h"
|
||||
|
||||
#define FREE(X) { free(X); X = NULL; }
|
||||
|
||||
|
@ -300,64 +301,6 @@ extern void combine_pixels_val (DATA8* src, int src_w, int src_h, DATA8* dest, i
|
|||
extern void combine_pixels_col (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y);
|
||||
extern void combine_pixels_diss (DATA8* src, int src_w, int src_h, DATA8* dest, int dest_w, int dest_h, int dest_x, int dest_y);
|
||||
|
||||
static int shm_fd = -1;
|
||||
static int shm_size = 0;
|
||||
static void *shm_addr = NULL;
|
||||
static char shmfile[1024] = "";
|
||||
|
||||
static void
|
||||
shm_alloc(int dsize)
|
||||
{
|
||||
#ifdef HAVE_SHM_OPEN
|
||||
srand(time(NULL));
|
||||
do
|
||||
{
|
||||
snprintf(shmfile, sizeof(shmfile), "/evas-loader-xcf.%i.%i",
|
||||
(int)getpid(), (int)rand());
|
||||
shm_fd = shm_open(shmfile, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
|
||||
}
|
||||
while (shm_fd < 0);
|
||||
|
||||
if (ftruncate(shm_fd, dsize) < 0)
|
||||
{
|
||||
close(shm_fd);
|
||||
shm_unlink(shmfile);
|
||||
shm_fd = -1;
|
||||
goto failed;
|
||||
}
|
||||
shm_addr = mmap(NULL, dsize, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, 0);
|
||||
if (shm_addr == MAP_FAILED)
|
||||
{
|
||||
close(shm_fd);
|
||||
shm_unlink(shmfile);
|
||||
shm_fd = -1;
|
||||
goto failed;
|
||||
}
|
||||
shm_size = dsize;
|
||||
return;
|
||||
failed:
|
||||
#endif
|
||||
shm_addr = malloc(dsize);
|
||||
}
|
||||
|
||||
static void
|
||||
shm_free(void)
|
||||
{
|
||||
#ifdef HAVE_SHM_OPEN
|
||||
if (shm_fd >= 0)
|
||||
{
|
||||
munmap(shm_addr, shm_size);
|
||||
close(shm_fd);
|
||||
shm_fd = -1;
|
||||
shm_addr = NULL;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
free(shm_addr);
|
||||
shm_addr = NULL;
|
||||
shm_fd = -1;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------- globals ------------ */
|
||||
|
||||
/* This makes using the Gimp sources easier */
|
||||
|
|
Loading…
Reference in New Issue