Enhance Bitmap class with error handling and code improvements

- Introduced BitmapError class for more specific error handling in the Bitmap class.
- Updated data checks to use `empty()` for clarity and consistency.
- Improved pixel data handling by ensuring proper type usage and modifying loop constructs for better performance.
- Refactored constructor and method implementations for improved readability and maintainability.
This commit is contained in:
scawful
2025-05-18 16:44:15 -04:00
parent f632650568
commit 7cc808918d
2 changed files with 25 additions and 17 deletions

View File

@@ -151,7 +151,7 @@ class Bitmap {
int width() const { return width_; }
int height() const { return height_; }
int depth() const { return depth_; }
int size() const { return data_.size(); }
auto size() const { return data_.size(); }
const uint8_t *data() const { return data_.data(); }
std::vector<uint8_t> &mutable_data() { return data_; }
SDL_Surface *surface() const { return surface_; }