mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Use a generic slow path for ImageData:paste between formats when we don't already have a faster path for it, instead of erroring.
This commit is contained in:
@@ -710,6 +710,9 @@ void ImageData::paste(ImageData *src, int dx, int dy, int sx, int sy, int sw, in
|
||||
uint8 *s = (uint8 *) src->getData();
|
||||
uint8 *d = (uint8 *) getData();
|
||||
|
||||
auto getfunction = src->pixelGetFunction;
|
||||
auto setfunction = pixelSetFunction;
|
||||
|
||||
// If the dimensions match up, copy the entire memory stream in one go
|
||||
if (srcformat == dstformat && (sw == dstW && dstW == srcW && sh == dstH && dstH == srcH))
|
||||
{
|
||||
@@ -755,7 +758,17 @@ void ImageData::paste(ImageData *src, int dx, int dy, int sx, int sy, int sw, in
|
||||
pasteRGBA32FtoRGBA16F(rowsrc, rowdst, sw);
|
||||
|
||||
else
|
||||
throw love::Exception("Unsupported pixel format combination in ImageData:paste.");
|
||||
{
|
||||
// Slow path: convert src -> Colorf -> dst.
|
||||
Colorf c;
|
||||
for (int x = 0; x < sw; x++)
|
||||
{
|
||||
auto srcp = (const Pixel *) (rowsrc.u8 + x * srcpixelsize);
|
||||
auto dstp = (Pixel *) (rowdst.u8 + x * dstpixelsize);
|
||||
getfunction(srcp, c);
|
||||
setfunction(c, dstp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user