From 21b84d341a555a822da1dd7d8323aeb4ce6c3014 Mon Sep 17 00:00:00 2001 From: nick black Date: Mon, 22 Nov 2021 02:58:17 -0500 Subject: [PATCH] [tetris] don't double-decode the background #2366 --- src/lib/kitty.c | 10 +++++----- src/tetris/background.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib/kitty.c b/src/lib/kitty.c index 7df665c39..90e2ac3ac 100644 --- a/src/lib/kitty.c +++ b/src/lib/kitty.c @@ -689,11 +689,11 @@ prep_animation(ncpixelimpl_e level, uint32_t** buf, int leny, int lenx, unsigned if(level < NCPIXEL_KITTY_ANIMATED){ *animated = false; *buf = NULL; - }else{ - if((*buf = malloc(lenx * leny * sizeof(uint32_t))) == NULL){ - return -1; - } - *animated = true; + return 0; + } + *animated = true; + if((*buf = malloc(lenx * leny * sizeof(uint32_t))) == NULL){ + return -1; } return 0; } diff --git a/src/tetris/background.h b/src/tetris/background.h index 978aa3df5..ac973b46c 100644 --- a/src/tetris/background.h +++ b/src/tetris/background.h @@ -1,9 +1,9 @@ void DrawBackground(const std::string& s) { // drawn to the standard plane backg_ = std::make_unique(s.c_str()); - backg_->decode(); ncvisual_options opts{}; opts.scaling = NCSCALE_STRETCH; opts.n = *nc_.get_stdplane(); + opts.blitter = NCBLIT_PIXEL; opts.flags = NCVISUAL_OPTION_CHILDPLANE; backg_->blit(&opts); }