ReactOS  0.4.14-dev-323-g6fe6a88
font.c File Reference
#include "config.h"
#include "wine/port.h"
#include "d3dx9_private.h"
#include "wine/unicode.h"
Include dependency graph for font.c:

Go to the source code of this file.

Classes

struct  d3dx_font
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3dx)
 
static UINT make_pow2 (UINT num)
 
static struct d3dx_fontimpl_from_ID3DXFont (ID3DXFont *iface)
 
static HRESULT WINAPI ID3DXFontImpl_QueryInterface (ID3DXFont *iface, REFIID riid, void **out)
 
static ULONG WINAPI ID3DXFontImpl_AddRef (ID3DXFont *iface)
 
static ULONG WINAPI ID3DXFontImpl_Release (ID3DXFont *iface)
 
static HRESULT WINAPI ID3DXFontImpl_GetDevice (ID3DXFont *iface, IDirect3DDevice9 **device)
 
static HRESULT WINAPI ID3DXFontImpl_GetDescA (ID3DXFont *iface, D3DXFONT_DESCA *desc)
 
static HRESULT WINAPI ID3DXFontImpl_GetDescW (ID3DXFont *iface, D3DXFONT_DESCW *desc)
 
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsA (ID3DXFont *iface, TEXTMETRICA *metrics)
 
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsW (ID3DXFont *iface, TEXTMETRICW *metrics)
 
static HDC WINAPI ID3DXFontImpl_GetDC (ID3DXFont *iface)
 
static HRESULT WINAPI ID3DXFontImpl_GetGlyphData (ID3DXFont *iface, UINT glyph, IDirect3DTexture9 **texture, RECT *blackbox, POINT *cellinc)
 
static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters (ID3DXFont *iface, UINT first, UINT last)
 
static HRESULT WINAPI ID3DXFontImpl_PreloadGlyphs (ID3DXFont *iface, UINT first, UINT last)
 
static HRESULT WINAPI ID3DXFontImpl_PreloadTextA (ID3DXFont *iface, const char *string, INT count)
 
static HRESULT WINAPI ID3DXFontImpl_PreloadTextW (ID3DXFont *iface, const WCHAR *string, INT count)
 
static INT WINAPI ID3DXFontImpl_DrawTextA (ID3DXFont *iface, ID3DXSprite *sprite, const char *string, INT count, RECT *rect, DWORD format, D3DCOLOR color)
 
static INT WINAPI ID3DXFontImpl_DrawTextW (ID3DXFont *iface, ID3DXSprite *sprite, const WCHAR *string, INT count, RECT *rect, DWORD format, D3DCOLOR color)
 
static HRESULT WINAPI ID3DXFontImpl_OnLostDevice (ID3DXFont *iface)
 
static HRESULT WINAPI ID3DXFontImpl_OnResetDevice (ID3DXFont *iface)
 
HRESULT WINAPI D3DXCreateFontA (struct IDirect3DDevice9 *device, INT height, UINT width, UINT weight, UINT miplevels, BOOL italic, DWORD charset, DWORD precision, DWORD quality, DWORD pitchandfamily, const char *facename, struct ID3DXFont **font)
 
HRESULT WINAPI D3DXCreateFontW (IDirect3DDevice9 *device, INT height, UINT width, UINT weight, UINT miplevels, BOOL italic, DWORD charset, DWORD precision, DWORD quality, DWORD pitchandfamily, const WCHAR *facename, ID3DXFont **font)
 
HRESULT WINAPI D3DXCreateFontIndirectA (IDirect3DDevice9 *device, const D3DXFONT_DESCA *desc, ID3DXFont **font)
 
HRESULT WINAPI D3DXCreateFontIndirectW (IDirect3DDevice9 *device, const D3DXFONT_DESCW *desc, ID3DXFont **font)
 

Variables

static const ID3DXFontVtbl D3DXFont_Vtbl
 

Function Documentation

◆ D3DXCreateFontA()

HRESULT WINAPI D3DXCreateFontA ( struct IDirect3DDevice9 *  device,
INT  height,
UINT  width,
UINT  weight,
UINT  miplevels,
BOOL  italic,
DWORD  charset,
DWORD  precision,
DWORD  quality,
DWORD  pitchandfamily,
const char facename,
struct ID3DXFont **  font 
)

Definition at line 429 of file font.c.

