modules/javafx.graphics/src/main/java/com/sun/prism/sw/SWContext.java

Print this page




 310                 if ((w <= 0) || (h <= 0)) {
 311                     return;
 312                 }
 313                 alphaConsumer.initConsumer(outpix_xmin, outpix_ymin, w, h, pr);
 314                 renderer.produceAlphas(alphaConsumer);
 315             } finally {
 316                 if (renderer != null) {
 317                     renderer.dispose();
 318                 }
 319                 // recycle the RendererContext instance
 320                 DMarlinRenderingEngine.returnRendererContext(rdrCtx);
 321             }
 322         }
 323 
 324         @Override
 325         public void dispose() { }
 326     }
 327 
 328     SWContext(ResourceFactory factory) {
 329         this.factory = factory;
 330         if (PrismSettings.useMarlinRasterizer) {
 331             if (PrismSettings.useMarlinRasterizerDP) {
 332                 this.shapeRenderer = new DMarlinShapeRenderer();
 333             } else {
 334                 this.shapeRenderer = new MarlinShapeRenderer();
 335             }
 336         } else if (PrismSettings.doNativePisces) {
 337             this.shapeRenderer = new NativeShapeRenderer();
 338         } else {
 339             this.shapeRenderer = new JavaShapeRenderer();











 340         }
 341     }
 342 
 343     void renderShape(PiscesRenderer pr, Shape shape, BasicStroke stroke, BaseTransform tr, Rectangle clip, boolean antialiasedShape) {
 344         this.shapeRenderer.renderShape(pr, shape, stroke, tr, clip, antialiasedShape);
 345     }
 346 
 347     private SWRTTexture initRBBuffer(int width, int height) {
 348         final SWRTTexture tex = (SWRTTexture)factory.createRTTexture(width, height, Texture.WrapMode.CLAMP_NOT_NEEDED);
 349         readBackBufferRef = new SoftReference<SWRTTexture>(tex);
 350         return tex;
 351     }
 352 
 353     private void disposeRBBuffer() {
 354         if (readBackBufferRef != null) {
 355             readBackBufferRef.clear();
 356             readBackBufferRef = null;
 357         }
 358     }
 359 




 310                 if ((w <= 0) || (h <= 0)) {
 311                     return;
 312                 }
 313                 alphaConsumer.initConsumer(outpix_xmin, outpix_ymin, w, h, pr);
 314                 renderer.produceAlphas(alphaConsumer);
 315             } finally {
 316                 if (renderer != null) {
 317                     renderer.dispose();
 318                 }
 319                 // recycle the RendererContext instance
 320                 DMarlinRenderingEngine.returnRendererContext(rdrCtx);
 321             }
 322         }
 323 
 324         @Override
 325         public void dispose() { }
 326     }
 327 
 328     SWContext(ResourceFactory factory) {
 329         this.factory = factory;
 330         switch (PrismSettings.rasterizerSpec) {
 331             case JavaPisces:







 332                 this.shapeRenderer = new JavaShapeRenderer();
 333                 break;
 334             case NativePisces:
 335                 this.shapeRenderer = new NativeShapeRenderer();
 336                 break;
 337             case FloatMarlin:
 338                 this.shapeRenderer = new MarlinShapeRenderer();
 339                 break;
 340             default:
 341             case DoubleMarlin:
 342                 this.shapeRenderer = new DMarlinShapeRenderer();
 343                 break;
 344         }
 345     }
 346 
 347     void renderShape(PiscesRenderer pr, Shape shape, BasicStroke stroke, BaseTransform tr, Rectangle clip, boolean antialiasedShape) {
 348         this.shapeRenderer.renderShape(pr, shape, stroke, tr, clip, antialiasedShape);
 349     }
 350 
 351     private SWRTTexture initRBBuffer(int width, int height) {
 352         final SWRTTexture tex = (SWRTTexture)factory.createRTTexture(width, height, Texture.WrapMode.CLAMP_NOT_NEEDED);
 353         readBackBufferRef = new SoftReference<SWRTTexture>(tex);
 354         return tex;
 355     }
 356 
 357     private void disposeRBBuffer() {
 358         if (readBackBufferRef != null) {
 359             readBackBufferRef.clear();
 360             readBackBufferRef = null;
 361         }
 362     }
 363