mirror of
				https://github.com/gnif/LookingGlass.git
				synced 2025-11-03 22:22:08 +00:00 
			
		
		
		
	[common] rects: simplify unaligned copy function
This commit is contained in:
		@@ -27,14 +27,16 @@
 | 
				
			|||||||
#include "common/framebuffer.h"
 | 
					#include "common/framebuffer.h"
 | 
				
			||||||
#include "common/types.h"
 | 
					#include "common/types.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
inline static void rectCopyUnaligned(uint8_t * dest, const uint8_t * src,
 | 
					inline static void rectCopyUnaligned(uint8_t * dst, const uint8_t * src,
 | 
				
			||||||
    int ystart, int yend, int dx, int dstPitch, int srcPitch, int width)
 | 
					    int ystart, int yend, int dx, int dstPitch, int srcPitch, int width)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  src += ystart * srcPitch + dx;
 | 
				
			||||||
 | 
					  dst += ystart * dstPitch + dx;
 | 
				
			||||||
  for (int i = ystart; i < yend; ++i)
 | 
					  for (int i = ystart; i < yend; ++i)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    unsigned int srcOffset = i * srcPitch + dx;
 | 
					    memcpy(dst, src, width);
 | 
				
			||||||
    unsigned int dstOffset = i * dstPitch + dx;
 | 
					    src += srcPitch;
 | 
				
			||||||
    memcpy(dest + dstOffset, src + srcOffset, width);
 | 
					    dst += dstPitch;
 | 
				
			||||||
 }
 | 
					 }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user