432 {
434 
435  if( !device || !font ) return D3DERR_INVALIDCALL;
436 
437  desc.Height=height;
438  desc.Width=width;
439  desc.Weight=weight;
440  desc.MipLevels=miplevels;
441  desc.Italic=italic;
442  desc.CharSet=charset;
443  desc.OutputPrecision=precision;
444  desc.Quality=quality;
445  desc.PitchAndFamily=pitchandfamily;
446  if(facename != NULL) lstrcpyA(desc.FaceName, facename);
447  else desc.FaceName[0] = '\0';
448 
450 }
GLint GLint GLsizei width
Definition: gl.h:1546
CFF_Charset charset
Definition: cffcmap.c:138
Definition: mk_font.cpp:20
#define D3DERR_INVALIDCALL
GLuint GLuint GLfloat weight
Definition: glext.h:11719
Definition: devices.h:37
static const WCHAR desc[]
Definition: protectdata.c:36
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI D3DXCreateFontIndirectA(IDirect3DDevice9 *device, const D3DXFONT_DESCA *desc, ID3DXFont **font)
Definition: font.c:477
static LPTEXTMETRICW LONG * height
Definition: font.c:42
GLenum GLint GLint * precision
Definition: glext.h:7539
int quality
Definition: jpeglib.h:991
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100

◆ D3DXCreateFontIndirectA()

HRESULT WINAPI D3DXCreateFontIndirectA ( IDirect3DDevice9 *  device,
const D3DXFONT_DESCA desc,
ID3DXFont **  font 
)

Definition at line 477 of file font.c.

478 {
479  D3DXFONT_DESCW widedesc;
480 
481  if( !device || !desc || !font ) return D3DERR_INVALIDCALL;
482 
483  /* Copy everything but the last structure member. This requires the
484  two D3DXFONT_DESC structures to be equal until the FaceName member */
485  memcpy(&widedesc, desc, FIELD_OFFSET(D3DXFONT_DESCA, FaceName));
486  MultiByteToWideChar(CP_ACP, 0, desc->FaceName, -1, widedesc.FaceName, ARRAY_SIZE(widedesc.FaceName));
487  return D3DXCreateFontIndirectW(device, &widedesc, font);
488 }
Definition: mk_font.cpp:20
#define CP_ACP
Definition: compat.h:99
#define D3DERR_INVALIDCALL
Definition: devices.h:37
static const WCHAR desc[]
Definition: protectdata.c:36
HRESULT WINAPI D3DXCreateFontIndirectW(IDirect3DDevice9 *device, const D3DXFONT_DESCW *desc, ID3DXFont **font)
Definition: font.c:493
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
WCHAR FaceName[LF_FACESIZE]
Definition: d3dx9core.h:122
#define ARRAY_SIZE(a)
Definition: main.h:24
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
#define MultiByteToWideChar
Definition: compat.h:100

Referenced by D3DXCreateFontA().

◆ D3DXCreateFontIndirectW()

HRESULT WINAPI D3DXCreateFontIndirectW ( IDirect3DDevice9 *  device,
const D3DXFONT_DESCW desc,
ID3DXFont **  font 
)

Definition at line 493 of file font.c.

494 {
497  struct d3dx_font *object;
498  IDirect3D9 *d3d;
499  HRESULT hr;
500 
501  TRACE("(%p, %p, %p)\n", device, desc, font);
502 
503  if (!device || !desc || !font) return D3DERR_INVALIDCALL;
504 
505  TRACE("desc: %d %d %d %d %d %d %d %d %d %s\n", desc->Height, desc->Width, desc->Weight, desc->MipLevels, desc->Italic,
506  desc->CharSet, desc->OutputPrecision, desc->Quality, desc->PitchAndFamily, debugstr_w(desc->FaceName));
507 
508  /* The device MUST support D3DFMT_A8R8G8B8 */
513  if (FAILED(hr))
514  {
515  IDirect3D9_Release(d3d);
516  return D3DXERR_INVALIDDATA;
517  }
518  IDirect3D9_Release(d3d);
519 
520  object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct d3dx_font));
521  if (!object)
522  {
523  *font = NULL;
524  return E_OUTOFMEMORY;
525  }
526  object->ID3DXFont_iface.lpVtbl = &D3DXFont_Vtbl;
527  object->ref = 1;
528  object->device = device;
529  object->desc = *desc;
530 
531  object->hdc = CreateCompatibleDC(NULL);
532  if (!object->hdc)
533  {
534  HeapFree(GetProcessHeap(), 0, object);
535  return D3DXERR_INVALIDDATA;
536  }
537 
538  object->hfont = CreateFontW(desc->Height, desc->Width, 0, 0, desc->Weight, desc->Italic, FALSE, FALSE, desc->CharSet,
539  desc->OutputPrecision, CLIP_DEFAULT_PRECIS, desc->Quality, desc->PitchAndFamily, desc->FaceName);
540  if (!object->hfont)
541  {
542  DeleteDC(object->hdc);
543  HeapFree(GetProcessHeap(), 0, object);
544  return D3DXERR_INVALIDDATA;
545  }
546  SelectObject(object->hdc, object->hfont);
547  SetTextColor(object->hdc, 0x00ffffff);
548  SetBkColor(object->hdc, 0x00000000);
549 
551  *font = &object->ID3DXFont_iface;
552 
553  return D3D_OK;
554 }
#define IDirect3D9_CheckDeviceFormat(p, a, b, c, d, e, f)
Definition: d3d9.h:229
HRESULT hr
Definition: shlfolder.c:183
#define IDirect3DDevice9_GetCreationParameters(p, a)
Definition: d3d9.h:1516
Definition: mk_font.cpp:20
#define D3DERR_INVALIDCALL
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
Definition: font.c:28
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:975
#define IDirect3D9_Release(p)
Definition: d3d9.h:220
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
static const WCHAR desc[]
Definition: protectdata.c:36
#define debugstr_w
Definition: kernel32.h:32
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:425
IDirect3DDevice9 * device
Definition: font.c:33
smooth NULL
Definition: ftsmooth.c:416
#define IDirect3DDevice9_GetDisplayMode(p, a, b)
Definition: d3d9.h:1515
#define IDirect3DDevice9_GetDirect3D(p, a)
Definition: d3d9.h:1513
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
static const ID3DXFontVtbl D3DXFont_Vtbl
Definition: font.c:405
GLenum mode
Definition: glext.h:6217
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:888
#define D3D_OK
Definition: d3d.h:106
BOOL WINAPI DeleteDC(_In_ HDC)
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define HeapFree(x, y, z)
Definition: compat.h:394
void * object
Definition: jmemsys.h:48
HFONT WINAPI CreateFontW(int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight, DWORD fnItalic, DWORD fdwUnderline, DWORD fdwStrikeOut, DWORD fdwCharSet, DWORD fdwOutputPrecision, DWORD fdwClipPrecision, DWORD fdwQuality, DWORD fdwPitchAndFamily, LPCWSTR lpszFace)
Definition: font.c:1894

Referenced by D3DXCreateFontIndirectA(), and D3DXCreateFontW().

◆ D3DXCreateFontW()

HRESULT WINAPI D3DXCreateFontW ( IDirect3DDevice9 *  device,
INT  height,
UINT  width,
UINT  weight,
UINT  miplevels,
BOOL  italic,
DWORD  charset,
DWORD  precision,
DWORD  quality,
DWORD  pitchandfamily,
const WCHAR facename,
ID3DXFont **  font 
)

Definition at line 452 of file font.c.

454 {
456 
457  if( !device || !font ) return D3DERR_INVALIDCALL;
458 
459  desc.Height=height;
460  desc.Width=width;
461  desc.Weight=weight;
462  desc.MipLevels=miplevels;
463  desc.Italic=italic;
464  desc.CharSet=charset;
465  desc.OutputPrecision=precision;
466  desc.Quality=quality;
467  desc.PitchAndFamily=pitchandfamily;
468  if(facename != NULL) strcpyW(desc.FaceName, facename);
469  else desc.FaceName[0] = '\0';
470 
472 }
GLint GLint GLsizei width
Definition: gl.h:1546
CFF_Charset charset
Definition: cffcmap.c:138
Definition: mk_font.cpp:20
#define D3DERR_INVALIDCALL
GLuint GLuint GLfloat weight
Definition: glext.h:11719
Definition: devices.h:37
static const WCHAR desc[]
Definition: protectdata.c:36
smooth NULL
Definition: ftsmooth.c:416
HRESULT WINAPI D3DXCreateFontIndirectW(IDirect3DDevice9 *device, const D3DXFONT_DESCW *desc, ID3DXFont **font)
Definition: font.c:493
static LPTEXTMETRICW LONG * height
Definition: font.c:42
GLenum GLint GLint * precision
Definition: glext.h:7539
int quality
Definition: jpeglib.h:991
WINE_UNICODE_INLINE WCHAR * strcpyW(WCHAR *dst, const WCHAR *src)
Definition: unicode.h:219

◆ ID3DXFontImpl_AddRef()

static ULONG WINAPI ID3DXFontImpl_AddRef ( ID3DXFont iface)
static

Definition at line 84 of file font.c.

85 {
86  struct d3dx_font *This = impl_from_ID3DXFont(iface);
88 
89  TRACE("%p increasing refcount to %u\n", iface, ref);
90 
91  return ref;
92 }
Definition: font.c:28
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
Definition: font.c:61
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ ID3DXFontImpl_DrawTextA()

static INT WINAPI ID3DXFontImpl_DrawTextA ( ID3DXFont iface,
ID3DXSprite *  sprite,
const char string,
INT  count,
RECT rect,
DWORD  format,
D3DCOLOR  color 
)
static

Definition at line 207 of file font.c.

209 {
210  LPWSTR stringW;
211  INT countW, ret = 0;
212 
213  TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x\n",
214  iface, sprite, debugstr_a(string), count, wine_dbgstr_rect(rect), format, color);
215 
216  if (!string || count == 0)
217  return 0;
218 
219  if (count < 0)
220  count = -1;
221 
222  countW = MultiByteToWideChar(CP_ACP, 0, string, count, NULL, 0);
223  stringW = HeapAlloc(GetProcessHeap(), 0, countW * sizeof(WCHAR));
224  if (stringW)
225  {
226  MultiByteToWideChar(CP_ACP, 0, string, count, stringW, countW);
227  ret = ID3DXFont_DrawTextW(iface, sprite, stringW, countW, rect, format, color);
229  }
230 
231  return ret;
232 }
#define CP_ACP
Definition: compat.h:99
GLuint GLuint GLsizei count
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
static const WCHAR stringW[]
Definition: engine.c:38
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLuint color
Definition: glext.h:6243
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
const char * wine_dbgstr_rect(const RECT *rect)
int ret
#define ID3DXFont_DrawTextW(p, a, b, c, d, e, f)
Definition: d3dx9core.h:180
Definition: sprite.c:37
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ ID3DXFontImpl_DrawTextW()

static INT WINAPI ID3DXFontImpl_DrawTextW ( ID3DXFont iface,
ID3DXSprite *  sprite,
const WCHAR string,
INT  count,
RECT rect,
DWORD  format,
D3DCOLOR  color 
)
static

Definition at line 234 of file font.c.

