From 59321aa7775916d2930ffc89a66644f5f9d10c58 Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 13 Aug 2024 00:11:28 -0400 Subject: [PATCH] reuse Create with format in Bitmap --- src/app/gfx/bitmap.cc | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/app/gfx/bitmap.cc b/src/app/gfx/bitmap.cc index 590a8275..4ec89720 100644 --- a/src/app/gfx/bitmap.cc +++ b/src/app/gfx/bitmap.cc @@ -205,20 +205,7 @@ Bitmap::Bitmap(int width, int height, int depth, int data_size) { } void Bitmap::Create(int width, int height, int depth, const Bytes &data) { - active_ = true; - width_ = width; - height_ = height; - depth_ = depth; - data_ = data; - data_size_ = data.size(); - pixel_data_ = data_.data(); - surface_ = std::unique_ptr( - SDL_CreateRGBSurfaceWithFormat(0, width_, height_, depth_, - SDL_PIXELFORMAT_INDEX8), - SDL_Surface_Deleter()); - surface_->pixels = pixel_data_; - GrayscalePalette(surface_->format->palette); - active_ = true; + Create(width, height, depth, kIndexed, data); } void Bitmap::Create(int width, int height, int depth, int format,