mirror of
https://github.com/raysan5/raylib.git
synced 2025-12-06 06:13:10 +00:00
Merge branch 'master' of https://github.com/raysan5/raylib
This commit is contained in:
commit
2453977d59
@ -1252,7 +1252,7 @@ void rlPushMatrix(void)
|
|||||||
RLGL.State.stackCounter++;
|
RLGL.State.stackCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pop lattest inserted matrix from RLGL.State.stack
|
// Pop latest inserted matrix from RLGL.State.stack
|
||||||
void rlPopMatrix(void)
|
void rlPopMatrix(void)
|
||||||
{
|
{
|
||||||
if (RLGL.State.stackCounter > 0)
|
if (RLGL.State.stackCounter > 0)
|
||||||
|
|||||||
@ -3341,11 +3341,14 @@ void ImageClearBackground(Image *dst, Color color)
|
|||||||
|
|
||||||
unsigned char *pSrcPixel = (unsigned char *)dst->data;
|
unsigned char *pSrcPixel = (unsigned char *)dst->data;
|
||||||
int bytesPerPixel = GetPixelDataSize(1, 1, dst->format);
|
int bytesPerPixel = GetPixelDataSize(1, 1, dst->format);
|
||||||
|
int totalPixels = dst->width * dst->height;
|
||||||
|
|
||||||
// Repeat the first pixel data throughout the image
|
// Repeat the first pixel data throughout the image,
|
||||||
for (int i = 1; i < dst->width*dst->height; i++)
|
// doubling the pixels copied on each iteration
|
||||||
|
for (int i = 1; i < totalPixels; i *= 2)
|
||||||
{
|
{
|
||||||
memcpy(pSrcPixel + i*bytesPerPixel, pSrcPixel, bytesPerPixel);
|
int pixelsToCopy = MIN(i, totalPixels - i);
|
||||||
|
memcpy(pSrcPixel + i * bytesPerPixel, pSrcPixel, pixelsToCopy * bytesPerPixel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3724,9 +3727,10 @@ void ImageDrawRectangleRec(Image *dst, Rectangle rec, Color color)
|
|||||||
unsigned char *pSrcPixel = (unsigned char *)dst->data + bytesOffset;
|
unsigned char *pSrcPixel = (unsigned char *)dst->data + bytesOffset;
|
||||||
|
|
||||||
// Repeat the first pixel data throughout the row
|
// Repeat the first pixel data throughout the row
|
||||||
for (int x = 1; x < (int)rec.width; x++)
|
for (int x = 1; x < (int)rec.width; x *= 2)
|
||||||
{
|
{
|
||||||
memcpy(pSrcPixel + x*bytesPerPixel, pSrcPixel, bytesPerPixel);
|
int pixelsToCopy = MIN(x, (int)rec.width - x);
|
||||||
|
memcpy(pSrcPixel + x*bytesPerPixel, pSrcPixel, pixelsToCopy * bytesPerPixel);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Repeat the first row data for all other rows
|
// Repeat the first row data for all other rows
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user