net.ctdp.rfdynhud.render
Class TextureDirtyRectsManager

java.lang.Object
  extended by net.ctdp.rfdynhud.render.TextureDirtyRectsManager

public class TextureDirtyRectsManager
extends java.lang.Object

This class provides a public interface to retrieve the current dirty rectangles.

Author:
Marvin Froehlich (CTDP)

Constructor Summary
TextureDirtyRectsManager()
           
 
Method Summary
static java.nio.ByteBuffer createByteBuffer(int maxNumDirtyRects)
           
static void drawDirtyRects(TextureImage2D texture)
          This is just for debugging!
static short getDirtyRects(TextureImage2D texture, java.nio.ByteBuffer buffer, boolean resetBufferToStart)
          Gets all the current dirty-rects from the given texture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextureDirtyRectsManager

public TextureDirtyRectsManager()
Method Detail

createByteBuffer

public static java.nio.ByteBuffer createByteBuffer(int maxNumDirtyRects)

getDirtyRects

public static short getDirtyRects(TextureImage2D texture,
                                  java.nio.ByteBuffer buffer,
                                  boolean resetBufferToStart)
Gets all the current dirty-rects from the given texture.
The number of dirty rectangles is written as a short to the first two bytes of the buffer.
Then each rectangle is written as four shorts in the order left,top,width,height.
After this method finished all dirty rectangles information will be removed from the texture.

Parameters:
texture - the texture to handle dirty rectangles of
buffer - the buffer to write the information to
resetBufferToStart - if true, the buffer is set to position zero before anything is written to it
Returns:
the number of dirty rectangles. If the buffer iss too small the number is returned as a negative number.

drawDirtyRects

public static void drawDirtyRects(TextureImage2D texture)
This is just for debugging!

Parameters:
texture - the take dirty rects from and to draw on