sprite rendering

First off, I don't understand how rendering works with

an image that is partially visible on screen. Let's say

for example, I have a sprite that is half off screen,

in my rendering method, when I say g2D.drawImage(sprite.getImage(), sprite.getX(), sprite.getY(), observer);

What exactly happens? Is time wasted trying to

draw the pixels that are not on the screen? Please ask

me to specify if any other information is needed. Thanks

in advance.

Here are the specs that may be useful:

- uses BuffereStrategy (3 buffers)

- undecorated 'Frame' at fullscreen exclusive mode (640 by 480)

[660 byte] By [afarmanda] at [2007-9-29 11:40:14]
# 1

I've often wondered this.

While testing a game I'm working on at the moment I was drawing about 10000 drawRect()'s to the screen per game loop, obviously this slowed the game down, *but*, when the drawRect()'s weren't onscreen (once I scrolled passed them) the game speed shot back up, so I'm guessing if it isn't drawing drawRect()'s that aren't visible maybe the same applies to images, although I'd further guess that the whole image has to be off screen before its not being drawn, unless java is doing something super cool with the raster (is that right?) that is.

Further, clarification on this from someone who isn't guessing would be nice :)

KarateMarca at 2007-7-15 1:12:06 > top of Java-index,Other Topics,Java Game Development...
# 2
I did the same thing, I had a many large flashing rectangles scroll down the screen, the speed of the scrolling sped up proportionally as more of the rectangles went off screen.
penguins404a at 2007-7-15 1:12:06 > top of Java-index,Other Topics,Java Game Development...
# 3

That's true even for images. When I have too many images on the screen, everything slows down (I think because BufferStrategy is synchronized). But Since I use one large image for the background (it scrolls as the character moves) I don't know if rendering of the image is done for the whole image or just what is showing. I'm guessing that java does a quick check to see where the viewable bounds are of the image and starts rendering there.

afarmanda at 2007-7-15 1:12:06 > top of Java-index,Other Topics,Java Game Development...