[tetris] don't double-decode the background #2366

This commit is contained in:
nick black 2021-11-22 02:58:17 -05:00
parent a74e7c12b4
commit 21b84d341a
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 6 additions and 6 deletions

View File

@ -689,11 +689,11 @@ prep_animation(ncpixelimpl_e level, uint32_t** buf, int leny, int lenx, unsigned
if(level < NCPIXEL_KITTY_ANIMATED){ if(level < NCPIXEL_KITTY_ANIMATED){
*animated = false; *animated = false;
*buf = NULL; *buf = NULL;
}else{ return 0;
if((*buf = malloc(lenx * leny * sizeof(uint32_t))) == NULL){
return -1;
} }
*animated = true; *animated = true;
if((*buf = malloc(lenx * leny * sizeof(uint32_t))) == NULL){
return -1;
} }
return 0; return 0;
} }

View File

@ -1,9 +1,9 @@
void DrawBackground(const std::string& s) { // drawn to the standard plane void DrawBackground(const std::string& s) { // drawn to the standard plane
backg_ = std::make_unique<ncpp::Visual>(s.c_str()); backg_ = std::make_unique<ncpp::Visual>(s.c_str());
backg_->decode();
ncvisual_options opts{}; ncvisual_options opts{};
opts.scaling = NCSCALE_STRETCH; opts.scaling = NCSCALE_STRETCH;
opts.n = *nc_.get_stdplane(); opts.n = *nc_.get_stdplane();
opts.blitter = NCBLIT_PIXEL;
opts.flags = NCVISUAL_OPTION_CHILDPLANE; opts.flags = NCVISUAL_OPTION_CHILDPLANE;
backg_->blit(&opts); backg_->blit(&opts);
} }