Start of bitmap support for qemacs

Unfortunately it seems bitmap support in qemacs depends on
an antique version of ffmpeg, so it's currently broken.
This commit is contained in:
François Revol
2013-03-15 00:41:20 +00:00
parent e9e0b3003f
commit f39745860e

View File

@@ -4,7 +4,7 @@ RCS file: /sources/qemacs/qemacs/Makefile,v
retrieving revision 1.50
diff -u -r1.50 Makefile
--- Makefile 5 Jun 2008 07:14:12 -0000 1.50
+++ Makefile 14 Mar 2013 18:56:51 -0000
+++ Makefile 14 Mar 2013 23:32:46 -0000
@@ -63,7 +63,7 @@
endif
@@ -35,6 +35,15 @@ diff -u -r1.50 Makefile
endif
ifdef CONFIG_QSCRIPT
@@ -143,7 +148,7 @@
OBJS+= video.o image.o
DEP_LIBS+= $(FFMPEG_LIBDIR)/libavcodec/libavcodec.a $(FFMPEG_LIBDIR)/libavformat/libavformat.a
LIBS+= -L$(FFMPEG_LIBDIR)/libavcodec -L$(FFMPEG_LIBDIR)/libavformat -lavformat -lavcodec -lz -lpthread
- DEFINES+= -I$(FFMPEG_SRCDIR)/libavcodec -I$(FFMPEG_SRCDIR)/libavformat
+ DEFINES+= -I$(FFMPEG_SRCDIR) -I$(FFMPEG_SRCDIR)/libavcodec -I$(FFMPEG_SRCDIR)/libavformat
TARGETS+= ffplay$(EXE)
endif
@@ -226,6 +231,9 @@
$(OBJS_DIR)/%.o: %.c qe.h qestyles.h config.h config.mak Makefile
$(CC) $(DEFINES) $(CFLAGS) -o $@ -c $<
@@ -61,7 +70,7 @@ RCS file: /sources/qemacs/qemacs/cfb.c,v
retrieving revision 1.8
diff -u -r1.8 cfb.c
--- cfb.c 8 Apr 2008 06:55:44 -0000 1.8
+++ cfb.c 14 Mar 2013 18:56:51 -0000
+++ cfb.c 14 Mar 2013 23:32:46 -0000
@@ -50,7 +50,7 @@
static void cfb16_fill_rectangle(QEditScreen *s,
int x1, int y1, int w, int h, QEColor color)
@@ -122,7 +131,7 @@ RCS file: /sources/qemacs/qemacs/configure,v
retrieving revision 1.15
diff -u -r1.15 configure
--- configure 17 Apr 2008 15:06:44 -0000 1.15
+++ configure 14 Mar 2013 18:56:51 -0000
+++ configure 14 Mar 2013 23:32:46 -0000
@@ -45,9 +45,11 @@
ptsname="yes"
gprof="no"
@@ -207,7 +216,7 @@ RCS file: /sources/qemacs/qemacs/display.h,v
retrieving revision 1.11
diff -u -r1.11 display.h
--- display.h 11 Jan 2008 11:29:28 -0000 1.11
+++ display.h 14 Mar 2013 18:56:52 -0000
+++ display.h 14 Mar 2013 23:32:46 -0000
@@ -53,7 +53,7 @@
int refcount;
int ascent;
@@ -217,7 +226,14 @@ diff -u -r1.11 display.h
int system_font; /* TRUE if system font */
/* cache data */
int style;
@@ -153,7 +153,7 @@
@@ -148,12 +148,12 @@
QECharset *charset; /* the charset of the TTY, XXX: suppress that,
use a system in fonts instead */
int media; /* media type (see CSS_MEDIA_xxx) */
- int bitmap_format; /* supported bitmap format */
- int video_format; /* supported video format */
+ QEBitmapFormat bitmap_format; /* supported bitmap format */
+ QEBitmapFormat video_format; /* supported video format */
/* clip region handling */
int clip_x1, clip_y1;
int clip_x2, clip_y2;
@@ -232,7 +248,7 @@ RCS file: /sources/qemacs/qemacs/fbfrender.c,v
retrieving revision 1.10
diff -u -r1.10 fbfrender.c
--- fbfrender.c 8 Jan 2008 16:37:54 -0000 1.10
+++ fbfrender.c 14 Mar 2013 18:56:52 -0000
+++ fbfrender.c 14 Mar 2013 23:32:46 -0000
@@ -124,7 +124,7 @@
static GlyphCache *fbf_decode_glyph1(QEFont *font, int code)
@@ -257,7 +273,7 @@ RCS file: /sources/qemacs/qemacs/html2png.c,v
retrieving revision 1.12
diff -u -r1.12 html2png.c
--- html2png.c 11 Jan 2008 11:29:28 -0000 1.12
+++ html2png.c 14 Mar 2013 18:56:52 -0000
+++ html2png.c 14 Mar 2013 23:32:47 -0000
@@ -135,7 +135,7 @@
/* realloc ppm bitmap */
static int ppm_resize(QEditScreen *s, int w, int h)
@@ -319,7 +335,7 @@ RCS file: /sources/qemacs/qemacs/qe.h,v
retrieving revision 1.96
diff -u -r1.96 qe.h
--- qe.h 4 May 2008 15:54:39 -0000 1.96
+++ qe.h 14 Mar 2013 18:56:53 -0000
+++ qe.h 14 Mar 2013 23:32:48 -0000
@@ -267,11 +267,11 @@
int ustristart(const unsigned int *str, const char *val, const unsigned int **ptr);
static inline unsigned int *umemmove(unsigned int *dest,
@@ -340,7 +356,7 @@ RCS file: /sources/qemacs/qemacs/tty.c,v
retrieving revision 1.50
diff -u -r1.50 tty.c
--- tty.c 23 Apr 2008 15:30:33 -0000 1.50
+++ tty.c 14 Mar 2013 18:56:54 -0000
+++ tty.c 14 Mar 2013 23:32:49 -0000
@@ -118,7 +118,7 @@
tty_screen = s;
@@ -436,7 +452,7 @@ RCS file: /sources/qemacs/qemacs/win32.c,v
retrieving revision 1.15
diff -u -r1.15 win32.c
--- win32.c 23 Apr 2008 15:29:35 -0000 1.15
+++ win32.c 14 Mar 2013 18:56:54 -0000
+++ win32.c 14 Mar 2013 23:32:49 -0000
@@ -139,7 +139,7 @@
if (!_hPrev)
init_application();
@@ -461,7 +477,7 @@ RCS file: /sources/qemacs/qemacs/x11.c,v
retrieving revision 1.28
diff -u -r1.28 x11.c
--- x11.c 15 Apr 2008 23:24:04 -0000 1.28
+++ x11.c 14 Mar 2013 18:56:54 -0000
+++ x11.c 14 Mar 2013 23:32:49 -0000
@@ -194,7 +194,7 @@
QEStyleDef default_style;
XGCValues gc_val;
@@ -567,8 +583,8 @@ diff -u -r1.28 x11.c
XSetFont(display, gc, xfont->fid);
XDrawString16(display, dbuffer, gc, x_start, y, x11_str, l);
--- /dev/null 2013-03-14 16:10:28.351668000 +0100
+++ haiku.cpp 2013-03-14 19:43:57.698351616 +0100
@@ -0,0 +1,831 @@
+++ haiku.cpp 2013-03-14 20:51:17.995622912 +0100
@@ -0,0 +1,883 @@
+/*
+ * Haiku driver for QEmacs
+ * Copyright (c) 2013 François Revol.
@@ -593,6 +609,7 @@ diff -u -r1.28 x11.c
+}
+
+#include <Application.h>
+#include <Bitmap.h>
+#include <FindDirectory.h>
+#include <Font.h>
+#include <InterfaceDefs.h>
@@ -852,6 +869,10 @@ diff -u -r1.28 x11.c
+ s->priv_data = ctx;
+ s->media = CSS_MEDIA_SCREEN;
+
+ s->bitmap_format = QEBITMAP_FORMAT_RGBA32;
+ /* BBitmap supports overlay, but not planar data */
+ //s->video_format = QEBITMAP_FORMAT_RGBA32;
+
+ int event_pipe[2];
+ if (pipe(event_pipe) < 0)
+ return -1;
@@ -1348,6 +1369,53 @@ diff -u -r1.28 x11.c
+ ctx->v->UnlockLooper();
+}
+
+static int haiku_bmp_alloc(QEditScreen *s, QEBitmap *b)
+{
+ BBitmap *bitmap;
+ color_space space = B_RGBA32;
+ uint32 flags = 0;
+
+ b->format = s->bitmap_format;
+ if (b->flags & QEBITMAP_FLAG_VIDEO) {
+ b->format = s->video_format;
+ }
+fprintf(stderr, "%s(, [w %d, h %d])\n", __FUNCTION__, b->width, b->height);
+ switch (b->format) {
+ case QEBITMAP_FORMAT_RGB565:
+ space = B_RGB16;
+ break;
+ case QEBITMAP_FORMAT_RGB555:
+ space = B_RGB15;
+ break;
+ case QEBITMAP_FORMAT_RGB24:
+ space = B_RGB24;
+ break;
+ case QEBITMAP_FORMAT_RGBA32:
+ space = B_RGBA32;
+ break;
+ case QEBITMAP_FORMAT_YUV420P:
+ // we don't support planar overlays
+ default:
+ return -1;
+ }
+
+ BRect bounds(0, 0, b->width - 1, b->height - 1);
+ bitmap = new BBitmap(bounds, flags, space);
+ if (bitmap->InitCheck() != B_OK) {
+ delete bitmap;
+ return -1;
+ }
+ b->priv_data = bitmap;
+
+ return 0;
+}
+
+static void haiku_bmp_free(__unused__ QEditScreen *s, QEBitmap *b)
+{
+ BBitmap *bitmap = (BBitmap *)b->priv_data;
+ delete bitmap;
+}
+
+extern QEDisplay haiku_dpy = {
+ "haiku",
+ haiku_probe,
@@ -1365,8 +1433,8 @@ diff -u -r1.28 x11.c
+ NULL, /* no selection handling */
+ NULL, /* dpy_invalidate */
+ NULL, /* dpy_cursor_at */
+ NULL, /* dpy_bmp_alloc */
+ NULL, /* dpy_bmp_free */
+ haiku_bmp_alloc, /* dpy_bmp_alloc */
+ haiku_bmp_free, /* dpy_bmp_free */
+ NULL, /* dpy_bmp_draw */
+ NULL, /* dpy_bmp_lock */
+ NULL, /* dpy_bmp_unlock */