 |
 |
Java2D
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
Does anyone know what Apple did to fix up the Java2D Demo? (/Developer/Examples/Java/JFC/Java2D/Java2D.app). Running that even on my G3/300 gives impressive frame rates (~27fps), etc, and yet my own app which calls Graphics.drawImage(image, 0, 0, component) takes over 800ms just to draw a single 200x200 image?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
Word to the wise - NEVER use BufferedImage.TYPE_4BYTE_ABGR! I don't remember why I chose this, but removing it boosted draw from 800ms to about 15ms. I replaced it with BufferedImage.TYPE_INT_ARGB.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: May 2001
Location: Up north
Status:
Offline
|
|
This is just a guess, but I think TYPE_4BYTE_ABGR is using 4 bytes of mem per pixel, and TYPE_INT_ARGB is just using 2. So then there is less stuff to copy, and I find that odd exponenetial speed increases occur when you switch from copying big portions of memory to smaller ones, in this case not the expected 2x increase in speed. Why, hmmm, pixie dust?
Perhaps TYPE_INT_ARGB is faster cus apple has there code optimized better for it.
Anyways, I would be interested to know if my suspicions about 2 bytes vs 4 byte memory copying are right... and if I am wrong even better, cus then I will know something more.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
Originally posted by 11011001:
<STRONG>Anyways, I would be interested to know if my suspicions about 2 bytes vs 4 byte memory copying are right... and if I am wrong even better, cus then I will know something more.</STRONG>
I looked at the source code, and it looks like the biggest difference is that the TYPE_INT_ARGB uses a DirectColorModel and the TYPE_4BYTE_ABGR uses a ComponentColorModel. I have read in other places that there is a specific ColorModel that Java2D on OS X works best with, but I don't remember specifics.
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status:
Offline
|
|
Originally posted by 11011001:
Do you prefer to be called 217 or -39?
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|