< prev index next >

src/java.desktop/share/classes/sun/java2d/opengl/OGLSurfaceData.java

Print this page




 525             /*
 526              * We can only accelerate non-Color MaskFill operations if
 527              * all of the following conditions hold true:
 528              *   - there is an implementation for the given paintState
 529              *   - the current Paint can be accelerated for this destination
 530              *   - multitexturing is available (since we need to modulate
 531              *     the alpha mask texture with the paint texture)
 532              *
 533              * In all other cases, we return null, in which case the
 534              * validation code will choose a more general software-based loop.
 535              */
 536             if (!OGLPaints.isValid(sg2d) ||
 537                 !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE))
 538             {
 539                 return null;
 540             }
 541         }
 542         return super.getMaskFill(sg2d);
 543     }
 544 
 545     public boolean copyArea(SunGraphics2D sg2d,
 546                             int x, int y, int w, int h, int dx, int dy)
 547     {
 548         if (sg2d.transformState < SunGraphics2D.TRANSFORM_TRANSLATESCALE &&
 549             sg2d.compositeState < SunGraphics2D.COMP_XOR)
 550         {
 551             x += sg2d.transX;
 552             y += sg2d.transY;
 553 
 554             oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);
 555 
 556             return true;
 557         }
 558         return false;
 559     }
 560 
 561     public void flush() {
 562         invalidate();
 563         OGLRenderQueue rq = OGLRenderQueue.getInstance();
 564         rq.lock();
 565         try {
 566             // make sure we have a current context before
 567             // disposing the native resources (e.g. texture object)
 568             OGLContext.setScratchSurface(graphicsConfig);
 569 
 570             RenderBuffer buf = rq.getBuffer();
 571             rq.ensureCapacityAndAlignment(12, 4);
 572             buf.putInt(FLUSH_SURFACE);
 573             buf.putLong(getNativeOps());
 574 
 575             // this call is expected to complete synchronously, so flush now
 576             rq.flushNow();
 577         } finally {
 578             rq.unlock();
 579         }




 525             /*
 526              * We can only accelerate non-Color MaskFill operations if
 527              * all of the following conditions hold true:
 528              *   - there is an implementation for the given paintState
 529              *   - the current Paint can be accelerated for this destination
 530              *   - multitexturing is available (since we need to modulate
 531              *     the alpha mask texture with the paint texture)
 532              *
 533              * In all other cases, we return null, in which case the
 534              * validation code will choose a more general software-based loop.
 535              */
 536             if (!OGLPaints.isValid(sg2d) ||
 537                 !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE))
 538             {
 539                 return null;
 540             }
 541         }
 542         return super.getMaskFill(sg2d);
 543     }
 544 
 545     @Override
 546     public boolean copyArea(SunGraphics2D sg2d, int x, int y, int w, int h,
 547                             int dx, int dy) {
 548         final int state = sg2d.transformState;
 549         if (state > SunGraphics2D.TRANSFORM_TRANSLATESCALE
 550             || sg2d.compositeState >= SunGraphics2D.COMP_XOR) {
 551             return false;
 552         }

 553         oglRenderPipe.copyArea(sg2d, x, y, w, h, dx, dy);

 554         return true;
 555     }


 556 
 557     public void flush() {
 558         invalidate();
 559         OGLRenderQueue rq = OGLRenderQueue.getInstance();
 560         rq.lock();
 561         try {
 562             // make sure we have a current context before
 563             // disposing the native resources (e.g. texture object)
 564             OGLContext.setScratchSurface(graphicsConfig);
 565 
 566             RenderBuffer buf = rq.getBuffer();
 567             rq.ensureCapacityAndAlignment(12, 4);
 568             buf.putInt(FLUSH_SURFACE);
 569             buf.putLong(getNativeOps());
 570 
 571             // this call is expected to complete synchronously, so flush now
 572             rq.flushNow();
 573         } finally {
 574             rq.unlock();
 575         }


< prev index next >