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 struct _test_info results[8]
static struct sockaddr_in sa
static void * heap_alloc(size_t len)
static BOOL heap_free(void *mem)
static void * heap_realloc(void *mem, size_t len)
#define InterlockedIncrement
#define InterlockedDecrement
static const char * wine_dbgstr_rect(const RECT *prc)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
#define D3DXERR_INVALIDDATA
#define IDirect3DTexture9_AddRef(p)
#define IDirect3DDevice9_GetDirect3D(p, a)
#define IDirect3DTexture9_UnlockRect(p, a)
#define IDirect3DDevice9_CreateTexture(p, a, b, c, d, e, f, g, h)
#define IDirect3DDevice9_GetCreationParameters(p, a)
#define IDirect3D9_Release(p)
#define IDirect3DDevice9_Release(p)
#define IDirect3DTexture9_LockRect(p, a, b, c, d)
#define IDirect3D9_CheckDeviceFormat(p, a, b, c, d, e, f)
#define IDirect3DTexture9_Release(p)
#define IDirect3DDevice9_AddRef(p)
#define IDirect3DDevice9_GetDisplayMode(p, a, b)
#define D3DERR_INVALIDCALL
struct ID3DXFont ID3DXFont
static uint32_t make_pow2(uint32_t num)
#define ID3DXSprite_Release(p)
#define ID3DXFont_PreloadTextW(p, a, b)
#define ID3DXSprite_Begin(p, a)
#define ID3DXSprite_Draw(p, a, b, c, d, e)
#define ID3DXFont_GetGlyphData(p, a, b, c, d)
#define ID3DXFont_PreloadGlyphs(p, a, b)
#define ID3DXFont_DrawTextW(p, a, b, c, d, e, f)
#define ID3DXSprite_End(p)
static struct d3dx_font * impl_from_ID3DXFont(ID3DXFont *iface)
static uint32_t morton_decode(uint32_t x)
static HRESULT WINAPI ID3DXFontImpl_OnLostDevice(ID3DXFont *iface)
static ULONG WINAPI ID3DXFontImpl_AddRef(ID3DXFont *iface)
static HRESULT WINAPI ID3DXFontImpl_PreloadCharacters(ID3DXFont *iface, UINT first, UINT last)
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsW(ID3DXFont *iface, TEXTMETRICW *metrics)
static HRESULT WINAPI ID3DXFontImpl_PreloadTextA(ID3DXFont *iface, const char *string, INT count)
static int compute_rect(struct d3dx_font *font, const WCHAR *string, unsigned int count, WCHAR *line, RECT *rect, DWORD format)
static INT WINAPI ID3DXFontImpl_DrawTextA(ID3DXFont *iface, ID3DXSprite *sprite, const char *string, INT count, RECT *rect, DWORD format, D3DCOLOR color)
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 D3DXCreateFontIndirectW(IDirect3DDevice9 *device, const D3DXFONT_DESCW *desc, ID3DXFont **font)
static HRESULT WINAPI ID3DXFontImpl_GetDescW(ID3DXFont *iface, D3DXFONT_DESCW *desc)
static HDC WINAPI ID3DXFontImpl_GetDC(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)
static HRESULT WINAPI ID3DXFontImpl_QueryInterface(ID3DXFont *iface, REFIID riid, void **out)
static HRESULT WINAPI ID3DXFontImpl_GetDescA(ID3DXFont *iface, D3DXFONT_DESCA *desc)
static void word_break(HDC hdc, const WCHAR *str, unsigned int *str_len, unsigned int chars_fit, unsigned int *chars_used, SIZE *size)
static BOOL WINAPI ID3DXFontImpl_GetTextMetricsA(ID3DXFont *iface, TEXTMETRICA *metrics)
HRESULT WINAPI D3DXCreateFontIndirectA(IDirect3DDevice9 *device, const D3DXFONT_DESCA *desc, ID3DXFont **font)
static HRESULT WINAPI ID3DXFontImpl_GetDevice(ID3DXFont *iface, IDirect3DDevice9 **device)
static INT WINAPI ID3DXFontImpl_DrawTextW(ID3DXFont *iface, ID3DXSprite *sprite, const WCHAR *string, INT in_count, RECT *rect, DWORD format, D3DCOLOR color)
static HRESULT WINAPI ID3DXFontImpl_GetGlyphData(ID3DXFont *iface, UINT glyph, IDirect3DTexture9 **texture, RECT *black_box, POINT *cell_inc)
static int glyph_rb_compare(const void *key, const struct wine_rb_entry *entry)
static const ID3DXFontVtbl D3DXFont_Vtbl
static void glyph_rb_free(struct wine_rb_entry *entry, void *context)
static HRESULT WINAPI ID3DXFontImpl_PreloadTextW(ID3DXFont *iface, const WCHAR *string, INT count)
static HRESULT WINAPI ID3DXFontImpl_OnResetDevice(ID3DXFont *iface)
static ULONG WINAPI ID3DXFontImpl_Release(ID3DXFont *iface)
static HRESULT WINAPI ID3DXFontImpl_PreloadGlyphs(ID3DXFont *iface, UINT first, UINT last)
static __inline const char * debugstr_an(const char *s, int n)
#define WideCharToMultiByte
#define MultiByteToWideChar
static void cleanup(void)
HRESULT WINAPI ScriptBreak(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la)
GLint GLint GLint GLint GLint x
GLint GLint GLint GLint GLint GLint y
GLuint GLuint GLsizei count
GLint GLint GLsizei GLsizei height
GLdouble GLdouble GLdouble r
GLint GLint GLsizei width
GLuint GLuint GLsizei GLenum const GLvoid * indices
GLdouble GLdouble GLdouble GLdouble top
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
GLenum GLint GLint * precision
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
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
#define memcpy(s1, s2, n)
static const WCHAR desc[]
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
unsigned __int3264 UINT_PTR
#define IsEqualGUID(rguid1, rguid2)
static void wine_rb_destroy(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
#define WINE_RB_ENTRY_VALUE(element, type, field)
static struct wine_rb_entry * wine_rb_get(const struct wine_rb_tree *tree, const void *key)
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
static int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
HRESULT WINAPI D3DXCreateSprite(struct IDirect3DDevice9 *device, struct ID3DXSprite **sprite)
WCHAR FaceName[LF_FACESIZE]
unsigned int glyphs_per_texture
unsigned int texture_count
ID3DXFont ID3DXFont_iface
IDirect3DTexture9 ** textures
unsigned int texture_size
struct wine_rb_tree glyph_tree
IDirect3DDevice9 * device
IDirect3DTexture9 * texture
struct wine_rb_entry entry
#define FIELD_OFFSET(t, f)
#define CONTAINING_RECORD(address, type, field)
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
DWORD WINAPI GetGlyphIndicesW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
DWORD WINAPI GetCharacterPlacementW(_In_ HDC hdc, _In_reads_(nCount) LPCWSTR lpString, _In_ int nCount, _In_ int nMexExtent, _Inout_ LPGCP_RESULTSW lpResults, _In_ DWORD dwFlags)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HFONT WINAPI CreateFontW(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_ DWORD, _In_opt_ LPCWSTR)
#define CLIP_DEFAULT_PRECIS
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)
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
BOOL WINAPI DeleteDC(_In_ HDC)
DWORD WINAPI GetGlyphOutlineW(_In_ HDC hdc, _In_ UINT uChar, _In_ UINT fuFormat, _Out_ LPGLYPHMETRICS lpgm, _In_ DWORD cjBuffer, _Out_writes_bytes_opt_(cjBuffer) LPVOID pvBuffer, _In_ CONST MAT2 *lpmat2)