aboutsummaryrefslogtreecommitdiffstats
path: root/drmtest.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2017-04-18 12:33:09 +0200
committerGerd Hoffmann <kraxel@redhat.com>2017-04-18 12:33:09 +0200
commit85bb618f1bb8b2a73f3a37df56a88b858b1f1d46 (patch)
tree322e96e8a6ef1a35bda6e1eb9ebd5b489ae7ea14 /drmtest.c
parentec2fd3af076bacdfa90185b3e3bc26dd76f964c7 (diff)
downloaddrminfo-85bb618f1bb8b2a73f3a37df56a88b858b1f1d46.tar.gz
image loading update
Diffstat (limited to 'drmtest.c')
-rw-r--r--drmtest.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drmtest.c b/drmtest.c
index db57b98..ab58bc5 100644
--- a/drmtest.c
+++ b/drmtest.c
@@ -26,6 +26,7 @@
#include "drmtools.h"
#include "render.h"
+#include "image.h"
/* ------------------------------------------------------------------ */
@@ -54,6 +55,9 @@ cairo_device_t *cd;
cairo_surface_t *cs;
cairo_t *cc;
+/* user options */
+cairo_surface_t *image;
+
/* ------------------------------------------------------------------ */
static void drm_init_dev(int devnr, const char *output,
@@ -178,7 +182,11 @@ static void drm_draw(const char *text)
snprintf(info, sizeof(info), "drmtest: %dx%d at %s",
mode->hdisplay, mode->vdisplay, name);
cr = cairo_create(cs);
- render_test(cr, mode->hdisplay, mode->vdisplay, info, text);
+ if (image) {
+ render_image(cr, mode->hdisplay, mode->vdisplay, image);
+ } else {
+ render_test(cr, mode->hdisplay, mode->vdisplay, info, text);
+ }
cairo_destroy(cr);
}
@@ -401,6 +409,7 @@ static void usage(FILE *fp)
" -c <nr> pick card\n"
" -o <name> pick output\n"
" -s <secs> set sleep time\n"
+ " -i <file> load and display image <file>\n"
" -g openngl mode\n"
#if 0
" -d debug mode (opengl)\n"
@@ -418,7 +427,7 @@ int main(int argc, char **argv)
int c;
for (;;) {
- c = getopt(argc, argv, "hgdc:s:o:");
+ c = getopt(argc, argv, "hgdc:s:o:i:");
if (c == -1)
break;
switch (c) {
@@ -428,6 +437,9 @@ int main(int argc, char **argv)
case 's':
secs = atoi(optarg);
break;
+ case 'i':
+ image = load_image(optarg);
+ break;
case 'o':
output = optarg;
break;