< prev index next >

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

Print this page




 686              * We can only accelerate non-Color MaskFill operations if
 687              * all of the following conditions hold true:
 688              *   - there is an implementation for the given paintState
 689              *   - the current Paint can be accelerated for this destination
 690              *   - multitexturing is available (since we need to modulate
 691              *     the alpha mask texture with the paint texture)
 692              *
 693              * In all other cases, we return null, in which case the
 694              * validation code will choose a more general software-based loop.
 695              */
 696             if (!D3DPaints.isValid(sg2d) ||
 697                 !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE))
 698             {
 699                 return null;
 700             }
 701         }
 702         return super.getMaskFill(sg2d);
 703     }
 704 
 705     @Override
 706     public boolean copyArea(SunGraphics2D sg2d,
 707                             int x, int y, int w, int h, int dx, int dy)
 708     {
 709         if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
 710             sg2d.compositeState < SunGraphics2D.COMP_XOR)
 711         {


 712             x += sg2d.transX;
 713             y += sg2d.transY;
 714 









 715             d3dRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
 716 
 717             return true;
 718         }
 719         return false;
 720     }
 721 
 722     @Override
 723     public void flush() {
 724         D3DRenderQueue rq = D3DRenderQueue.getInstance();
 725         rq.lock();
 726         try {
 727             RenderBuffer buf = rq.getBuffer();
 728             rq.ensureCapacityAndAlignment(12, 4);
 729             buf.putInt(FLUSH_SURFACE);
 730             buf.putLong(getNativeOps());
 731 
 732             // this call is expected to complete synchronously, so flush now
 733             rq.flushNow();
 734         } finally {
 735             rq.unlock();
 736         }
 737     }
 738 
 739     /**




 686              * We can only accelerate non-Color MaskFill operations if
 687              * all of the following conditions hold true:
 688              *   - there is an implementation for the given paintState
 689              *   - the current Paint can be accelerated for this destination
 690              *   - multitexturing is available (since we need to modulate
 691              *     the alpha mask texture with the paint texture)
 692              *
 693              * In all other cases, we return null, in which case the
 694              * validation code will choose a more general software-based loop.
 695              */
 696             if (!D3DPaints.isValid(sg2d) ||
 697                 !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE))
 698             {
 699                 return null;
 700             }
 701         }
 702         return super.getMaskFill(sg2d);
 703     }
 704 
 705     @Override
 706     public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
 707                             int dx, int dy) {
 708         final int state = sg2d.transformState;
 709         if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
 710             || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
 711             return false;
 712         }
 713         if (state <= SunGraphics2D.TRANSFORM_ANY_TRANSLATE) {
 714             x += sg2d.transX;
 715             y += sg2d.transY;
 716         } else if (state == SunGraphics2D.TRANSFORM_TRANSLATESCALE) {
 717             final double[] coords = {x, y, x + w, y + h, x + dx, y + dy};
 718             sg2d.transform.transform(coords, 0, coords, 0, 3);
 719             x = (int) Math.ceil(coords[0] - 0.5);
 720             y = (int) Math.ceil(coords[1] - 0.5);
 721             w = ((int) Math.ceil(coords[2] - 0.5)) - x;
 722             h = ((int) Math.ceil(coords[3] - 0.5)) - y;
 723             dx = ((int) Math.ceil(coords[4] - 0.5)) - x;
 724             dy = ((int) Math.ceil(coords[5] - 0.5)) - y;
 725         }
 726         d3dRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);

 727         return true;


 728     }
 729 
 730     @Override
 731     public void flush() {
 732         D3DRenderQueue rq = D3DRenderQueue.getInstance();
 733         rq.lock();
 734         try {
 735             RenderBuffer buf = rq.getBuffer();
 736             rq.ensureCapacityAndAlignment(12, 4);
 737             buf.putInt(FLUSH_SURFACE);
 738             buf.putLong(getNativeOps());
 739 
 740             // this call is expected to complete synchronously, so flush now
 741             rq.flushNow();
 742         } finally {
 743             rq.unlock();
 744         }
 745     }
 746 
 747     /**


< prev index next >