Fix incorrect cursor rendering at (0,0) position
This commit is contained in:
parent
36d8b66cae
commit
ce2736ed20
1 changed files with 3 additions and 3 deletions
|
|
@ -455,7 +455,7 @@ Java_com_gaurav_avnc_vnc_VncClient_nativeUploadCursor(JNIEnv *env, jobject thiz,
|
||||||
//Cursor can overflow outside the framebuffer if moved near the edges,
|
//Cursor can overflow outside the framebuffer if moved near the edges,
|
||||||
//but glTexSubImage2D() doesn't allow values outside target texture,
|
//but glTexSubImage2D() doesn't allow values outside target texture,
|
||||||
//so we need to only update the intersection of framebuffer & cursor.
|
//so we need to only update the intersection of framebuffer & cursor.
|
||||||
int32_t left = 0, top = 0, right = 0, bottom = 0;
|
int32_t left = -1, top = -1, right = -1, bottom = -1;
|
||||||
|
|
||||||
auto fb = (uint32_t *) client->frameBuffer;
|
auto fb = (uint32_t *) client->frameBuffer;
|
||||||
auto buffer = (uint32_t *) cursor->buffer;
|
auto buffer = (uint32_t *) cursor->buffer;
|
||||||
|
|
@ -479,7 +479,7 @@ Java_com_gaurav_avnc_vnc_VncClient_nativeUploadCursor(JNIEnv *env, jobject thiz,
|
||||||
else
|
else
|
||||||
scratch[z++] = fb[fbY * client->fbRealWidth + fbX];
|
scratch[z++] = fb[fbY * client->fbRealWidth + fbX];
|
||||||
|
|
||||||
if (left == 0 && top == 0) {
|
if (left == -1 && top == -1) {
|
||||||
left = fbX;
|
left = fbX;
|
||||||
top = fbY;
|
top = fbY;
|
||||||
}
|
}
|
||||||
|
|
@ -489,7 +489,7 @@ Java_com_gaurav_avnc_vnc_VncClient_nativeUploadCursor(JNIEnv *env, jobject thiz,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (right > left && bottom > top)
|
if (left >= 0 && top >= 0)
|
||||||
glTexSubImage2D(GL_TEXTURE_2D,
|
glTexSubImage2D(GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
left,
|
left,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue