Don't use DrawRect to clear an image, a pixel loop is an order of magnitude faster.
This commit is contained in:
parent
75c6fd047b
commit
a1584e0194
|
|
@ -2348,7 +2348,8 @@ Rectangle GetImageAlphaBorder(Image image, float threshold)
|
||||||
// Clear image background with given color
|
// Clear image background with given color
|
||||||
void ImageClearBackground(Image *dst, Color color)
|
void ImageClearBackground(Image *dst, Color color)
|
||||||
{
|
{
|
||||||
ImageDrawRectangle(dst, 0, 0, dst->width, dst->height, color);
|
for (int i = 0; i < dst->width * dst->height; ++i)
|
||||||
|
ImageDrawPixel(dst, i % dst->width, i / dst->height, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw pixel within an image
|
// Draw pixel within an image
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user