MCPcopy Create free account
hub / github.com/TigerVNC/tigervnc / rasterFromBuffer

Method rasterFromBuffer

java/com/tigervnc/rfb/PixelFormat.java:616–638  ·  view source on GitHub ↗
(Rect r, ByteBuffer buf)

Source from the content-addressed store, hash-verified

614 }
615
616 public Raster rasterFromBuffer(Rect r, ByteBuffer buf)
617 {
618 Buffer dst;
619 DataBuffer db = null;
620
621 SampleModel sm =
622 model.createCompatibleSampleModel(r.width(), r.height());
623 switch (sm.getTransferType()) {
624 case DataBuffer.TYPE_INT:
625 dst = IntBuffer.allocate(r.area()).put(buf.asIntBuffer());
626 db = new DataBufferInt(((IntBuffer)dst).array(), r.area());
627 break;
628 case DataBuffer.TYPE_BYTE:
629 db = new DataBufferByte(buf.array(), r.area());
630 break;
631 case DataBuffer.TYPE_SHORT:
632 dst = ShortBuffer.allocate(r.area()).put(buf.asShortBuffer());
633 db = new DataBufferShort(((ShortBuffer)dst).array(), r.area());
634 break;
635 }
636 assert(db != null);
637 return Raster.createRaster(sm, db, new java.awt.Point(0, 0));
638 }
639
640 private static HashMap<Integer, ColorConvertOp> converters;
641

Callers 2

fillRectMethod · 0.80
imageRectMethod · 0.80

Calls 4

widthMethod · 0.45
heightMethod · 0.45
putMethod · 0.45
areaMethod · 0.45

Tested by

no test coverage detected