Looks like a software issue.
Try a clean install of Leopard if nothing else works.
That looks like a bad video driver.
The data is all there; it's just rendered wrong.
I believe if you get some compressed air, turn the fans on to maximum and spray the air through the bottom you can clean out the fans a bit. You'll need smcfancontrol to turn up the fans temporarily.
I reinstalled OS 10.5 on a clean HD and the problem is still there. However, when I start the computer in safe mode it works fine. Does anyone know what could make this happen?
If you read to the top of this thread I suggested that the OP might have had a hardware failure (specifically a bad GPU or logic board) since those symptoms are exactly what I experienced about a year ago on my 20" Core Duo iMac. I was able to boot in safe mode and strangely, had no problems running Windows whatsoever in Boot Camp. But in OS X it was artifact city and eventually the machine just locked up period.
To the users having these problems:
Your graphics cards are faulty and need replacing. My 20 inch iMac with Radeon X1600 is also displays artifacts, in both OS X and Windows and Boot Camp. Best send it back to Apple before your warranty runs out.
It is not a software or driver issue. It won't fix itself.
If you have Windows installed in Boot Camp, see if you can see the same problem there. That will prove beyond doubt a hardware malfunction, and will probably hurry along Apple's tech support (i.e. they won't waste time searching for anything in OS X.)
Not necessarily the case. On my 20" Core Duo white iMac (Radeon x1600) with the bad logic board even after OS X failed to even boot up anymore I was able to boot into Boot Camp and Vista ran smooth as silk, even in 3D games/apps. I'm not entirely sure why.