Force full refresh when enough time passed

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2 3 years ago
parent 3e77931193
commit e8da7b0139
  1. BIN
      bin/SigShare.jar
  2. 8
      src/sig/SigShare.java

Binary file not shown.

@ -124,6 +124,7 @@ public class SigShare {
in.readLine(); in.readLine();
LAST_CLEANUP=System.currentTimeMillis(); LAST_CLEANUP=System.currentTimeMillis();
} else { } else {
subupdate:
for (int y=0;y<newCapture.getHeight();y++) { for (int y=0;y<newCapture.getHeight();y++) {
for (int x=0;x<newCapture.getWidth();x++) { for (int x=0;x<newCapture.getWidth();x++) {
int currentPixel = img[y*newCapture.getWidth()+x]; int currentPixel = img[y*newCapture.getWidth()+x];
@ -131,6 +132,9 @@ public class SigShare {
int gridX = x/REGION_WIDTH; int gridX = x/REGION_WIDTH;
int gridY = y/REGION_HEIGHT; int gridY = y/REGION_HEIGHT;
if (currentPixel!=newPixel) { if (currentPixel!=newPixel) {
if (System.currentTimeMillis()-LAST_CLEANUP>=CLEANUP_FREQUENCY) {
break subupdate;
}
img[y*newCapture.getWidth()+x]=newPixel; img[y*newCapture.getWidth()+x]=newPixel;
//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))) {
@ -144,7 +148,7 @@ public class SigShare {
if (gridX>0) { if (gridX>0) {
changes[(gridY)*REGION_X_COUNT+(gridX-1)]+=1; changes[(gridY)*REGION_X_COUNT+(gridX-1)]+=1;
} }
if (gridX<REGION_Y_COUNT-1) { if (gridX<REGION_X_COUNT-1) {
changes[(gridY)*REGION_X_COUNT+(gridX+1)]+=1; changes[(gridY)*REGION_X_COUNT+(gridX+1)]+=1;
} }
if (changes[gridY*REGION_X_COUNT+gridX]>=CHANGE_THRESHOLD) { if (changes[gridY*REGION_X_COUNT+gridX]>=CHANGE_THRESHOLD) {
@ -157,7 +161,7 @@ public class SigShare {
if (gridX>0) { if (gridX>0) {
changes[(gridY)*REGION_X_COUNT+(gridX-1)]+=CHANGE_THRESHOLD/2; changes[(gridY)*REGION_X_COUNT+(gridX-1)]+=CHANGE_THRESHOLD/2;
} }
if (gridX<REGION_Y_COUNT-1) { if (gridX<REGION_X_COUNT-1) {
changes[(gridY)*REGION_X_COUNT+(gridX+1)]+=CHANGE_THRESHOLD/2; changes[(gridY)*REGION_X_COUNT+(gridX+1)]+=CHANGE_THRESHOLD/2;
} }
performSubimageUpdate(in, clientOutput, newCapture, gridX, gridY); performSubimageUpdate(in, clientOutput, newCapture, gridX, gridY);

Loading…
Cancel
Save