fix bitmap bug
This commit is contained in:
@@ -246,6 +246,10 @@ void Bitmap::Create(int width, int height, int depth, int format,
|
|||||||
depth_ = depth;
|
depth_ = depth;
|
||||||
data_ = data;
|
data_ = data;
|
||||||
data_size_ = data.size();
|
data_size_ = data.size();
|
||||||
|
if (data_size_ == 0) {
|
||||||
|
SDL_Log("Data provided to Bitmap is empty.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
pixel_data_ = data_.data();
|
pixel_data_ = data_.data();
|
||||||
surface_ = std::unique_ptr<SDL_Surface, SDL_Surface_Deleter>(
|
surface_ = std::unique_ptr<SDL_Surface, SDL_Surface_Deleter>(
|
||||||
SDL_CreateRGBSurfaceWithFormat(0, width_, height_, depth_,
|
SDL_CreateRGBSurfaceWithFormat(0, width_, height_, depth_,
|
||||||
|
|||||||
Reference in New Issue
Block a user