[rtextures] ImageDraw(): Don't try to blend images without alpha (#4395)
This commit is contained in:
parent
3dbbe60376
commit
51ff6586f4
1 changed files with 10 additions and 2 deletions
|
@ -3969,13 +3969,21 @@ void ImageDraw(Image *dst, Image src, Rectangle srcRec, Rectangle dstRec, Color
|
|||
// [-] GetPixelColor(): Get Vector4 instead of Color, easier for ColorAlphaBlend()
|
||||
// [ ] Support f32bit channels drawing
|
||||
|
||||
// TODO: Support PIXELFORMAT_UNCOMPRESSED_R32, PIXELFORMAT_UNCOMPRESSED_R32G32B32, PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 and 16-bit equivalents
|
||||
// TODO: Support PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 and PIXELFORMAT_UNCOMPRESSED_R1616B16A16
|
||||
|
||||
Color colSrc, colDst, blend;
|
||||
bool blendRequired = true;
|
||||
|
||||
// Fast path: Avoid blend if source has no alpha to blend
|
||||
if ((tint.a == 255) && ((srcPtr->format == PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) || (srcPtr->format == PIXELFORMAT_UNCOMPRESSED_R8G8B8) || (srcPtr->format == PIXELFORMAT_UNCOMPRESSED_R5G6B5))) blendRequired = false;
|
||||
if ((tint.a == 255) &&
|
||||
((srcPtr->format == PIXELFORMAT_UNCOMPRESSED_GRAYSCALE) ||
|
||||
(srcPtr->format == PIXELFORMAT_UNCOMPRESSED_R5G6B5) ||
|
||||
(srcPtr->format == PIXELFORMAT_UNCOMPRESSED_R8G8B8) ||
|
||||
(srcPtr->format == PIXELFORMAT_UNCOMPRESSED_R32) ||
|
||||
(srcPtr->format == PIXELFORMAT_UNCOMPRESSED_R32G32B32) ||
|
||||
(srcPtr->format == PIXELFORMAT_UNCOMPRESSED_R16) ||
|
||||
(srcPtr->format == PIXELFORMAT_UNCOMPRESSED_R16G16B16)))
|
||||
blendRequired = false;
|
||||
|
||||
int strideDst = GetPixelDataSize(dst->width, 1, dst->format);
|
||||
int bytesPerPixelDst = strideDst/(dst->width);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue