66 return id - glyph->
id;
88 IUnknown_AddRef(iface);
104 TRACE(
"%p increasing refcount to %u\n", iface,
ref);
114 TRACE(
"%p decreasing refcount to %u\n", iface,
ref);
118 for (
i = 0;
i <
font->texture_count; ++
i)
150 TRACE(
"iface %p, desc %p\n", iface,
desc);
163 TRACE(
"iface %p, desc %p\n", iface,
desc);
188 TRACE(
"iface %p\n", iface);
199 TRACE(
"iface %p, glyph %#x, texture %p, black_box %p, cell_inc %p.\n",
200 iface, glyph,
texture, black_box, cell_inc);
278 x = (
x ^ (
x >> 1)) & 0x33333333;
279 x = (
x ^ (
x >> 2)) & 0x0f0f0f0f;
280 x = (
x ^ (
x >> 4)) & 0x00ff00ff;
281 x = (
x ^ (
x >> 8)) & 0x0000ffff;
304 static const MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
306 IDirect3DTexture9 *current_texture =
NULL;
321 if (
font->texture_count)
322 current_texture =
font->textures[
font->texture_count - 1];
324 for (glyph =
first; glyph <=
last; ++glyph)
329 current_glyph =
heap_alloc(
sizeof(*current_glyph));
337 current_glyph->
id = glyph;
344 WARN(
"GetGlyphOutlineW failed.\n");
360 if (
font->texture_pos ==
font->glyphs_per_texture)
362 unsigned int new_texture_count =
font->texture_count + 1;
363 IDirect3DTexture9 **new_textures;
368 new_textures =
heap_realloc(
font->textures, new_texture_count *
sizeof(*new_textures));
374 font->textures = new_textures;
384 current_texture =
font->textures[
font->texture_count++];
385 font->texture_pos = 0;
408 current_glyph->
texture = current_texture;
410 pixel_data = lockrect.
pBits;
435 if (!
string && !
count)
464 if (!
string && !
count)
493 TRACE(
"iface %p, sprite %p, string %s, count %d, rect %s, format %#x, color 0x%08x.\n",
496 if (!
string || !
count)
504 wstr = heap_alloc_zero(countW *
sizeof(*wstr));
519 unsigned int chars_fit,
unsigned int *chars_used,
SIZE *
size)
538 while (
i > 0 && !sla[
i].fSoftBreak)
542 if (!sla[
i].fSoftBreak)
546 if (sla[
i].fWhiteSpace)
550 while (
i > 0 && sla[
i-1].fWhiteSpace)
562 unsigned int orig_count = *
count;
570 if (
str[
i] !=
'\r' &&
str[
i] !=
'\n')
580 unsigned int chars_used;
583 *
count = orig_count - chars_used;
606 lh =
font->metrics.tmHeight;
611 unsigned int line_len;
615 if (
size.cx > max_width)
625 rect->left += (
rect->right -
rect->left - max_width) / 2;
626 rect->right =
rect->left + max_width;
630 rect->left =
rect->right - max_width;
634 rect->right =
rect->left + max_width;
665 TRACE(
"iface %p, sprite %p, string %s, in_count %d, rect %s, format %#x, color 0x%08x.\n",
712 lh =
font->metrics.tmHeight;
723 unsigned int line_len,
i;
764 pos.y = cell_inc.
y +
y;
810 FIXME(
"iface %p stub!\n", iface);
816 FIXME(
"iface %p stub\n", iface);
855 desc.MipLevels=miplevels;
860 desc.PitchAndFamily=pitchandfamily;
862 else desc.FaceName[0] =
'\0';
877 desc.MipLevels=miplevels;
882 desc.PitchAndFamily=pitchandfamily;
884 else desc.FaceName[0] =
'\0';
932 object = heap_alloc_zero(
sizeof(*
object));
941 object->desc = *
desc;
972 object->texture_size =
object->glyph_size;
973 if (
object->glyph_size < 256)
974 object->texture_size =
min(256,
object->texture_size * 16);
976 object->glyphs_per_texture =
object->texture_size *
object->texture_size
977 / (
object->glyph_size *
object->glyph_size);
978 object->texture_pos =
object->glyphs_per_texture;
981 *
font = &
object->ID3DXFont_iface;
static HRESULT WINAPI ID3DXFontImpl_OnLostDevice(ID3DXFont *iface)
static uint32_t morton_decode(uint32_t x)
#define IDirect3DTexture9_UnlockRect(p, a)
unsigned __int3264 UINT_PTR
static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, const WCHAR *string, INT in_count, RECT *rect, DWORD format, D3DCOLOR color)
#define IDirect3D9_CheckDeviceFormat(p, a, b, c, d, e, f)
GLuint GLuint GLsizei GLenum const GLvoid * indices
GLint GLint GLsizei width
IDirect3DTexture9 * texture
static const WORD * indices
static HRESULT WINAPI ID3DXFontImpl_PreloadGlyphs(ID3DXFont *iface, UINT first, UINT last)
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
unsigned int texture_count
#define WideCharToMultiByte
coclass MSXML2::XSLTemplate40 object
#define IDirect3DDevice9_GetCreationParameters(p, a)
static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters(ID3DXFont *iface, UINT first, UINT last)
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
static ULONG WINAPI ID3DXFontImpl_AddRef(ID3DXFont *iface)
GLdouble GLdouble GLdouble r
GLuint GLuint GLsizei count
#define ID3DXSprite_Draw(p, a, b, c, d, e)
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsW(ID3DXFont *iface, TEXTMETRICW *metrics)
#define IDirect3DTexture9_Release(p)
static HRESULT WINAPI ID3DXFontImpl_OnResetDevice(ID3DXFont *iface)
#define D3DERR_INVALIDCALL
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLint GLint GLint GLint GLint x
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
static int glyph_rb_compare(const void *key, const struct wine_rb_entry *entry)
static void glyph_rb_free(struct wine_rb_entry *entry, void *context)
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
static HDC WINAPI ID3DXFontImpl_GetDC(ID3DXFont *iface)
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)
#define IDirect3DTexture9_AddRef(p)
static void * heap_realloc(void *mem, size_t len)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
static void * heap_alloc(size_t len)
WINE_DEFAULT_DEBUG_CHANNEL(d3dx)
#define IDirect3D9_Release(p)
BOOL WINAPI GetTextExtentExPointW(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpszString, _In_ int cchString, _In_ int nMaxExtent, _Out_opt_ LPINT lpnFit, _Out_writes_to_opt_(cchString, *lpnFit) LPINT lpnDx, _Out_ LPSIZE lpSize)
static const WCHAR desc[]
#define CLIP_DEFAULT_PRECIS
#define IDirect3DDevice9_Release(p)
IDirect3DDevice9 * device
DWORD WINAPI GetGlyphOutlineW(HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm, DWORD cbBuffer, LPVOID lpvBuffer, CONST MAT2 *lpmat2)
HRESULT WINAPI D3DXCreateFontIndirectW(IDirect3DDevice9 *device, const D3DXFONT_DESCW *desc, ID3DXFont **font)
HRESULT WINAPI D3DXCreateFontIndirectA(IDirect3DDevice9 *device, const D3DXFONT_DESCA *desc, ID3DXFont **font)
static LPTEXTMETRICW LONG * height
static ULONG WINAPI ID3DXFontImpl_Release(ID3DXFont *iface)
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
static UINT UINT LPINT buffer
#define IDirect3DDevice9_GetDisplayMode(p, a, b)
GLenum GLint GLint * precision
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)
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
#define IDirect3DDevice9_GetDirect3D(p, a)
struct wine_rb_tree glyph_tree
#define ID3DXFont_PreloadGlyphs(p, a, b)
static int compute_rect(struct d3dx_font *font, const WCHAR *string, unsigned int count, WCHAR *line, RECT *rect, DWORD format)
#define WINE_RB_ENTRY_VALUE(element, type, field)
struct wine_rb_entry entry
const char * wine_dbgstr_rect(const RECT *rect)
#define ID3DXSprite_End(p)
struct ID3DXFont ID3DXFont
#define IDirect3DDevice9_AddRef(p)
static struct _test_info results[8]
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
static void wine_rb_destroy(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
static const ID3DXFontVtbl D3DXFont_Vtbl
#define ID3DXSprite_Release(p)
#define InterlockedDecrement
static __inline const char * debugstr_an(const char *s, int n)
#define ID3DXSprite_Begin(p, a)
#define memcpy(s1, s2, n)
static HRESULT WINAPI ID3DXFontImpl_QueryInterface(ID3DXFont *iface, REFIID riid, void **out)
static uint32_t make_pow2(uint32_t num)
#define ID3DXFont_DrawTextW(p, a, b, c, d, e, f)
#define ID3DXFont_PreloadTextW(p, a, b)
GLint GLint GLsizei GLsizei height
WCHAR FaceName[LF_FACESIZE]
IDirect3DTexture9 ** textures
static const WORD INT INT LPINT LPINT LPSIZE size
#define InterlockedIncrement
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
BOOL WINAPI DeleteDC(_In_ HDC)
#define IDirect3DDevice9_CreateTexture(p, a, b, c, d, e, f, g, h)
static HRESULT WINAPI ID3DXFontImpl_PreloadTextW(ID3DXFont *iface, const WCHAR *string, INT count)
static int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
#define FIELD_OFFSET(t, f)
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
GLint GLint GLint GLint GLint GLint y
#define MultiByteToWideChar
static const WCHAR * read_line(HDC hdc, const WCHAR *str, unsigned int *count, WCHAR *dest, unsigned int *dest_len, int width, DWORD format, SIZE *size)
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HRESULT WINAPI D3DXCreateSprite(struct IDirect3DDevice9 *device, struct ID3DXSprite **sprite)
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsA(ID3DXFont *iface, TEXTMETRICA *metrics)
static HRESULT WINAPI ID3DXFontImpl_GetDevice(ID3DXFont *iface, IDirect3DDevice9 **device)
static struct wine_rb_entry * wine_rb_get(const struct wine_rb_tree *tree, const void *key)
#define IDirect3DTexture9_LockRect(p, a, b, c, d)
DWORD WINAPI GetGlyphIndicesW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
static HRESULT WINAPI ID3DXFontImpl_GetGlyphData(ID3DXFont *iface, UINT glyph, IDirect3DTexture9 **texture, RECT *black_box, POINT *cell_inc)
static void word_break(HDC hdc, const WCHAR *str, unsigned int *str_len, unsigned int chars_fit, unsigned int *chars_used, SIZE *size)
unsigned int texture_size
HRESULT WINAPI ScriptBreak(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la)
char * cleanup(char *str)
ID3DXFont ID3DXFont_iface
static HRESULT WINAPI ID3DXFontImpl_PreloadTextA(ID3DXFont *iface, const char *string, INT count)
GLdouble GLdouble GLdouble GLdouble top
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)
static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, ID3DXSprite *sprite, const char *string, INT count, RECT *rect, DWORD format, D3DCOLOR color)
#define ID3DXFont_GetGlyphData(p, a, b, c, d)
unsigned int glyphs_per_texture
static HRESULT WINAPI ID3DXFontImpl_GetDescW(ID3DXFont *iface, D3DXFONT_DESCW *desc)
static struct sockaddr_in sa
static BOOL heap_free(void *mem)
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)
static HRESULT WINAPI ID3DXFontImpl_GetDescA(ID3DXFont *iface, D3DXFONT_DESCA *desc)
DWORD WINAPI GetCharacterPlacementW(HDC hdc, LPCWSTR lpString, INT uCount, INT nMaxExtent, GCP_RESULTSW *lpResults, DWORD dwFlags)