< prev index next >

src/java.desktop/windows/classes/sun/java2d/d3d/D3DSurfaceData.java

Print this page




 762         if (D3DRenderQueue.isRenderQueueThread()) {
 763             if (!rq.tryLock()) {
 764                 // if we could not obtain the lock, repaint the area
 765                 // that was supposed to be swapped, and no-op this swap
 766                 final Component target = (Component)sd.getPeer().getTarget();
 767                 SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
 768                     public void run() {
 769                         target.repaint(x1, y1, x2, y2);
 770                     }
 771                 });
 772                 return;
 773             }
 774         } else {
 775             rq.lock();
 776         }
 777         try {
 778             RenderBuffer buf = rq.getBuffer();
 779             rq.ensureCapacityAndAlignment(28, 4);
 780             buf.putInt(SWAP_BUFFERS);
 781             buf.putLong(pData);
 782             buf.putInt(x1);
 783             buf.putInt(y1);
 784             buf.putInt(x2);
 785             buf.putInt(y2);









 786             rq.flushNow();
 787         } finally {
 788             rq.unlock();
 789         }
 790     }
 791 
 792     /**
 793      * Returns destination Image associated with this SurfaceData.
 794      */
 795     public Object getDestination() {
 796         return offscreenImage;
 797     }
 798 
 799     public Rectangle getBounds() {
 800         if (type == FLIP_BACKBUFFER || type == WINDOW) {
 801             double scaleX = getDefaultScaleX();
 802             double scaleY = getDefaultScaleY();
 803             Rectangle r = peer.getBounds();
 804             r.x = r.y = 0;
 805             r.width = (int) Math.ceil(r.width * scaleX);




 762         if (D3DRenderQueue.isRenderQueueThread()) {
 763             if (!rq.tryLock()) {
 764                 // if we could not obtain the lock, repaint the area
 765                 // that was supposed to be swapped, and no-op this swap
 766                 final Component target = (Component)sd.getPeer().getTarget();
 767                 SunToolkit.executeOnEventHandlerThread(target, new Runnable() {
 768                     public void run() {
 769                         target.repaint(x1, y1, x2, y2);
 770                     }
 771                 });
 772                 return;
 773             }
 774         } else {
 775             rq.lock();
 776         }
 777         try {
 778             RenderBuffer buf = rq.getBuffer();
 779             rq.ensureCapacityAndAlignment(28, 4);
 780             buf.putInt(SWAP_BUFFERS);
 781             buf.putLong(pData);
 782             
 783             double scaleX = sd.getDefaultScaleX();
 784             double scaleY = sd.getDefaultScaleY();
 785 
 786             int sx1 = (int) Math.floor(x1 * scaleX);
 787             int sy1 = (int) Math.floor(y1 * scaleY);
 788             int sx2 = (int) Math.ceil(x2 * scaleX);
 789             int sy2 = (int) Math.ceil(y2 * scaleY);
 790 
 791             buf.putInt(sx1);
 792             buf.putInt(sy1);
 793             buf.putInt(sx2);
 794             buf.putInt(sy2);            
 795             rq.flushNow();
 796         } finally {
 797             rq.unlock();
 798         }
 799     }
 800     
 801     /**
 802      * Returns destination Image associated with this SurfaceData.
 803      */
 804     public Object getDestination() {
 805         return offscreenImage;
 806     }
 807 
 808     public Rectangle getBounds() {
 809         if (type == FLIP_BACKBUFFER || type == WINDOW) {
 810             double scaleX = getDefaultScaleX();
 811             double scaleY = getDefaultScaleY();
 812             Rectangle r = peer.getBounds();
 813             r.x = r.y = 0;
 814             r.width = (int) Math.ceil(r.width * scaleX);


< prev index next >