GRAPHICS: Just copy the buffer when it's the same pixel format.

This commit is contained in:
Giulio Camuffo 2012-01-25 18:05:25 +01:00
parent f927098b1e
commit cd1eadd190

View File

@ -136,6 +136,10 @@ public:
* @param otherPix The index of the source pixel in 'buf'.
*/
inline void setPixelAt(int thisPix, const PixelBuffer &buf, int otherPix) {
if (_format == buf._format) {
memcpy(getRawBuffer(thisPix), buf.getRawBuffer(otherPix), _format.bytesPerPixel);
return;
}
uint8 a, r, g, b;
buf.getARGBAt(otherPix, a, r, g, b);
setPixelAt(thisPix, a, r, g, b);