sun.java2d.loops.MaskFill Java Examples
The following examples show how to use
sun.java2d.loops.MaskFill.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OGLSurfaceData.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #2
Source File: OGLSurfaceData.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #3
Source File: D3DSurfaceData.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #4
Source File: D3DSurfaceData.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #5
Source File: OGLSurfaceData.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #6
Source File: OGLSurfaceData.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #7
Source File: D3DSurfaceData.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #8
Source File: OGLSurfaceData.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #9
Source File: D3DSurfaceData.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #10
Source File: OGLSurfaceData.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #11
Source File: OGLSurfaceData.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #12
Source File: D3DSurfaceData.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #13
Source File: D3DSurfaceData.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #14
Source File: OGLSurfaceData.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #15
Source File: D3DSurfaceData.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #16
Source File: D3DSurfaceData.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #17
Source File: D3DSurfaceData.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #18
Source File: OGLSurfaceData.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #19
Source File: D3DSurfaceData.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #20
Source File: OGLSurfaceData.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #21
Source File: OGLSurfaceData.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #22
Source File: D3DSurfaceData.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #23
Source File: OGLSurfaceData.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #24
Source File: OGLSurfaceData.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #25
Source File: OGLSurfaceData.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > SunGraphics2D.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!OGLPaints.isValid(sg2d) || !graphicsConfig.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #26
Source File: D3DSurfaceData.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #27
Source File: D3DSurfaceData.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override protected MaskFill getMaskFill(SunGraphics2D sg2d) { if (sg2d.paintState > sg2d.PAINT_ALPHACOLOR) { /* * We can only accelerate non-Color MaskFill operations if * all of the following conditions hold true: * - there is an implementation for the given paintState * - the current Paint can be accelerated for this destination * - multitexturing is available (since we need to modulate * the alpha mask texture with the paint texture) * * In all other cases, we return null, in which case the * validation code will choose a more general software-based loop. */ if (!D3DPaints.isValid(sg2d) || !graphicsDevice.isCapPresent(CAPS_MULTITEXTURE)) { return null; } } return super.getMaskFill(sg2d); }
Example #28
Source File: BufferedMaskFill.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public void MaskFill(SunGraphics2D sg2d, SurfaceData sData, Composite comp, final int x, final int y, final int w, final int h, final byte[] mask, final int maskoff, final int maskscan) { AlphaComposite acomp = (AlphaComposite)comp; if (acomp.getRule() != AlphaComposite.SRC_OVER) { comp = AlphaComposite.SrcOver; } rq.lock(); try { validateContext(sg2d, comp, BufferedContext.USE_MASK); // we adjust the mask length so that the mask ends on a // 4-byte boundary int maskBytesRequired; if (mask != null) { // we adjust the mask length so that the mask ends on a // 4-byte boundary maskBytesRequired = (mask.length + 3) & (~3); } else { // mask not needed maskBytesRequired = 0; } int totalBytesRequired = 32 + maskBytesRequired; RenderBuffer buf = rq.getBuffer(); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the mask rq.flushNow(); } buf.putInt(MASK_FILL); // enqueue parameters buf.putInt(x).putInt(y).putInt(w).putInt(h); buf.putInt(maskoff); buf.putInt(maskscan); buf.putInt(maskBytesRequired); if (mask != null) { // enqueue the mask int padding = maskBytesRequired - mask.length; buf.put(mask); if (padding != 0) { buf.position(buf.position() + padding); } } } else { // queue is too small to accommodate entire mask; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { maskFill(x, y, w, h, maskoff, maskscan, mask.length, mask); } }); } } finally { rq.unlock(); } }
Example #29
Source File: BufferedMaskFill.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void MaskFill(SunGraphics2D sg2d, SurfaceData sData, Composite comp, final int x, final int y, final int w, final int h, final byte[] mask, final int maskoff, final int maskscan) { AlphaComposite acomp = (AlphaComposite)comp; if (acomp.getRule() != AlphaComposite.SRC_OVER) { comp = AlphaComposite.SrcOver; } rq.lock(); try { validateContext(sg2d, comp, BufferedContext.USE_MASK); // we adjust the mask length so that the mask ends on a // 4-byte boundary int maskBytesRequired; if (mask != null) { // we adjust the mask length so that the mask ends on a // 4-byte boundary maskBytesRequired = (mask.length + 3) & (~3); } else { // mask not needed maskBytesRequired = 0; } int totalBytesRequired = 32 + maskBytesRequired; RenderBuffer buf = rq.getBuffer(); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the mask rq.flushNow(); } buf.putInt(MASK_FILL); // enqueue parameters buf.putInt(x).putInt(y).putInt(w).putInt(h); buf.putInt(maskoff); buf.putInt(maskscan); buf.putInt(maskBytesRequired); if (mask != null) { // enqueue the mask int padding = maskBytesRequired - mask.length; buf.put(mask); if (padding != 0) { buf.position(buf.position() + padding); } } } else { // queue is too small to accommodate entire mask; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { maskFill(x, y, w, h, maskoff, maskscan, mask.length, mask); } }); } } finally { rq.unlock(); } }
Example #30
Source File: BufferedMaskFill.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public void MaskFill(SunGraphics2D sg2d, SurfaceData sData, Composite comp, final int x, final int y, final int w, final int h, final byte[] mask, final int maskoff, final int maskscan) { AlphaComposite acomp = (AlphaComposite)comp; if (acomp.getRule() != AlphaComposite.SRC_OVER) { comp = AlphaComposite.SrcOver; } rq.lock(); try { validateContext(sg2d, comp, BufferedContext.USE_MASK); // we adjust the mask length so that the mask ends on a // 4-byte boundary int maskBytesRequired; if (mask != null) { // we adjust the mask length so that the mask ends on a // 4-byte boundary maskBytesRequired = (mask.length + 3) & (~3); } else { // mask not needed maskBytesRequired = 0; } int totalBytesRequired = 32 + maskBytesRequired; RenderBuffer buf = rq.getBuffer(); if (totalBytesRequired <= buf.capacity()) { if (totalBytesRequired > buf.remaining()) { // process the queue first and then enqueue the mask rq.flushNow(); } buf.putInt(MASK_FILL); // enqueue parameters buf.putInt(x).putInt(y).putInt(w).putInt(h); buf.putInt(maskoff); buf.putInt(maskscan); buf.putInt(maskBytesRequired); if (mask != null) { // enqueue the mask int padding = maskBytesRequired - mask.length; buf.put(mask); if (padding != 0) { buf.position(buf.position() + padding); } } } else { // queue is too small to accommodate entire mask; perform // the operation directly on the queue flushing thread rq.flushAndInvokeNow(new Runnable() { public void run() { maskFill(x, y, w, h, maskoff, maskscan, mask.length, mask); } }); } } finally { rq.unlock(); } }