pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

Java pastebin - collaborative debugging tool View Help


Posted by Clemens Eisserer on Sat 3 Jan 09:55
report abuse | download | new post

  1. public static void main(String[] args) {
  2.         XRRenderQueue queue = new XRRenderQueue(false);
  3.         queue.socketTaken = true;
  4.  
  5.         while (true) {
  6.             long start = System.currentTimeMillis();
  7.             for (int i = 0; i < 1000000; i++) {
  8.                 // SunToolkit.awtLock();
  9.                 try {
  10.                     queue.XRenderRectangle((int) start, XRUtils.PictOpAdd, XRColor.FULL_ALPHA, i, i, i, i);
  11.                 } finally {
  12.                    //  SunToolkit.awtUnlock();
  13.                 }
  14.             }
  15.             long end = System.currentTimeMillis();
  16.             System.out.println("Took: " + (end - start));
  17.         }
  18.     }
  19.  
  20.  
  21. public  final void XRenderRectangle(int dst, byte op, XRColor color, int x, int y, int width, int height) {
  22.         prepareRequest(28);
  23.  
  24.         putRequestHeader(MAJOR_RENDER, FILL_RECTANGLES, 7);
  25.         buf.putByte(op);
  26.         buf.skip(3);
  27.         buf.putInt(dst);
  28.         color.writeToBuffer(buf);
  29.        
  30.         buf.putShort((short) x);
  31.         buf.putShort((short) (y));
  32.         buf.putShort((short) (width));
  33.         buf.putShort((short) (height));
  34.     }  
  35.  
  36.  public final RenderBuffer putByte(byte x) {
  37.         unsafe.putByte(curAddress, x);
  38.         curAddress += SIZEOF_BYTE;
  39.         return this;
  40.     }
  41.  
  42.     public final void prepareRequest(int opsize) {
  43.         if (buf.remaining() < opsize) {
  44.             flush(false);
  45.         }
  46.  
  47.         checkSocketAccess();
  48.         requestCount++;
  49.     }
  50.  
  51.     protected void checkSocketAccess() {
  52.         if (!socketTaken) {
  53.             flushThread.takeSocket();
  54.             socketTaken = true;
  55.         }
  56.     }
  57.  
  58.     public void flush(boolean sync) {
  59.         buf.clear();
  60.         requestCount = 0;
  61.     }
  62.  
  63.     public final void clear() {
  64.         curAddress = baseAddress;
  65.     }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post