#include "blowUp.h" #include void blowupOntoScreen( Uint32 *inImage, int inWidth, int inHeight, int inBlowFactor, SDL_Surface *inScreen ) { int newWidth = inBlowFactor * inWidth; int newHeight = inBlowFactor * inHeight; int yOffset = ( inScreen->h - newHeight ) / 2; int xOffset = ( inScreen->w - newWidth ) / 2; // pitch is in bytes // convert to width in pixels int scanlineWidth = inScreen->pitch / 4; Uint32 *pixels = (Uint32 *)( inScreen->pixels ); // looping across the smaller image, instead of across the larger screen, // was discovered using the profiler. // an entire screen row is repeated inBlowFactor times down the screen // (as a row of pixel boxes) // Thus, we can offload a lot more work onto memcpy if we assemble one // of these rows and then memcpy it onto the screen inBlowFactor times for( int y=0; y