On Sat Oct 14 21:51:50 2023 +0000, Nikolay Sivov wrote:
I think it makes more sense to have some inline helper if needed, to avoid calling public functions internally, if that's actually a problem at all (do we have any kind of performance numbers?) rather than unrolling. With previous implementation we have 2*4 float multiplication inside `GdipTransformMatrixPoints` function:
pts[i].X = x * matrix->matrix[0] + y * matrix->matrix[2] + matrix->matrix[4];
pts[i].Y = x * matrix->matrix[1] + y * matrix->matrix[3] + matrix->matrix[5];
Here is the full source code: ``` GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count) { REAL x, y; INT i; TRACE("(%s, %p, %d)\n", debugstr_matrix(matrix), pts, count); if(!matrix || !pts || count <= 0) return InvalidParameter; for(i = 0; i < count; i++) { x = pts[i].X; y = pts[i].Y; pts[i].X = x * matrix->matrix[0] + y * matrix->matrix[2] + matrix->matrix[4]; pts[i].Y = x * matrix->matrix[1] + y * matrix->matrix[3] + matrix->matrix[5]; } return Ok; } ``` As the vector is (0,0) and (1, 1), we could replace invocation of this function by simple assigment (no need to multiple anything): ``` scale_x = graphics->worldtrans.matrix[0] + graphics->worldtrans.matrix[2]; scale_y = graphics->worldtrans.matrix[1] + graphics->worldtrans.matrix[3]; ``` We could also optimize it more and calculate width via `sqrt` only once. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3971#note_48738