This repository has been archived on 2025-03-20. You can view files and clone it, but cannot push or open issues or pull requests.
The-Powder-Toy/src/gui/game/RectangleBrush.h
Tamás Bálint Misius 369dadf81e
Fix crash from new brush code when TPTMP is enabled
Okay yeah this is actually a well-camouflaged refactor.
2023-02-28 14:57:30 +01:00

22 lines
478 B
C++

#pragma once
#include "Brush.h"
class RectangleBrush: public Brush
{
public:
virtual ~RectangleBrush() override = default;
std::unique_ptr<unsigned char []> GenerateBitmap() const override
{
auto size = GetSize();
auto bitmap = std::make_unique<unsigned char []>(size.X * size.Y);
std::fill(&bitmap[0], &bitmap[0] + size.X * size.Y, 0xFF);
return bitmap;
}
std::unique_ptr<Brush> Clone() const override
{
return std::make_unique<RectangleBrush>(*this);
}
};