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

Method setFramebuffer

java/com/tigervnc/rfb/CConnection.java:86–128  ·  view source on GitHub ↗
(ModifiablePixelBuffer fb)

Source from the content-addressed store, hash-verified

84 // anyone else. Call setFramebuffer again with NULL or a different
85 // PixelBuffer to delete the previous one.
86 public void setFramebuffer(ModifiablePixelBuffer fb)
87 {
88 decoder.flush();
89
90 if (fb != null) {
91 assert(fb.width() == server.width());
92 assert(fb.height() == server.height());
93 }
94
95 if ((framebuffer != null) && (fb != null)) {
96 Rect rect = new Rect();
97
98 Raster data;
99
100 byte[] black = new byte[4];
101
102 // Copy still valid area
103
104 rect.setXYWH(0, 0,
105 Math.min(fb.width(), framebuffer.width()),
106 Math.min(fb.height(), framebuffer.height()));
107 data = framebuffer.getBuffer(rect);
108 fb.imageRect(framebuffer.getPF(), rect, data);
109
110 // Black out any new areas
111
112 if (fb.width() > framebuffer.width()) {
113 rect.setXYWH(framebuffer.width(), 0,
114 fb.width() - framebuffer.width(),
115 fb.height());
116 fb.fillRect(rect, black);
117 }
118
119 if (fb.height() > framebuffer.height()) {
120 rect.setXYWH(0, framebuffer.height(),
121 fb.width(),
122 fb.height() - framebuffer.height());
123 fb.fillRect(rect, black);
124 }
125 }
126
127 framebuffer = fb;
128 }
129
130 // initialiseProtocol() should be called once the streams and security
131 // types are set. Subsequently, processMsg() should be called whenever

Callers 2

ViewportMethod · 0.45
resizeMethod · 0.45

Calls 8

setXYWHMethod · 0.95
flushMethod · 0.45
widthMethod · 0.45
heightMethod · 0.45
getBufferMethod · 0.45
imageRectMethod · 0.45
getPFMethod · 0.45
fillRectMethod · 0.45

Tested by

no test coverage detected