Break up display into pieces for fast updates

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2 3 years ago
parent 9262cb7253
commit 67fd650384
  1. BIN
      bin/screenshot.jpg
  2. BIN
      bin/screenshot_out.jpg
  3. BIN
      bin/screenshot_part.jpg
  4. 13
      src/sig/SigShare.java

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 KiB

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

@ -114,9 +114,6 @@ public class SigShare {
} else } else
if (currentPixel!=newPixel) { if (currentPixel!=newPixel) {
img[y*newCapture.getWidth()+x]=newPixel; img[y*newCapture.getWidth()+x]=newPixel;
if (gridY*REGION_X_COUNT+gridX>=changes.length) {
System.out.println(gridY+"/"+REGION_X_COUNT+"/"+gridX+" "+x+","+y);
}
//System.out.println("Changes ("+gridX+","+gridY+"): "+changes[gridY*REGION_X_COUNT+gridX]); //System.out.println("Changes ("+gridX+","+gridY+"): "+changes[gridY*REGION_X_COUNT+gridX]);
if (!REGION_CHECK.containsKey((char)(gridY*REGION_X_COUNT+gridX))) { if (!REGION_CHECK.containsKey((char)(gridY*REGION_X_COUNT+gridX))) {
changes[gridY*REGION_X_COUNT+gridX]+=2; changes[gridY*REGION_X_COUNT+gridX]+=2;
@ -258,8 +255,8 @@ public class SigShare {
yy++; yy++;
} }
} }
System.out.println("Region ("+(regionInfo%REGION_X_COUNT)+","+(regionInfo/REGION_X_COUNT)+") updated."); //System.out.println("Region ("+(regionInfo%REGION_X_COUNT)+","+(regionInfo/REGION_X_COUNT)+") updated.");
System.out.println("Waiting for region data..."); //System.out.println("Waiting for region data...");
regionInfo=-1; regionInfo=-1;
out.writeChars("Done\r\n"); out.writeChars("Done\r\n");
stream=new BufferedOutputStream(new FileOutputStream(new File("screenshot_out.jpg"),false)); stream=new BufferedOutputStream(new FileOutputStream(new File("screenshot_out.jpg"),false));
@ -283,7 +280,7 @@ public class SigShare {
FileInputStream stream; FileInputStream stream;
changes[gridY*REGION_X_COUNT+gridX]=0; changes[gridY*REGION_X_COUNT+gridX]=0;
GetSubimage(newCapture, gridX*REGION_WIDTH, gridY*REGION_HEIGHT, REGION_WIDTH, REGION_HEIGHT); GetSubimage(newCapture, gridX*REGION_WIDTH, gridY*REGION_HEIGHT, REGION_WIDTH, REGION_HEIGHT);
System.out.println("Preparing to send region("+gridX+","+gridY+")."); //System.out.println("Preparing to send region("+gridX+","+gridY+").");
stream = new FileInputStream(new File("screenshot_part.jpg")); stream = new FileInputStream(new File("screenshot_part.jpg"));
clientOutput.writeByte(gridY*REGION_X_COUNT+gridX); clientOutput.writeByte(gridY*REGION_X_COUNT+gridX);
while (stream.available()>0) { while (stream.available()>0) {
@ -293,10 +290,10 @@ public class SigShare {
for (int i=0;i<10;i++) { for (int i=0;i<10;i++) {
clientOutput.writeChar('-'); clientOutput.writeChar('-');
} }
System.out.println("Region sent, waiting for reply."); //System.out.println("Region sent, waiting for reply.");
while (!in.ready()); while (!in.ready());
in.readLine(); in.readLine();
System.out.println("Client no longer idle."); //System.out.println("Client no longer idle.");
REGION_CHECK.put((char)(gridY*REGION_X_COUNT+gridX),true); REGION_CHECK.put((char)(gridY*REGION_X_COUNT+gridX),true);
/*x=(x/REGION_WIDTH)*REGION_WIDTH+REGION_WIDTH; /*x=(x/REGION_WIDTH)*REGION_WIDTH+REGION_WIDTH;
y=(y/REGION_HEIGHT)*REGION_HEIGHT+REGION_HEIGHT;*/ y=(y/REGION_HEIGHT)*REGION_HEIGHT+REGION_HEIGHT;*/

Loading…
Cancel
Save