Forráskód Böngészése

Merge pull request #2152 from Rosuav/fix-cursor-position

libobs: Fix cursor draw position bug when cropping a window capture.
Jim 5 éve
szülő
commit
cc3c70ba00

+ 2 - 1
plugins/linux-capture/xcompcap-main.cpp

@@ -664,7 +664,8 @@ void XCompcapMain::render(gs_effect_t *effect)
 		effect = obs_get_base_effect(OBS_EFFECT_DEFAULT);
 
 		while (gs_effect_loop(effect, "Draw")) {
-			xcursor_render(p->cursor);
+			xcursor_render(p->cursor, -p->cur_cut_left,
+				       -p->cur_cut_top);
 		}
 	}
 }

+ 3 - 2
plugins/linux-capture/xcursor.c

@@ -103,7 +103,7 @@ void xcursor_tick(xcursor_t *data)
 	XFree(xc);
 }
 
-void xcursor_render(xcursor_t *data)
+void xcursor_render(xcursor_t *data, int x_offset, int y_offset)
 {
 	if (!data->tex)
 		return;
@@ -117,7 +117,8 @@ void xcursor_render(xcursor_t *data)
 	gs_enable_color(true, true, true, false);
 
 	gs_matrix_push();
-	gs_matrix_translate3f(data->render_x, data->render_y, 0.0f);
+	gs_matrix_translate3f(data->render_x + x_offset,
+			      data->render_y + y_offset, 0.0f);
 	gs_draw_sprite(data->tex, 0, 0, 0);
 	gs_matrix_pop();
 

+ 1 - 1
plugins/linux-capture/xcursor.h

@@ -61,7 +61,7 @@ void xcursor_tick(xcursor_t *data);
  *
  * This needs to be executed within a valid render context
  */
-void xcursor_render(xcursor_t *data);
+void xcursor_render(xcursor_t *data, int x_offset, int y_offset);
 
 /**
  * Specify offset for the cursor