236 {
237  struct d3dx_font *This = impl_from_ID3DXFont(iface);
238  RECT calc_rect;
239  INT height;
240 
241  TRACE("iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x\n",
242  iface, sprite, debugstr_w(string), count, wine_dbgstr_rect(rect), format, color);
243 
244  if (!string || count == 0)
245  return 0;
246 
247  if (count < 0)
248  count = lstrlenW(string);
249 
250  /* Strip terminating NULL characters */
251  while (count > 0 && !string[count-1])
252  count--;
253 
254  if (rect)
255  calc_rect = *rect;
256 
257  height = DrawTextW(This->hdc, string, count, &calc_rect, format | DT_CALCRECT);
258 
259  if (format & DT_CALCRECT)
260  {
261  if (rect)
262  *rect = calc_rect;
263  return height;
264  }
265 
266  if (format & DT_CENTER)
267  {
268  UINT new_width = calc_rect.right - calc_rect.left;
269  calc_rect.left = (rect->right + rect->left - new_width) / 2;
270  calc_rect.right = calc_rect.left + new_width;
271  }
272 
273  if (height && (calc_rect.left < calc_rect.right))
274  {
275  D3DLOCKED_RECT locked_rect;
276  D3DXVECTOR3 position;
277  UINT text_width, text_height;
278  RECT text_rect;
279  ID3DXSprite *target = sprite;
280  HRESULT hr;
281  int i, j;
282 
283  /* Get rect position and dimensions */
284  position.x = calc_rect.left;
285  position.y = calc_rect.top;
286  position.z = 0;
287  text_width = calc_rect.right - calc_rect.left;
288  text_height = calc_rect.bottom - calc_rect.top;
289  text_rect.left = 0;
290  text_rect.top = 0;
291  text_rect.right = text_width;
292  text_rect.bottom = text_height;
293 
294  /* We need to flush as it seems all draws in the begin/end sequence use only the latest updated texture */
295  if (sprite)
297 
298  /* Extend texture and DIB section to contain text */
299  if ((text_width > This->tex_width) || (text_height > This->tex_height))
300  {
302 
303  if (text_width > This->tex_width)
304  This->tex_width = make_pow2(text_width);
305  if (text_height > This->tex_height)
306  This->tex_height = make_pow2(text_height);
307 
308  if (This->texture)
309  {
311  DeleteObject(This->bitmap);
312  }
313 
314  hr = D3DXCreateTexture(This->device, This->tex_width, This->tex_height, 1, 0,
315  D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &This->texture);
316  if (FAILED(hr))
317  {
318  This->texture = NULL;
319  return 0;
320  }
321 
322  header.biSize = sizeof(header);
323  header.biWidth = This->tex_width;
324  header.biHeight = -This->tex_height;
325  header.biPlanes = 1;
326  header.biBitCount = 32;
327  header.biCompression = BI_RGB;
328  header.biSizeImage = sizeof(DWORD) * This->tex_width * This->tex_height;
329  header.biXPelsPerMeter = 0;
330  header.biYPelsPerMeter = 0;
331  header.biClrUsed = 0;
332  header.biClrImportant = 0;
333 
334  This->bitmap = CreateDIBSection(This->hdc, (const BITMAPINFO*)&header,
335  DIB_RGB_COLORS, (void**)&This->bits, NULL, 0);
336  if (!This->bitmap)
337  {
339  This->texture = NULL;
340  return 0;
341  }
342 
343  SelectObject(This->hdc, This->bitmap);
344  }
345 
346  if (FAILED(IDirect3DTexture9_LockRect(This->texture, 0, &locked_rect, &text_rect, D3DLOCK_DISCARD)))
347  return 0;
348 
349  /* Clear rect */
350  for (i = 0; i < text_height; i++)
351  memset(This->bits + i * This->tex_width * sizeof(DWORD), 0,
352  text_width * sizeof(DWORD));
353 
354  DrawTextW(This->hdc, string, count, &text_rect, format);
355 
356  /* All RGB components are equal so take one as alpha and set RGB
357  * color to white, so it can be modulated with color parameter */
358  for (i = 0; i < text_height; i++)
359  {
360  DWORD *src = (DWORD *)This->bits + i * This->tex_width;
361  DWORD *dst = (DWORD *)((BYTE *)locked_rect.pBits + i * locked_rect.Pitch);
362  for (j = 0; j < text_width; j++)
363  {
364  *dst++ = (*src++ << 24) | 0xFFFFFF;
365  }
366  }
367 
368  IDirect3DTexture9_UnlockRect(This->texture, 0);
369 
370  if (!sprite)
371  {
372  hr = D3DXCreateSprite(This->device, &target);
373  if (FAILED(hr))
374  return 0;
376  }
377 
378  hr = target->lpVtbl->Draw(target, This->texture, &text_rect, NULL, &position, color);
379 
380  if (!sprite)
381  {
384  }
385 
386  if (FAILED(hr))
387  return 0;
388  }
389 
390  return height;
391 }
#define IDirect3DTexture9_UnlockRect(p, a)
Definition: d3d9.h:1035
HRESULT hr
Definition: shlfolder.c:183
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define IDirect3DTexture9_Release(p)
Definition: d3d9.h:1014
LONG top
Definition: windef.h:292
#define D3DLOCK_DISCARD
Definition: d3d8types.h:72
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
Definition: font.c:28
LONG left
Definition: windef.h:291
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
Definition: font.c:61
LONG right
Definition: windef.h:293
#define lstrlenW
Definition: compat.h:407
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define DT_CALCRECT
Definition: winuser.h:526
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: font.c:353
GLuint color
Definition: glext.h:6243
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
static LPTEXTMETRICW LONG * height
Definition: font.c:42
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: solgame.cpp:4
#define ID3DXSprite_Flush(p)
Definition: d3dx9core.h:451
LONG HRESULT
Definition: typedefs.h:77
const char * wine_dbgstr_rect(const RECT *rect)
#define ID3DXSprite_End(p)
Definition: d3dx9core.h:452
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ID3DXSprite_Release(p)
Definition: d3dx9core.h:442
#define ID3DXSprite_Begin(p, a)
Definition: d3dx9core.h:449
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
Definition: sprite.c:37
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
GLenum GLenum dst
Definition: glext.h:6340
unsigned int UINT
Definition: ndis.h:50
HRESULT WINAPI D3DXCreateSprite(struct IDirect3DDevice9 *device, struct ID3DXSprite **sprite)
Definition: sprite.c:557
#define IDirect3DTexture9_LockRect(p, a, b, c, d)
Definition: d3d9.h:1034
GLenum target
Definition: glext.h:7315
RECT text_rect
Definition: sndrec32.cpp:77
LONG bottom
Definition: windef.h:294
static UINT make_pow2(UINT num)
Definition: font.c:47
#define DT_CENTER
Definition: winuser.h:527
#define DIB_RGB_COLORS
Definition: wingdi.h:366
HRESULT WINAPI D3DXCreateTexture(struct IDirect3DDevice9 *device, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, struct IDirect3DTexture9 **texture)
Definition: texture.c:526
#define memset(x, y, z)
Definition: compat.h:39
#define BI_RGB
Definition: precomp.h:34
struct CFHEADER header
Definition: fdi.c:101
static DWORD
Definition: font.c:57

