From 40d0efceceaf92c1d04061908300ceaf61e071af Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 29 Jun 2020 23:49:05 -0400 Subject: [PATCH] ncdirect_render_image(): just about working #725 --- src/lib/direct.cpp | 7 ++++--- src/poc/vizdirect.c | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/direct.cpp b/src/lib/direct.cpp index 6622e7959..d512e6427 100644 --- a/src/lib/direct.cpp +++ b/src/lib/direct.cpp @@ -226,6 +226,7 @@ ncdirect_dump_plane(ncdirect* n, const ncplane* np){ } ncdirect_fg(n, channels_fg(channels)); ncdirect_bg(n, channels_bg(channels)); +// fprintf(stderr, "%03d/%03d [%s]\n", y, x, egc); if(printf("%s", egc) < 0){ return -1; } @@ -259,8 +260,8 @@ nc_err_e ncdirect_render_image(ncdirect* n, const char* file, ncblitter_e blitte return NCERR_INVALID_ARG; } int disprows, dispcols; - dispcols = ncdirect_dim_x(n); disprows = ncdirect_dim_y(n); + dispcols = ncdirect_dim_x(n); if(scale != NCSCALE_NONE){ dispcols *= encoding_x_scale(bset); disprows *= encoding_y_scale(bset); @@ -271,13 +272,13 @@ nc_err_e ncdirect_render_image(ncdirect* n, const char* file, ncblitter_e blitte } leny = (leny / (double)ncv->rows) * ((double)disprows); lenx = (lenx / (double)ncv->cols) * ((double)dispcols); -//fprintf(stderr, "render: %dx%d:%d+%d of %d/%d stride %u %p\n", begy, begx, leny, lenx, ncv->rows, ncv->cols, ncv->rowstride, ncv->data); +fprintf(stderr, "render: %dx%d:%d+%d of %d/%d stride %u %p\n", begy, begx, leny, lenx, ncv->rows, ncv->cols, ncv->rowstride, ncv->data); struct ncplane* faken = ncplane_create(NULL, NULL, disprows, dispcols, 0, 0, NULL); if(faken == NULL){ return NCERR_NOMEM; } if(ncvisual_blit(ncv, disprows, dispcols, faken, bset, - begy, begx, begy, begx, leny, lenx, + 0, 0, 0, 0, leny, lenx, false)){ ncvisual_destroy(ncv); free_plane(faken); diff --git a/src/poc/vizdirect.c b/src/poc/vizdirect.c index b601ca022..1be39d9fb 100644 --- a/src/poc/vizdirect.c +++ b/src/poc/vizdirect.c @@ -1,4 +1,5 @@ #include +#include #include // can we leave what was already on the screen there? (narrator: it seems not) @@ -14,6 +15,10 @@ int main(void){ if(ncdirect_render_image(n, "../data/warmech.bmp", NCBLIT_DEFAULT, NCSCALE_STRETCH) != NCERR_SUCCESS){ return EXIT_FAILURE; } + sleep(1); + if(ncdirect_render_image(n, "../data/worldmap.png", NCBLIT_DEFAULT, NCSCALE_STRETCH) != NCERR_SUCCESS){ + return EXIT_FAILURE; + } if(ncdirect_stop(n)){ return EXIT_FAILURE; }