Jacek Caban : gdi32: Move GetCharacterPlacementA to text.c.
Alexandre Julliard
julliard at winehq.org
Fri Aug 20 16:12:55 CDT 2021
Module: wine
Branch: master
Commit: e27c61be21a5abca5520b3e539a1f9bf112c69be
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e27c61be21a5abca5520b3e539a1f9bf112c69be
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Aug 20 10:41:13 2021 +0200
gdi32: Move GetCharacterPlacementA to text.c.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/font.c | 53 -----------------------------------------------------
dlls/gdi32/text.c | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 53 deletions(-)
diff --git a/dlls/gdi32/font.c b/dlls/gdi32/font.c
index 6905d21751b..4d6f11d5080 100644
--- a/dlls/gdi32/font.c
+++ b/dlls/gdi32/font.c
@@ -6937,59 +6937,6 @@ DWORD WINAPI GetGlyphIndicesW(HDC hdc, LPCWSTR lpstr, INT count,
return ret;
}
-/*************************************************************************
- * GetCharacterPlacementA [GDI32.@]
- *
- * See GetCharacterPlacementW.
- *
- * NOTES:
- * the web browser control of ie4 calls this with dwFlags=0
- */
-DWORD WINAPI
-GetCharacterPlacementA(HDC hdc, LPCSTR lpString, INT uCount,
- INT nMaxExtent, GCP_RESULTSA *lpResults,
- DWORD dwFlags)
-{
- WCHAR *lpStringW;
- INT uCountW;
- GCP_RESULTSW resultsW;
- DWORD ret;
- UINT font_cp;
-
- TRACE("%s, %d, %d, 0x%08x\n",
- debugstr_an(lpString, uCount), uCount, nMaxExtent, dwFlags);
-
- lpStringW = FONT_mbtowc(hdc, lpString, uCount, &uCountW, &font_cp);
-
- if (!lpResults)
- {
- ret = GetCharacterPlacementW(hdc, lpStringW, uCountW, nMaxExtent, NULL, dwFlags);
- HeapFree(GetProcessHeap(), 0, lpStringW);
- return ret;
- }
-
- /* both structs are equal in size */
- memcpy(&resultsW, lpResults, sizeof(resultsW));
-
- if(lpResults->lpOutString)
- resultsW.lpOutString = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*uCountW);
-
- ret = GetCharacterPlacementW(hdc, lpStringW, uCountW, nMaxExtent, &resultsW, dwFlags);
-
- lpResults->nGlyphs = resultsW.nGlyphs;
- lpResults->nMaxFit = resultsW.nMaxFit;
-
- if(lpResults->lpOutString) {
- WideCharToMultiByte(font_cp, 0, resultsW.lpOutString, uCountW,
- lpResults->lpOutString, uCount, NULL, NULL );
- }
-
- HeapFree(GetProcessHeap(), 0, lpStringW);
- HeapFree(GetProcessHeap(), 0, resultsW.lpOutString);
-
- return ret;
-}
-
/*************************************************************************
* GetCharABCWidthsFloatA [GDI32.@]
*
diff --git a/dlls/gdi32/text.c b/dlls/gdi32/text.c
index 66a51e89817..82bf709fe19 100644
--- a/dlls/gdi32/text.c
+++ b/dlls/gdi32/text.c
@@ -1009,3 +1009,46 @@ DWORD WINAPI GetCharacterPlacementW( HDC hdc, const WCHAR *str, INT count, INT m
HeapFree( GetProcessHeap(), 0, kern );
return ret;
}
+
+/*************************************************************************
+ * GetCharacterPlacementA (GDI32.@)
+ */
+DWORD WINAPI GetCharacterPlacementA( HDC hdc, const char *str, INT count, INT max_extent,
+ GCP_RESULTSA *result, DWORD flags )
+{
+ GCP_RESULTSW resultsW;
+ WCHAR *strW;
+ INT countW;
+ DWORD ret;
+ UINT font_cp;
+
+ TRACE( "%s, %d, %d, 0x%08x\n", debugstr_an(str, count), count, max_extent, flags );
+
+ strW = text_mbtowc( hdc, str, count, &countW, &font_cp );
+
+ if (!result)
+ {
+ ret = GetCharacterPlacementW( hdc, strW, countW, max_extent, NULL, flags );
+ HeapFree( GetProcessHeap(), 0, strW );
+ return ret;
+ }
+
+ /* both structs are equal in size */
+ memcpy( &resultsW, result, sizeof(resultsW) );
+
+ if (result->lpOutString)
+ resultsW.lpOutString = HeapAlloc( GetProcessHeap(), 0, sizeof(WCHAR) * countW );
+
+ ret = GetCharacterPlacementW( hdc, strW, countW, max_extent, &resultsW, flags );
+
+ result->nGlyphs = resultsW.nGlyphs;
+ result->nMaxFit = resultsW.nMaxFit;
+
+ if (result->lpOutString)
+ WideCharToMultiByte( font_cp, 0, resultsW.lpOutString, countW,
+ result->lpOutString, count, NULL, NULL );
+
+ HeapFree( GetProcessHeap(), 0, strW );
+ HeapFree( GetProcessHeap(), 0, resultsW.lpOutString );
+ return ret;
+}
More information about the wine-cvs
mailing list