refactor(core/rendering): Rendering::OPAQUE_ALPHA constant (HC-02)
Surface i Screen repetien el bit d'alpha opac com a 0xFF000000U o com (0xFFU << 24). S'afegeix inline constexpr Rendering::OPAQUE_ALPHA a canvas.hpp i s'usa a les tres ocurrències. Build + smoke 5s xvfb OK (exit 124). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
be94a4390e
commit
8b413affa8
4 files changed
+13
-7
No files matched your search
@@ -10,6 +10,7 @@
|
||||
#include <memory>
|
||||
#include <ranges>
|
||||
|
||||
#include "core/rendering/canvas.hpp"
|
||||
#include "utils/defines.hpp"
|
||||
|
||||
namespace {
|
||||
@@ -52,7 +53,7 @@ void Screen::configure(const Config& config) {
|
||||
subsystem_initialized_ = true;
|
||||
canvas_width_ = GameCanvas::WIDTH;
|
||||
canvas_height_ = GameCanvas::HEIGHT;
|
||||
canvas_.assign(static_cast<std::size_t>(GameCanvas::WIDTH) * static_cast<std::size_t>(GameCanvas::HEIGHT), 0xFF000000U);
|
||||
canvas_.assign(static_cast<std::size_t>(GameCanvas::WIDTH) * static_cast<std::size_t>(GameCanvas::HEIGHT), Rendering::OPAQUE_ALPHA);
|
||||
}
|
||||
destroySdl();
|
||||
config_ = config;
|
||||
@@ -214,7 +215,7 @@ void Screen::adjustWindowSize() {
|
||||
}
|
||||
|
||||
void Screen::clear(std::uint8_t r, std::uint8_t g, std::uint8_t b) {
|
||||
const std::uint32_t COLOR = (0xFFU << 24) | (static_cast<std::uint32_t>(r) << 16) | (static_cast<std::uint32_t>(g) << 8) | static_cast<std::uint32_t>(b);
|
||||
const std::uint32_t COLOR = Rendering::OPAQUE_ALPHA | (static_cast<std::uint32_t>(r) << 16) | (static_cast<std::uint32_t>(g) << 8) | static_cast<std::uint32_t>(b);
|
||||
std::ranges::fill(canvas_, COLOR);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user