From 46d75c072a02388165dd28c23229cac19530e146 Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 3 Jul 2020 19:33:57 -0400 Subject: [PATCH] ncdirect_render_image(): don't take current x into account #759 --- src/lib/direct.cpp | 13 +++---------- src/poc/vizdirect.c | 2 -- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/lib/direct.cpp b/src/lib/direct.cpp index 684e2fa3b..0f72259ca 100644 --- a/src/lib/direct.cpp +++ b/src/lib/direct.cpp @@ -288,20 +288,14 @@ nc_err_e ncdirect_render_image(ncdirect* n, const char* file, ncblitter_e blitte if(ncv == NULL){ return ret; } - int begy, begx; //fprintf(stderr, "OUR DATA: %p rows/cols: %d/%d\n", ncv->data, ncv->rows, ncv->cols); - if(ncdirect_cursor_yx(n, &begy, &begx)){ - ncvisual_destroy(ncv); - return NCERR_SYSTEM; - } -//fprintf(stderr, "INITIAL CURSOR: %d/%d\n", begy, begx); int leny = ncv->rows; // we allow it to freely scroll - int lenx = ncv->cols - begx; + int lenx = ncv->cols; if(leny == 0 || lenx == 0){ ncvisual_destroy(ncv); return NCERR_DECODE; } -//fprintf(stderr, "render %d/%d to %dx%d+%dx%d scaling: %d\n", ncv->rows, ncv->cols, begy, begx, leny, lenx, scale); +//fprintf(stderr, "render %d/%d to %d+%dx%d scaling: %d\n", ncv->rows, ncv->cols, leny, lenx, scale); auto bset = rgba_blitter_low(n->utf8, scale, true, blitter); if(!bset){ return NCERR_INVALID_ARG; @@ -312,14 +306,13 @@ nc_err_e ncdirect_render_image(ncdirect* n, const char* file, ncblitter_e blitte if(scale != NCSCALE_NONE){ dispcols *= encoding_x_scale(bset); disprows *= encoding_y_scale(bset); - dispcols -= begx; if(scale == NCSCALE_SCALE){ scale_visual(ncv, &disprows, &dispcols); } } 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: %d+%d of %d/%d stride %u %p\n", leny, lenx, ncv->rows, ncv->cols, ncv->rowstride, ncv->data); struct ncplane* faken = ncplane_create(NULL, NULL, disprows / encoding_y_scale(bset), dispcols,// / encoding_x_scale(bset), diff --git a/src/poc/vizdirect.c b/src/poc/vizdirect.c index a072e119c..58b5a67f6 100644 --- a/src/poc/vizdirect.c +++ b/src/poc/vizdirect.c @@ -16,12 +16,10 @@ int main(void){ return EXIT_FAILURE; } sleep(1); - printf("\n"); if(ncdirect_render_image(n, "../data/changes.jpg", NCBLIT_DEFAULT, NCSCALE_SCALE) != NCERR_SUCCESS){ return EXIT_FAILURE; } sleep(1); - printf("\n"); if(ncdirect_render_image(n, "../data/warmech.bmp", NCBLIT_DEFAULT, NCSCALE_NONE) != NCERR_SUCCESS){ return EXIT_FAILURE; }