mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
Fix gs_matrix_* issues
Multiplication of the matricies was being done in the wrong direction. This caused source transformations to come out looking incorrect, for example the linux-xshm source's cursor would not be drawn correctly or in the right position if the source was moved/scaled/rotated. The problem just turned out to be that the gs_matrix_* functions were multiplying in the wrong direction. Reverse the direction of multiplication, and the problem is solved.
This commit is contained in:
@@ -682,6 +682,7 @@ static void DrawCircleAtPos(float x, float y, matrix4 &matrix,
|
||||
|
||||
gs_matrix_push();
|
||||
gs_matrix_translate(&pos);
|
||||
gs_matrix_scale3f(HANDLE_RADIUS, HANDLE_RADIUS, 1.0f);
|
||||
gs_draw(GS_LINESTRIP, 0, 0);
|
||||
gs_matrix_pop();
|
||||
}
|
||||
@@ -699,8 +700,6 @@ bool OBSBasicPreview::DrawSelectedItem(obs_scene_t scene, obs_sceneitem_t item,
|
||||
matrix4 boxTransform;
|
||||
obs_sceneitem_get_box_transform(item, &boxTransform);
|
||||
|
||||
gs_matrix_push();
|
||||
gs_matrix_scale3f(HANDLE_RADIUS, HANDLE_RADIUS, 1.0f);
|
||||
DrawCircleAtPos(0.0f, 0.0f, boxTransform, main->previewScale);
|
||||
DrawCircleAtPos(0.0f, 1.0f, boxTransform, main->previewScale);
|
||||
DrawCircleAtPos(1.0f, 0.0f, boxTransform, main->previewScale);
|
||||
@@ -709,13 +708,12 @@ bool OBSBasicPreview::DrawSelectedItem(obs_scene_t scene, obs_sceneitem_t item,
|
||||
DrawCircleAtPos(0.0f, 0.5f, boxTransform, main->previewScale);
|
||||
DrawCircleAtPos(0.5f, 1.0f, boxTransform, main->previewScale);
|
||||
DrawCircleAtPos(1.0f, 0.5f, boxTransform, main->previewScale);
|
||||
gs_matrix_pop();
|
||||
|
||||
gs_load_vertexbuffer(main->box);
|
||||
|
||||
gs_matrix_push();
|
||||
gs_matrix_set(&boxTransform);
|
||||
gs_matrix_scale3f(main->previewScale, main->previewScale, 1.0f);
|
||||
gs_matrix_mul(&boxTransform);
|
||||
gs_draw(GS_LINESTRIP, 0, 0);
|
||||
|
||||
gs_matrix_pop();
|
||||
|
||||
Reference in New Issue
Block a user