Skip to content

Commit

Permalink
修复[桥接配置]: 修复配置2闪屏问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Vera-Firefly committed Nov 14, 2024
1 parent 8b70447 commit 6063a63
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions app_pojavlauncher/src/main/jni/ctxbridges/osm_bridge_xxx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

ANativeWindow_Buffer buf;
int32_t stride;

static bool hasCleaned = false;
void *abuffer;

void *xxx2OsmGetCurrentContext() {
Expand All @@ -32,15 +34,19 @@ void xxx2OsmSwapBuffers() {
if (ctx == NULL)
printf("Zink: attempted to swap buffers without context!");

OSMesaMakeCurrent_p(ctx,buf.bits,GL_UNSIGNED_BYTE,pojav_environ->savedWidth,pojav_environ->savedHeight);
ANativeWindow_lock(pojav_environ->pojavWindow, &buf, NULL);
OSMesaMakeCurrent_p(ctx, buf.bits, GL_UNSIGNED_BYTE, pojav_environ->savedWidth, pojav_environ->savedHeight);
glFinish_p();

if (buf.stride != stride)
OSMesaPixelStore_p(OSMESA_ROW_LENGTH, buf.stride);
stride = buf.stride;

ANativeWindow_unlockAndPost(pojav_environ->pojavWindow);
ANativeWindow_lock(pojav_environ->pojavWindow,&buf,NULL);
}

void xxx2OsmMakeCurrent(void *window) {
printf("OSMDroid: making current\n");

if (SpareBuffer())
{
#ifdef FRAME_BUFFER_SUPPOST
Expand All @@ -58,16 +64,22 @@ void xxx2OsmMakeCurrent(void *window) {
pojav_environ->savedWidth,
pojav_environ->savedHeight);

ANativeWindow_lock(pojav_environ->pojavWindow,&buf,NULL);
OSMesaPixelStore_p(OSMESA_ROW_LENGTH,buf.stride);
OSMesaPixelStore_p(OSMESA_Y_UP, 0);
if (!hasCleaned) ANativeWindow_lock(pojav_environ->pojavWindow, &buf, NULL);

if (buf.stride != stride)
OSMesaPixelStore_p(OSMESA_ROW_LENGTH, buf.stride);
stride = buf.stride;
OSMesaPixelStore_p(OSMESA_Y_UP,0);

printf("OSMDroid: vendor: %s\n",glGetString_p(GL_VENDOR));
printf("OSMDroid: renderer: %s\n",glGetString_p(GL_RENDERER));
glClear_p(GL_COLOR_BUFFER_BIT);
glClearColor_p(0.4f, 0.4f, 0.4f, 1.0f);
xxx2OsmSwapBuffers();
printf("OSMDroid: vendor: %s\n", glGetString_p(GL_VENDOR));
printf("OSMDroid: renderer: %s\n", glGetString_p(GL_RENDERER));
if (!hasCleaned)
{
hasCleaned = true;
glClear_p(GL_COLOR_BUFFER_BIT);
glClearColor_p(0.4f, 0.4f, 0.4f, 1.0f);
ANativeWindow_unlockAndPost(pojav_environ->pojavWindow);
}
}

void *xxx2OsmCreateContext(void *contextSrc) {
Expand Down

0 comments on commit 6063a63

Please sign in to comment.