◆ ID3DXFontImpl_GetDC()

static HDC WINAPI ID3DXFontImpl_GetDC ( ID3DXFont iface)
static

Definition at line 168 of file font.c.

169 {
170  struct d3dx_font *This = impl_from_ID3DXFont(iface);
171  TRACE("iface %p\n", iface);
172  return This->hdc;
173 }
Definition: font.c:28
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
Definition: font.c:61
#define TRACE(s)
Definition: solgame.cpp:4

◆ ID3DXFontImpl_GetDescA()

static HRESULT WINAPI ID3DXFontImpl_GetDescA ( ID3DXFont iface,
D3DXFONT_DESCA desc 
)
static

Definition at line 129 of file font.c.

130 {
131  struct d3dx_font *This = impl_from_ID3DXFont(iface);
132 
133  TRACE("iface %p, desc %p\n", iface, desc);
134 
135  if( !desc ) return D3DERR_INVALIDCALL;
136  memcpy(desc, &This->desc, FIELD_OFFSET(D3DXFONT_DESCA, FaceName));
137  WideCharToMultiByte(CP_ACP, 0, This->desc.FaceName, -1, desc->FaceName, ARRAY_SIZE(desc->FaceName), NULL, NULL);
138 
139  return D3D_OK;
140 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
#define D3DERR_INVALIDCALL
Definition: font.c:28
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
Definition: font.c:61
static const WCHAR desc[]
Definition: protectdata.c:36
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define D3D_OK
Definition: d3d.h:106
#define ARRAY_SIZE(a)
Definition: main.h:24
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254

◆ ID3DXFontImpl_GetDescW()

static HRESULT WINAPI ID3DXFontImpl_GetDescW ( ID3DXFont iface,
D3DXFONT_DESCW desc 
)
static

Definition at line 142 of file font.c.

143 {
144  struct d3dx_font *This = impl_from_ID3DXFont(iface);
145 
146  TRACE("iface %p, desc %p\n", iface, desc);
147 
148  if( !desc ) return D3DERR_INVALIDCALL;
149  *desc = This->desc;
150 
151  return D3D_OK;
152 }
#define D3DERR_INVALIDCALL
Definition: font.c:28
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
Definition: font.c:61
static const WCHAR desc[]
Definition: protectdata.c:36
#define TRACE(s)
Definition: solgame.cpp:4
#define D3D_OK
Definition: d3d.h:106

◆ ID3DXFontImpl_GetDevice()

static HRESULT WINAPI ID3DXFontImpl_GetDevice ( ID3DXFont iface,
IDirect3DDevice9 **  device 
)
static

Definition at line 116 of file font.c.

117 {
118  struct d3dx_font *This = impl_from_ID3DXFont(iface);
119 
120  TRACE("iface %p, device %p\n", iface, device);
121 
122  if( !device ) return D3DERR_INVALIDCALL;
123  *device = This->device;
124  IDirect3DDevice9_AddRef(This->device);
125 
126  return D3D_OK;
127 }
#define D3DERR_INVALIDCALL
Definition: font.c:28
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
Definition: font.c:61
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
#define D3D_OK
Definition: d3d.h:106

◆ ID3DXFontImpl_GetGlyphData()

static HRESULT WINAPI ID3DXFontImpl_GetGlyphData ( ID3DXFont iface,
UINT  glyph,
IDirect3DTexture9 **  texture,
RECT blackbox,
POINT cellinc 
)
static

Definition at line 175 of file font.c.

177 {
178  FIXME("iface %p, glyph %#x, texture %p, blackbox %p, cellinc %p stub!\n",
179  iface, glyph, texture, blackbox, cellinc);
180  return E_NOTIMPL;
181 }
#define FIXME(fmt,...)
Definition: debug.h:110
GLenum GLuint texture
Definition: glext.h:6295
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ID3DXFontImpl_GetTextMetricsA()

static BOOL WINAPI ID3DXFontImpl_GetTextMetricsA ( ID3DXFont iface,
TEXTMETRICA metrics 
)
static

Definition at line 154 of file font.c.

155 {
156  struct d3dx_font *This = impl_from_ID3DXFont(iface);
157  TRACE("iface %p, metrics %p\n", iface, metrics);
158  return GetTextMetricsA(This->hdc, metrics);
159 }
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
Definition: font.c:28
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
Definition: font.c:61
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
#define TRACE(s)
Definition: solgame.cpp:4

◆ ID3DXFontImpl_GetTextMetricsW()

static BOOL WINAPI ID3DXFontImpl_GetTextMetricsW ( ID3DXFont iface,
TEXTMETRICW metrics 
)
static

Definition at line 161 of file font.c.

162 {
163  struct d3dx_font *This = impl_from_ID3DXFont(iface);
164  TRACE("iface %p, metrics %p\n", iface, metrics);
165  return GetTextMetricsW(This->hdc, metrics);
166 }
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
Definition: font.c:28
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
Definition: font.c:61
#define TRACE(s)
Definition: solgame.cpp:4

◆ ID3DXFontImpl_OnLostDevice()

static HRESULT WINAPI ID3DXFontImpl_OnLostDevice ( ID3DXFont iface)
static

Definition at line 393 of file font.c.

394 {
395  FIXME("iface %p stub!\n", iface);
396  return D3D_OK;
397 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define D3D_OK
Definition: d3d.h:106

◆ ID3DXFontImpl_OnResetDevice()

static HRESULT WINAPI ID3DXFontImpl_OnResetDevice ( ID3DXFont iface)
static

Definition at line 399 of file font.c.

400 {
401  FIXME("iface %p stub\n", iface);
402  return D3D_OK;
403 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define D3D_OK
Definition: d3d.h:106

◆ ID3DXFontImpl_PreloadCharacters()

static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters ( ID3DXFont iface,
UINT  first,
UINT  last 
)
static

Definition at line 183 of file font.c.

184 {
185  FIXME("iface %p, first %u, last %u stub!\n", iface, first, last);
186  return S_OK;
187 }
const GLint * first
Definition: glext.h:5794
static UINT UINT last
Definition: font.c:45
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:59

◆ ID3DXFontImpl_PreloadGlyphs()

static HRESULT WINAPI ID3DXFontImpl_PreloadGlyphs ( ID3DXFont iface,
UINT  first,
UINT  last 
)
static

Definition at line 189 of file font.c.

190 {
191  FIXME("iface %p, first %u, last %u stub!\n", iface, first, last);
192  return E_NOTIMPL;
193 }
const GLint * first
Definition: glext.h:5794
static UINT UINT last
Definition: font.c:45
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ID3DXFontImpl_PreloadTextA()

static HRESULT WINAPI ID3DXFontImpl_PreloadTextA ( ID3DXFont iface,
const char string,
INT  count 
)
static

Definition at line 195 of file font.c.

196 {
197  FIXME("iface %p, string %s, count %d stub!\n", iface, debugstr_a(string), count);
198  return E_NOTIMPL;
199 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ID3DXFontImpl_PreloadTextW()

static HRESULT WINAPI ID3DXFontImpl_PreloadTextW ( ID3DXFont iface,
const WCHAR string,
INT  count 
)
static

Definition at line 201 of file font.c.

202 {
203  FIXME("iface %p, string %s, count %d stub!\n", iface, debugstr_w(string), count);
204  return E_NOTIMPL;
205 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ ID3DXFontImpl_QueryInterface()

static HRESULT WINAPI ID3DXFontImpl_QueryInterface ( ID3DXFont iface,
REFIID  riid,
void **  out 
)
static

Definition at line 66 of file font.c.

67 {
68  TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
69 
70  if (IsEqualGUID(riid, &IID_ID3DXFont)
72  {
73  IUnknown_AddRef(iface);
74  *out = iface;
75  return S_OK;
76  }
77 
78  WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
79 
80  *out = NULL;
81  return E_NOINTERFACE;
82 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
#define S_OK
Definition: intsafe.h:59
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ ID3DXFontImpl_Release()

static ULONG WINAPI ID3DXFontImpl_Release ( ID3DXFont iface)
static

Definition at line 94 of file font.c.

95 {
96  struct d3dx_font *This = impl_from_ID3DXFont(iface);
98 
99  TRACE("%p decreasing refcount to %u\n", iface, ref);
100 
101  if (!ref)
102  {
103  if (This->texture)
104  {
106  DeleteObject(This->bitmap);
107  }
108  DeleteObject(This->hfont);
109  DeleteDC(This->hdc);
112  }
113  return ref;
114 }
#define IDirect3DTexture9_Release(p)
Definition: d3d9.h:1014
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
Definition: font.c:28
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
Definition: font.c:61
Definition: send.c:47
GLenum GLint ref
Definition: glext.h:6028
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1508
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
#define InterlockedDecrement
Definition: armddk.h:52
BOOL WINAPI DeleteDC(_In_ HDC)
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ impl_from_ID3DXFont()

static struct d3dx_font* impl_from_ID3DXFont ( ID3DXFont iface)
inlinestatic

Definition at line 61 of file font.c.

62 {
63  return CONTAINING_RECORD(iface, struct d3dx_font, ID3DXFont_iface);
64 }
Definition: font.c:28
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
ID3DXFont ID3DXFont_iface
Definition: font.c:30

Referenced by ID3DXFontImpl_AddRef(), ID3DXFontImpl_DrawTextW(), ID3DXFontImpl_GetDC(), ID3DXFontImpl_GetDescA(), ID3DXFontImpl_GetDescW(), ID3DXFontImpl_GetDevice(), ID3DXFontImpl_GetTextMetricsA(), ID3DXFontImpl_GetTextMetricsW(), and ID3DXFontImpl_Release().

◆ make_pow2()

static UINT make_pow2 ( UINT  num)
static

Definition at line 47 of file font.c.

48 {
49  UINT result = 1;
50 
51  /* In the unlikely event somebody passes a large value, make sure we don't enter an infinite loop */
52  if (num >= 0x80000000)
53  return 0x80000000;
54 
55  while (result < num)
56  result <<= 1;
57 
58  return result;
59 }
GLuint GLuint num
Definition: glext.h:9618
unsigned int UINT
Definition: ndis.h:50
GLuint64EXT * result
Definition: glext.h:11304

Referenced by ID3DXFontImpl_DrawTextW().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3dx  )

Variable Documentation

◆ D3DXFont_Vtbl

const ID3DXFontVtbl D3DXFont_Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI ID3DXFontImpl_OnLostDevice(ID3DXFont *iface)
Definition: font.c:393
static HRESULT WINAPI ID3DXFontImpl_PreloadGlyphs(ID3DXFont *iface, UINT first, UINT last)
Definition: font.c:189
static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, const WCHAR *string, INT count, RECT *rect, DWORD format, D3DCOLOR color)
Definition: font.c:234
static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters(ID3DXFont *iface, UINT first, UINT last)
Definition: font.c:183
static ULONG WINAPI ID3DXFontImpl_AddRef(ID3DXFont *iface)
Definition: font.c:84
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsW(ID3DXFont *iface, TEXTMETRICW *metrics)
Definition: font.c:161
static HRESULT WINAPI ID3DXFontImpl_OnResetDevice(ID3DXFont *iface)
Definition: font.c:399
static HDC WINAPI ID3DXFontImpl_GetDC(ID3DXFont *iface)
Definition: font.c:168
static ULONG WINAPI ID3DXFontImpl_Release(ID3DXFont *iface)
Definition: font.c:94
static HRESULT WINAPI ID3DXFontImpl_GetGlyphData(ID3DXFont *iface, UINT glyph, IDirect3DTexture9 **texture, RECT *blackbox, POINT *cellinc)
Definition: font.c:175
static HRESULT WINAPI ID3DXFontImpl_QueryInterface(ID3DXFont *iface, REFIID riid, void **out)
Definition: font.c:66
static HRESULT WINAPI ID3DXFontImpl_PreloadTextW(ID3DXFont *iface, const WCHAR *string, INT count)
Definition: font.c:201
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsA(ID3DXFont *iface, TEXTMETRICA *metrics)
Definition: font.c:154
static HRESULT WINAPI ID3DXFontImpl_GetDevice(ID3DXFont *iface, IDirect3DDevice9 **device)
Definition: font.c:116
static HRESULT WINAPI ID3DXFontImpl_PreloadTextA(ID3DXFont *iface, const char *string, INT count)
Definition: font.c:195
static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, ID3DXSprite *sprite, const char *string, INT count, RECT *rect, DWORD format, D3DCOLOR color)
Definition: font.c:207
static HRESULT WINAPI ID3DXFontImpl_GetDescW(ID3DXFont *iface, D3DXFONT_DESCW *desc)
Definition: font.c:142
static HRESULT WINAPI ID3DXFontImpl_GetDescA(ID3DXFont *iface, D3DXFONT_DESCA *desc)
Definition: font.c:129

Definition at line 405 of file font.c.

Referenced by D3DXCreateFontIndirectW().