diff --git a/src/egegapi.cpp b/src/egegapi.cpp index d64b65a..fb87892 100644 --- a/src/egegapi.cpp +++ b/src/egegapi.cpp @@ -2391,7 +2391,7 @@ void ege_path_widen(ege_path* path, float lineWidth, const ege_transform_matrix* if (matrix != NULL) { Gdiplus::Matrix mat; - matrixConvert(matrix, mat); + matrixConvert(*matrix, mat); graphicsPath->Widen(&pen, &mat, flatness); } else { graphicsPath->Widen(&pen, NULL, flatness); @@ -2413,7 +2413,7 @@ void ege_path_flatten(ege_path* path, const ege_transform_matrix* matrix, float if (graphicsPath != NULL) { if (matrix != NULL) { Gdiplus::Matrix mat; - matrixConvert(matrix, mat); + matrixConvert(*matrix, mat); graphicsPath->Flatten(&mat, flatness); } else { graphicsPath->Flatten(NULL, flatness); @@ -2439,7 +2439,7 @@ void ege_path_warp(ege_path* path, const ege_point* points, int count, const ege if (matrix != NULL) { Gdiplus::Matrix mat; - matrixConvert(matrix, mat); + matrixConvert(*matrix, mat); graphicsPath->Warp(p, count, r, &mat, Gdiplus::WarpModePerspective, flatness); } else { graphicsPath->Warp(p, count, r, NULL, Gdiplus::WarpModePerspective, flatness); @@ -2460,7 +2460,7 @@ void ege_path_outline(ege_path* path, const ege_transform_matrix* matrix, float if (graphicsPath != NULL) { if (matrix != NULL) { Gdiplus::Matrix mat; - matrixConvert(matrix, mat); + matrixConvert(*matrix, mat); graphicsPath->Outline(&mat, flatness); } else { graphicsPath->Outline(NULL, flatness); @@ -2552,7 +2552,7 @@ ege_rect ege_path_getbounds(const ege_path* path, const ege_transform_matrix* ma if (graphicsPath != NULL) { if (matrix != NULL) { Gdiplus::Matrix mat; - matrixConvert(matrix, mat); + matrixConvert(*matrix, mat); graphicsPath->GetBounds((Gdiplus::RectF*)&bounds, &mat); } else { graphicsPath->GetBounds((Gdiplus::RectF*)&bounds, NULL); @@ -2572,7 +2572,7 @@ ege_rect ege_path_getbounds(const ege_path* path, const ege_transform_matrix* ma PIMAGE img = CONVERT_IMAGE_CONST((PIMAGE)pimg); if (matrix != NULL) { Gdiplus::Matrix mat; - matrixConvert(matrix, mat); + matrixConvert(*matrix, mat); graphicsPath->GetBounds((Gdiplus::RectF*)&bounds, &mat, img->getPen()); } else { graphicsPath->GetBounds((Gdiplus::RectF*)&bounds, NULL, img->getPen()); @@ -2633,7 +2633,7 @@ void ege_path_transform(ege_path* path, const ege_transform_matrix *matrix) Gdiplus::GraphicsPath* graphicsPath = (Gdiplus::GraphicsPath*)path->data(); if (graphicsPath != NULL) { Gdiplus::Matrix mat; - matrixConvert(matrix, mat); + matrixConvert(*matrix, mat); graphicsPath->Transform(&mat); } } @@ -2890,7 +2890,7 @@ void EGEAPI ege_set_transform(const ege_transform_matrix* matrix, PIMAGE pimg) if (img && matrix) { Gdiplus::Graphics* graphics = img->getGraphics(); Gdiplus::Matrix mat; - matrixConvert(matrix, mat); + matrixConvert(*matrix, mat); graphics->SetTransform(&mat); } CONVERT_IMAGE_END; diff --git a/src/gdi_conv.cpp b/src/gdi_conv.cpp index 7754c1b..e18a9f8 100644 --- a/src/gdi_conv.cpp +++ b/src/gdi_conv.cpp @@ -8,15 +8,10 @@ namespace ege * 将 ege_transform_matrix 类型转换为 Gdiplus::Matrix 类型 * @param[in] from 输入的矩阵 * @param[out] to 保存转换结果 - * @note 如果 from 参数为 NULL,输出结果为单位矩阵。 */ -void matrixConvert(const ege_transform_matrix* from, Gdiplus::Matrix& to) +void matrixConvert(const ege_transform_matrix& from, Gdiplus::Matrix& to) { - if (from) { - to.SetElements(from->m11, from->m12, from->m21, from->m22, from->m31, from->m32); - } else { - to.Reset(); - } + to.SetElements(from.m11, from.m12, from.m21, from.m22, from.m31, from.m32); } } diff --git a/src/gdi_conv.h b/src/gdi_conv.h index 182d3eb..c57cb68 100644 --- a/src/gdi_conv.h +++ b/src/gdi_conv.h @@ -5,5 +5,5 @@ namespace ege { /* 矩阵类型转换 */ - void matrixConvert(const ege_transform_matrix* from, Gdiplus::Matrix& to); + void matrixConvert(const ege_transform_matrix& from, Gdiplus::Matrix& to); }