Re: [PATCH v3 0/1] MR3971: gdiplus: Opimize GDI32_GdipDrawPath
On Sat Oct 14 22:06:36 2023 +0000, Bartosz Kosiorek wrote:
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 (I would like to leave it for next MR). This seems simple enough that I have no problem changing it without performance numbers. Note that we immediately turn around and do the same thing with graphics->gdi_transform (with some indirection through gdip_transform_points and get_graphics_transform that could be eliminated).
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3971#note_48812
participants (1)
-
Esme Povirk (@madewokherd)