[PATCH v2 1/5] d3dx9: Implement ID3DXFont_PreloadText.
Matteo Bruni
matteo.mystral at gmail.com
Tue Mar 3 07:06:23 CST 2020
On Mon, Mar 2, 2020 at 8:06 PM Akihiro Sagawa <sagawa.aki at gmail.com> wrote:
>
> Hi Sven,
>
> On Mon, 2 Mar 2020 11:51:52 +0100, Sven Baars wrote:
> > diff --git a/dlls/d3dx9_36/font.c b/dlls/d3dx9_36/font.c
> > index 9196295637..8d2d6c8c44 100644
> > --- a/dlls/d3dx9_36/font.c
> > +++ b/dlls/d3dx9_36/font.c
> > @@ -420,14 +420,62 @@ static HRESULT WINAPI ID3DXFontImpl_PreloadGlyphs(ID3DXFont *iface, UINT first,
> >
> > static HRESULT WINAPI ID3DXFontImpl_PreloadTextA(ID3DXFont *iface, const char *string, INT count)
> > {
> > - FIXME("iface %p, string %s, count %d stub!\n", iface, debugstr_a(string), count);
> > - return E_NOTIMPL;
> > + WCHAR *wstr;
> > + HRESULT hr;
> > + int countW;
> > +
> > + TRACE("iface %p, string %s, count %d.\n", iface, debugstr_a(string), count);
> debugstr_an(string, count) is preferable.
>
> > +
> > + if (!string && !count)
> > + return D3D_OK;
> > +
> > + if (!string)
> > + return D3DERR_INVALIDCALL;
> > +
> > + countW = MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, NULL, 0);
> > +
> > + wstr = heap_alloc(countW * sizeof(*wstr));
> > + if (!wstr)
> > + return E_OUTOFMEMORY;
> > +
> > + MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, wstr, countW);
> > +
> > + hr = ID3DXFont_PreloadTextW(iface, wstr, count);
> You want to use countW instead of count here.
>
> There are similar issues with ID3DXFontImpl_DrawTextA in PATCH 2/5.
>
> Regards,
> Akihiro Sagawa
Thank you for having a look, that's very helpful!
More information about the wine-devel
mailing list