/** * Enqueues a BLIT operation with the given parameters. Note that the * RenderQueue lock must be held before calling this method. */ private static void enqueueBlit(RenderQueue rq, SurfaceData src, SurfaceData dst, int packedParams, int sx1, int sy1, int sx2, int sy2, double dx1, double dy1, double dx2, double dy2) { // assert rq.lock.isHeldByCurrentThread(); RenderBuffer buf = rq.getBuffer(); rq.ensureCapacityAndAlignment(72, 24); buf.putInt(BLIT); buf.putInt(packedParams); buf.putInt(sx1).putInt(sy1); buf.putInt(sx2).putInt(sy2); buf.putDouble(dx1).putDouble(dy1); buf.putDouble(dx2).putDouble(dy2); buf.putLong(src.getNativeOps()); buf.putLong(dst.getNativeOps()); }
private static void testContext(final AccelGraphicsConfig agc) { BufferedContext c = agc.getContext(); final AccelDeviceEventListener l = new AccelDeviceEventListener() { public void onDeviceDispose() { System.out.println("onDeviceDispose invoked"); agc.removeDeviceEventListener(this); } public void onDeviceReset() { System.out.println("onDeviceReset invoked"); } }; agc.addDeviceEventListener(l); RenderQueue rq = c.getRenderQueue(); rq.lock(); try { c.saveState(); rq.flushNow(); c.restoreState(); rq.flushNow(); System.out.println("Passed: Save/Restore"); } finally { rq.unlock(); } }
@Override protected boolean update(Image bb) { if (bb instanceof DestSurfaceProvider) { Surface s = ((DestSurfaceProvider)bb).getDestSurface(); if (s instanceof AccelSurface) { final int w = bb.getWidth(null); final int h = bb.getHeight(null); final boolean arr[] = { false }; final AccelSurface as = (AccelSurface)s; RenderQueue rq = as.getContext().getRenderQueue(); rq.lock(); try { BufferedContext.validateContext(as); rq.flushAndInvokeNow(new Runnable() { @Override public void run() { long psdops = as.getNativeOps(); arr[0] = updateWindowAccel(psdops, w, h); } }); } catch (InvalidPipeException e) { // ignore, false will be returned } finally { rq.unlock(); } return arr[0]; } } return super.update(bb); }