mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
graphics: move buffer:clear error checking to high level code
This commit is contained in:
@@ -222,17 +222,8 @@ bool Buffer::fill(size_t offset, size_t size, const void *data)
|
||||
return true;
|
||||
}}
|
||||
|
||||
void Buffer::clear(size_t offset, size_t size)
|
||||
void Buffer::clearInternal(size_t offset, size_t size)
|
||||
{ @autoreleasepool {
|
||||
if (isImmutable())
|
||||
throw love::Exception("Cannot clear an immutable Buffer.");
|
||||
else if (isMapped())
|
||||
throw love::Exception("Cannot clear a mapped Buffer.");
|
||||
else if (offset + size > getSize())
|
||||
throw love::Exception("The given offset and size parameters to clear() are not within the Buffer's size.");
|
||||
else if (offset % 4 != 0 || size % 4 != 0)
|
||||
throw love::Exception("clear() must be used with offset and size parameters that are multiples of 4 bytes.");
|
||||
|
||||
auto gfx = Graphics::getInstance();
|
||||
auto encoder = gfx->useBlitEncoder();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user