Im new to C so excuse my ignorance if this is easy. I have looked around for solutions to no avail. Also, this is in the scope of a very large program, so I will try to include only necessary code.
Here is my function:
void drawImage3(int x, int y, int width, int height, const u16* image)
{
int w;
for (w=0; r<width; w++)
{
image;
DMA[3].src = image;
DMA[3].dst = &videoBuffer[OFFSET(x+width, y, 240)];
DMA[3].cnt = width | DMA_SOURCE_FIXED| DMA_ON | DMA_DESTINATION_INCREMENT;
}
}
These are defined elsewhere:
extern unsigned short *videoBuffer;
const unsigned short *pt;
And image is the name of an array of shorts. It has 1024 elements. I know this code has a lot of things going on with DMA and such but the basic SYNTATICAL question开发者_StackOverflow中文版 is this:
On the first iteration I want
to draw image[0]
, then image[width]
, then image[2*width]
, then image[3*width]
, etc... How can I change this code so on each for loop cycle, I get those elements?
On the first iteration I want to draw image[0], then image[width], then image[2*width] then image[3*width], etc...
for (unsigned i=0; i<N; i++)
draw(image[i*width]);
精彩评论