forked from KolibriOS/kolibrios
uPDF:
- fix 'color rotate' bug (http://board.kolibrios.org/viewtopic.php?f=38&t=1958&start=30#p42004) - fix bigger page artefact under smaller page git-svn-id: svn://kolibrios.org@8461 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
57c57ff9ff
commit
2f20ba26d3
@ -9,7 +9,7 @@ CFLAGS = -c -fno-ident -O2 -fomit-frame-pointer -fno-ident -U__WIN32__ -U_Win32
|
||||
INCLUDES = -I $(SDK_DIR)/sources/newlib/libc/include -I $(SDK_DIR)/sources/freetype/include -I $(SDK_DIR)/sources/zlib -I ../fitz -I ../pdf
|
||||
LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib -L ../lib
|
||||
|
||||
APPS_SRC := $(notdir $(wildcard *.c))
|
||||
APPS_SRC := kolibri.c kos_main.c pdfapp.c
|
||||
|
||||
default: $(patsubst %.c,%.o,$(APPS_SRC))
|
||||
$(LD) $(LDFLAGS) $(LIBPATH) --subsystem native -o updf kolibri.o pdfapp.o kos_main.o -lmupdf -lfitz -lgcc -lfitz -ldraw -ljpeg -ljbig2dec -lfreetype -lopenjpeg -lz -lc.dll
|
||||
|
@ -131,47 +131,23 @@ void winblit(pdfapp_t *app)
|
||||
if (Form.client_width > gapp.image->w) window_center = (Form.client_width - gapp.image->w) / 2; else window_center = 0;
|
||||
|
||||
gapp.panx = 0;
|
||||
if (gapp.image->n == 4) {
|
||||
kos_blit(window_center + Form.client_left,
|
||||
Form.client_top + TOOLBAR_HEIGHT,
|
||||
Form.client_width,
|
||||
Form.client_height - TOOLBAR_HEIGHT,
|
||||
gapp.panx,
|
||||
gapp.pany,
|
||||
gapp.image->w,
|
||||
gapp.image->h,
|
||||
gapp.image->w * gapp.image->n,
|
||||
gapp.image->samples
|
||||
);
|
||||
}
|
||||
else if (gapp.image->n == 2)
|
||||
{
|
||||
int i = gapp.image->w*gapp.image->h;
|
||||
unsigned char *color = malloc(i*4);
|
||||
if (color != NULL)
|
||||
{
|
||||
unsigned char *s = gapp.image->samples;
|
||||
unsigned char *d = color;
|
||||
for (; i > 0 ; i--)
|
||||
{
|
||||
d[2] = d[1] = d[0] = *s++;
|
||||
d[3] = *s++;
|
||||
d += 4;
|
||||
}
|
||||
kos_blit(window_center + Form.client_left,
|
||||
Form.client_top + TOOLBAR_HEIGHT,
|
||||
Form.client_width,
|
||||
Form.client_height - TOOLBAR_HEIGHT,
|
||||
gapp.panx,
|
||||
gapp.pany,
|
||||
gapp.image->w,
|
||||
gapp.image->h,
|
||||
gapp.image->w * 4,
|
||||
color
|
||||
);
|
||||
free(color);
|
||||
}
|
||||
}
|
||||
|
||||
kos_blit(window_center + Form.client_left,
|
||||
Form.client_top + TOOLBAR_HEIGHT,
|
||||
Form.client_width,
|
||||
Form.client_height - TOOLBAR_HEIGHT,
|
||||
gapp.panx,
|
||||
gapp.pany,
|
||||
gapp.image->w,
|
||||
gapp.image->h,
|
||||
gapp.image->w * gapp.image->n, // stride
|
||||
gapp.image->samples // image
|
||||
);
|
||||
|
||||
/*
|
||||
void kos_blit(int dstx, int dsty, int w, int h, int srcx, int srcy, int srcw, int srch, int stride, char *d)
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -369,7 +345,7 @@ int main (int argc, char* argv[])
|
||||
}
|
||||
|
||||
if (argc == 1) {
|
||||
kol_board_puts("uPDF: no param set, showing OpenDialog");
|
||||
kol_board_puts("uPDF: no param set, showing OpenDialog...\n");
|
||||
RunOpenApp(argv[0]);
|
||||
exit(0);
|
||||
}
|
||||
@ -381,15 +357,15 @@ int main (int argc, char* argv[])
|
||||
int resolution = 72;
|
||||
int pageno = 1;
|
||||
fz_accelerate();
|
||||
kol_board_puts("PDF init\n");
|
||||
kol_board_puts("PDF init...\n");
|
||||
pdfapp_init(&gapp);
|
||||
gapp.scrw = 600;
|
||||
gapp.scrh = 400;
|
||||
gapp.resolution = resolution;
|
||||
gapp.pageno = pageno;
|
||||
kol_board_puts("PDF Open\n");
|
||||
kol_board_puts("PDF Open...\n");
|
||||
pdfapp_open(&gapp, full_argv, 0, 0);
|
||||
kol_board_puts("PDF Opened\n");
|
||||
kol_board_puts("PDF Opened!\n");
|
||||
wintitle(&gapp, 0, full_argv);
|
||||
|
||||
kol_board_puts("Inital paint\n");
|
||||
|
@ -15,6 +15,7 @@ enum panning
|
||||
PAN_TO_BOTTOM
|
||||
};
|
||||
|
||||
void DrawPageSides(void);
|
||||
static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repaint);
|
||||
|
||||
static void pdfapp_warn(pdfapp_t *app, const char *fmt, ...)
|
||||
@ -358,11 +359,15 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
|
||||
if (app->grayscale)
|
||||
colorspace = fz_device_gray;
|
||||
else
|
||||
//#ifdef _WIN32
|
||||
/*
|
||||
#ifdef _WIN32
|
||||
colorspace = fz_device_bgr;
|
||||
//#else
|
||||
// colorspace = fz_device_rgb;
|
||||
//#endif
|
||||
#else
|
||||
colorspace = fz_device_rgb;
|
||||
#endif
|
||||
*/
|
||||
colorspace = fz_device_bgr;
|
||||
|
||||
app->image = fz_new_pixmap_with_rect(colorspace, bbox);
|
||||
fz_clear_pixmap_with_color(app->image, 255);
|
||||
idev = fz_new_draw_device(app->cache, app->image);
|
||||
@ -397,6 +402,8 @@ static void pdfapp_showpage(pdfapp_t *app, int loadpage, int drawpage, int repai
|
||||
}
|
||||
|
||||
fz_flush_warnings();
|
||||
|
||||
DrawPageSides();
|
||||
}
|
||||
|
||||
static void pdfapp_gotouri(pdfapp_t *app, fz_obj *uri)
|
||||
|
Loading…
Reference in New Issue
Block a user