mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 11:01:49 +00:00
fix canvas:line lines clipping
This commit is contained in:
parent
279fb92b94
commit
a5596ed5cd
2 changed files with 93 additions and 39 deletions
|
|
@ -81,16 +81,17 @@ union RGBA {
|
|||
uint8_t arr[4];
|
||||
uint32_t rgba;
|
||||
};
|
||||
static_assert(sizeof(RGBA) == 4);
|
||||
|
||||
static RGBA* get_at(const ImageData& data, uint index) {
|
||||
if (index >= data.getWidth() * data.getHeight()) {
|
||||
return nullptr;
|
||||
}
|
||||
static RGBA* get_at(const ImageData& data, size_t index) {
|
||||
return reinterpret_cast<RGBA*>(data.getData() + index * sizeof(RGBA));
|
||||
}
|
||||
|
||||
static RGBA* get_at(const ImageData& data, uint x, uint y) {
|
||||
return get_at(data, y * data.getWidth() + x);
|
||||
if (x >= data.getWidth() || y >= data.getHeight()) {
|
||||
return nullptr;
|
||||
}
|
||||
return get_at(data, static_cast<size_t>(y) * data.getWidth() + x);
|
||||
}
|
||||
|
||||
static RGBA* get_at(State* L, uint x, uint y) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue