MCPcopy Create free account
hub / github.com/SpartanJ/eepp / copyImage

Method copyImage

src/eepp/graphics/image.cpp:1304–1326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1302}
1303
1304void Image::copyImage( Graphics::Image* image, const Uint32& x, const Uint32& y ) {
1305 if ( NULL != mPixels && NULL != image->getPixelsPtr() && mWidth >= x + image->getWidth() &&
1306 mHeight >= y + image->getHeight() ) {
1307 unsigned int dWidth = image->getWidth();
1308 unsigned int dHeight = image->getHeight();
1309
1310 if ( mChannels != image->getChannels() ) {
1311 for ( unsigned int ty = 0; ty < dHeight; ty++ ) {
1312 for ( unsigned int tx = 0; tx < dWidth; tx++ ) {
1313 setPixel( x + tx, y + ty, image->getPixel( tx, ty ) );
1314 }
1315 }
1316 } else {
1317 // Copy per row
1318 for ( unsigned int ty = 0; ty < dHeight; ty++ ) {
1319 Uint8* pDst = &mPixels[( x + ( ( ty + y ) * mWidth ) ) * mChannels];
1320 const Uint8* pSrc = &( ( image->getPixelsPtr() )[( ty * dWidth ) * mChannels] );
1321
1322 memcpy( pDst, pSrc, mChannels * dWidth );
1323 }
1324 }
1325 }
1326}
1327
1328void Image::resize( const Uint32& newWidth, const Uint32& newHeight, ResamplerFilter filter ) {
1329 if ( NULL != mPixels && ( mWidth != newWidth || mHeight != newHeight ) ) {

Callers 3

findGlyphRectMethod · 0.45
updateTextureAtlasMethod · 0.45
saveMethod · 0.45

Calls 5

getChannelsMethod · 0.80
getPixelMethod · 0.80
getPixelsPtrMethod · 0.45
getWidthMethod · 0.45
getHeightMethod · 0.45

Tested by

no test coverage detected