ReactOS 0.4.15-dev-7942-gd23573b
core.c
Go to the documentation of this file.
1/*
2 * Tests for the D3DX9 core interfaces
3 *
4 * Copyright 2009 Tony Wasserka
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#define COBJMACROS
22#include "wine/test.h"
23#include <dxerr9.h>
24#include "d3dx9core.h"
25
26static inline int get_ref(IUnknown *obj)
27{
28 IUnknown_AddRef(obj);
29 return IUnknown_Release(obj);
30}
31
32#define check_ref(obj, exp) _check_ref(__LINE__, obj, exp)
33static inline void _check_ref(unsigned int line, IUnknown *obj, int exp)
34{
35 int ref = get_ref(obj);
36 ok_(__FILE__, line)(exp == ref, "Invalid refcount. Expected %d, got %d\n", exp, ref);
37}
38
39#define check_release(obj, exp) _check_release(__LINE__, obj, exp)
40static inline void _check_release(unsigned int line, IUnknown *obj, int exp)
41{
42 int ref = IUnknown_Release(obj);
43 ok_(__FILE__, line)(ref == exp, "Invalid refcount. Expected %d, got %d\n", exp, ref);
44}
45
46#define admitted_error 0.0001f
47static inline void check_mat(D3DXMATRIX got, D3DXMATRIX exp)
48{
49 int i, j, equal=1;
50 for (i=0; i<4; i++)
51 for (j=0; j<4; j++)
52 if (fabs(U(exp).m[i][j]-U(got).m[i][j]) > admitted_error)
53 equal=0;
54
55 ok(equal, "Got matrix\n\t(%f,%f,%f,%f\n\t %f,%f,%f,%f\n\t %f,%f,%f,%f\n\t %f,%f,%f,%f)\n"
56 "Expected matrix=\n\t(%f,%f,%f,%f\n\t %f,%f,%f,%f\n\t %f,%f,%f,%f\n\t %f,%f,%f,%f)\n",
57 U(got).m[0][0],U(got).m[0][1],U(got).m[0][2],U(got).m[0][3],
58 U(got).m[1][0],U(got).m[1][1],U(got).m[1][2],U(got).m[1][3],
59 U(got).m[2][0],U(got).m[2][1],U(got).m[2][2],U(got).m[2][3],
60 U(got).m[3][0],U(got).m[3][1],U(got).m[3][2],U(got).m[3][3],
61 U(exp).m[0][0],U(exp).m[0][1],U(exp).m[0][2],U(exp).m[0][3],
62 U(exp).m[1][0],U(exp).m[1][1],U(exp).m[1][2],U(exp).m[1][3],
63 U(exp).m[2][0],U(exp).m[2][1],U(exp).m[2][2],U(exp).m[2][3],
64 U(exp).m[3][0],U(exp).m[3][1],U(exp).m[3][2],U(exp).m[3][3]);
65}
66
67#define check_rect(rect, left, top, right, bottom) _check_rect(__LINE__, rect, left, top, right, bottom)
68static inline void _check_rect(unsigned int line, const RECT *rect, int left, int top, int right, int bottom)
69{
70 ok_(__FILE__, line)(rect->left == left, "Unexpected rect.left %d\n", rect->left);
71 ok_(__FILE__, line)(rect->top == top, "Unexpected rect.top %d\n", rect->top);
72 ok_(__FILE__, line)(rect->right == right, "Unexpected rect.right %d\n", rect->right);
73 ok_(__FILE__, line)(rect->bottom == bottom, "Unexpected rect.bottom %d\n", rect->bottom);
74}
75
76static void test_ID3DXBuffer(void)
77{
79 HRESULT hr;
81 DWORD size;
82
84 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateBuffer failed, got %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
85
87 ok(hr == D3D_OK, "D3DXCreateBuffer failed, got %#x, expected %#x\n", hr, D3D_OK);
88
90 ok(!size, "GetBufferSize failed, got %u, expected %u\n", size, 0);
91
93 ok(!count, "ID3DXBuffer has %u references left\n", count);
94
96 ok(hr == D3D_OK, "D3DXCreateBuffer failed, got %#x, expected %#x\n", hr, D3D_OK);
97
99 ok(size == 3, "GetBufferSize failed, got %u, expected %u\n", size, 3);
100
102 ok(!count, "ID3DXBuffer has %u references left\n", count);
103}
104
105static void test_ID3DXSprite(IDirect3DDevice9 *device)
106{
107 ID3DXSprite *sprite;
108 IDirect3D9 *d3d;
109 IDirect3DDevice9 *cmpdev;
110 IDirect3DTexture9 *tex1, *tex2;
111 D3DXMATRIX mat, cmpmat;
112 D3DVIEWPORT9 vp;
113 RECT rect;
114 D3DXVECTOR3 pos, center;
115 HRESULT hr;
116
120 ok (hr == D3D_OK, "D3DFMT_A8R8G8B8 not supported\n");
121 if (FAILED(hr)) return;
122
124 ok (hr == D3D_OK, "Failed to create first texture (error code: %#x)\n", hr);
125 if (FAILED(hr)) return;
126
128 ok (hr == D3D_OK, "Failed to create second texture (error code: %#x)\n", hr);
129 if (FAILED(hr)) {
131 return;
132 }
133
134 /* Test D3DXCreateSprite */
136 ok (hr == D3DERR_INVALIDCALL, "D3DXCreateSprite returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
137
139 ok (hr == D3DERR_INVALIDCALL, "D3DXCreateSprite returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
140
142 ok (hr == D3D_OK, "D3DXCreateSprite returned %#x, expected %#x\n", hr, D3D_OK);
143
144
145 /* Test ID3DXSprite_GetDevice */
147 ok (hr == D3DERR_INVALIDCALL, "GetDevice returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
148
149 hr = ID3DXSprite_GetDevice(sprite, &cmpdev); /* cmpdev == NULL */
150 ok (hr == D3D_OK, "GetDevice returned %#x, expected %#x\n", hr, D3D_OK);
151
152 hr = ID3DXSprite_GetDevice(sprite, &cmpdev); /* cmpdev != NULL */
153 ok (hr == D3D_OK, "GetDevice returned %#x, expected %#x\n", hr, D3D_OK);
154
157
158
159 /* Test ID3DXSprite_GetTransform */
161 ok (hr == D3DERR_INVALIDCALL, "GetTransform returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
163 ok (hr == D3D_OK, "GetTransform returned %#x, expected %#x\n", hr, D3D_OK);
164 if(SUCCEEDED(hr)) {
166 D3DXMatrixIdentity(&identity);
168 }
169
170 /* Test ID3DXSprite_SetTransform */
171 /* Set a transform and test if it gets returned correctly */
172 U(mat).m[0][0]=2.1f; U(mat).m[0][1]=6.5f; U(mat).m[0][2]=-9.6f; U(mat).m[0][3]=1.7f;
173 U(mat).m[1][0]=4.2f; U(mat).m[1][1]=-2.5f; U(mat).m[1][2]=2.1f; U(mat).m[1][3]=5.5f;
174 U(mat).m[2][0]=-2.6f; U(mat).m[2][1]=0.3f; U(mat).m[2][2]=8.6f; U(mat).m[2][3]=8.4f;
175 U(mat).m[3][0]=6.7f; U(mat).m[3][1]=-5.1f; U(mat).m[3][2]=6.1f; U(mat).m[3][3]=2.2f;
176
178 ok (hr == D3DERR_INVALIDCALL, "SetTransform returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
179
181 ok (hr == D3D_OK, "SetTransform returned %#x, expected %#x\n", hr, D3D_OK);
182 if(SUCCEEDED(hr)) {
184 if(SUCCEEDED(hr)) check_mat(cmpmat, mat);
185 else skip("GetTransform returned %#x\n", hr);
186 }
187
188 /* Test ID3DXSprite_SetWorldViewLH/RH */
189 todo_wine {
191 ok (hr == D3D_OK, "SetWorldViewLH returned %#x, expected %#x\n", hr, D3D_OK);
193 ok (hr == D3D_OK, "SetWorldViewLH returned %#x, expected %#x\n", hr, D3D_OK);
195 ok (hr == D3D_OK, "SetWorldViewLH returned %#x, expected %#x\n", hr, D3D_OK);
197 ok (hr == D3D_OK, "SetWorldViewLH returned %#x, expected %#x\n", hr, D3D_OK);
198
200 ok (hr == D3D_OK, "SetWorldViewRH returned %#x, expected %#x\n", hr, D3D_OK);
202 ok (hr == D3D_OK, "SetWorldViewRH returned %#x, expected %#x\n", hr, D3D_OK);
204 ok (hr == D3D_OK, "SetWorldViewRH returned %#x, expected %#x\n", hr, D3D_OK);
206 ok (hr == D3D_OK, "SetWorldViewRH returned %#x, expected %#x\n", hr, D3D_OK);
207 }
209
210 /* Test ID3DXSprite_Begin*/
212 ok (hr == D3D_OK, "Begin returned %#x, expected %#x\n", hr, D3D_OK);
213
215 D3DXMatrixIdentity(&cmpmat);
216 check_mat(mat, cmpmat);
217
219 check_mat(mat, cmpmat);
220
223 D3DXMatrixOrthoOffCenterLH(&cmpmat, vp.X+0.5f, (float)vp.Width+vp.X+0.5f, (float)vp.Height+vp.Y+0.5f, vp.Y+0.5f, vp.MinZ, vp.MaxZ);
224 check_mat(mat, cmpmat);
225
226 /* Test ID3DXSprite_Flush and ID3DXSprite_End */
228 ok (hr == D3D_OK, "Flush returned %#x, expected %#x\n", hr, D3D_OK);
229
231 ok (hr == D3D_OK, "End returned %#x, expected %#x\n", hr, D3D_OK);
232
233 hr = ID3DXSprite_Flush(sprite); /* May not be called before next Begin */
234 ok (hr == D3DERR_INVALIDCALL, "Flush returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
236 ok (hr == D3DERR_INVALIDCALL, "End returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
237
238 /* Test ID3DXSprite_Draw */
240 ok (hr == D3D_OK, "Begin returned %#x, expected %#x\n", hr, D3D_OK);
241
242 if(FAILED(hr)) skip("Couldn't ID3DXSprite_Begin, can't test ID3DXSprite_Draw\n");
243 else { /* Feed the sprite batch */
244 int texref1, texref2;
245
246 SetRect(&rect, 53, 12, 142, 165);
247 pos.x = 2.2f; pos.y = 4.5f; pos.z = 5.1f;
248 center.x = 11.3f; center.y = 3.4f; center.z = 1.2f;
249
250 texref1 = get_ref((IUnknown*)tex1);
251 texref2 = get_ref((IUnknown*)tex2);
252
253 hr = ID3DXSprite_Draw(sprite, NULL, &rect, &center, &pos, D3DCOLOR_XRGB(255, 255, 255));
254 ok (hr == D3DERR_INVALIDCALL, "Draw returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
255
256 hr = ID3DXSprite_Draw(sprite, tex1, &rect, &center, &pos, D3DCOLOR_XRGB(255, 255, 255));
257 ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
258 hr = ID3DXSprite_Draw(sprite, tex2, &rect, &center, &pos, D3DCOLOR_XRGB( 3, 45, 66));
259 ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
260 hr = ID3DXSprite_Draw(sprite, tex1, NULL, &center, &pos, D3DCOLOR_XRGB(255, 255, 255));
261 ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
262 hr = ID3DXSprite_Draw(sprite, tex1, &rect, NULL, &pos, D3DCOLOR_XRGB(255, 255, 255));
263 ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
264 hr = ID3DXSprite_Draw(sprite, tex1, &rect, &center, NULL, D3DCOLOR_XRGB(255, 255, 255));
265 ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
266 hr = ID3DXSprite_Draw(sprite, tex1, NULL, NULL, NULL, 0);
267 ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
268
269 check_ref((IUnknown*)tex1, texref1+5); check_ref((IUnknown*)tex2, texref2+1);
271 ok (hr == D3D_OK, "Flush returned %#x, expected %#x\n", hr, D3D_OK);
272 hr = ID3DXSprite_Flush(sprite); /* Flushing twice should work */
273 ok (hr == D3D_OK, "Flush returned %#x, expected %#x\n", hr, D3D_OK);
274 check_ref((IUnknown*)tex1, texref1); check_ref((IUnknown*)tex2, texref2);
275
277 ok (hr == D3D_OK, "End returned %#x, expected %#x\n", hr, D3D_OK);
278 }
279
280 /* Test ID3DXSprite_OnLostDevice and ID3DXSprite_OnResetDevice */
281 /* Both can be called twice */
283 ok (hr == D3D_OK, "OnLostDevice returned %#x, expected %#x\n", hr, D3D_OK);
285 ok (hr == D3D_OK, "OnLostDevice returned %#x, expected %#x\n", hr, D3D_OK);
287 ok (hr == D3D_OK, "OnResetDevice returned %#x, expected %#x\n", hr, D3D_OK);
289 ok (hr == D3D_OK, "OnResetDevice returned %#x, expected %#x\n", hr, D3D_OK);
290
291 /* Make sure everything works like before */
293 ok (hr == D3D_OK, "Begin returned %#x, expected %#x\n", hr, D3D_OK);
294 hr = ID3DXSprite_Draw(sprite, tex2, &rect, &center, &pos, D3DCOLOR_XRGB(255, 255, 255));
295 ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
297 ok (hr == D3D_OK, "Flush returned %#x, expected %#x\n", hr, D3D_OK);
299 ok (hr == D3D_OK, "End returned %#x, expected %#x\n", hr, D3D_OK);
300
301 /* OnResetDevice makes the interface "forget" the Begin call */
303 ok (hr == D3D_OK, "Begin returned %#x, expected %#x\n", hr, D3D_OK);
305 ok (hr == D3D_OK, "OnResetDevice returned %#x, expected %#x\n", hr, D3D_OK);
307 ok (hr == D3DERR_INVALIDCALL, "End returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
308
309 /* Test D3DXSPRITE_DO_NOT_ADDREF_TEXTURE */
311 ok (hr == D3D_OK, "Begin returned %#x, expected %#x\n", hr, D3D_OK);
312 hr = ID3DXSprite_Draw(sprite, tex2, &rect, &center, &pos, D3DCOLOR_XRGB(255, 255, 255));
313 ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
315 ok (hr == D3D_OK, "OnResetDevice returned %#x, expected %#x\n", hr, D3D_OK);
316 check_ref((IUnknown*)tex2, 1);
317
319 ok (hr == D3D_OK, "Begin returned %#x, expected %#x\n", hr, D3D_OK);
320 hr = ID3DXSprite_Draw(sprite, tex2, &rect, &center, &pos, D3DCOLOR_XRGB(255, 255, 255));
321 ok (hr == D3D_OK, "Draw returned %#x, expected %#x\n", hr, D3D_OK);
322
325 check_release((IUnknown*)tex2, 0);
326 check_release((IUnknown*)tex1, 0);
327}
328
329static void test_ID3DXFont(IDirect3DDevice9 *device)
330{
331 static const WCHAR testW[] = L"test";
332 static const char long_text[] = "Example text to test clipping and other related things";
333 static const WCHAR long_textW[] = L"Example text to test clipping and other related things";
334 static const MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
335 static const struct
336 {
337 int font_height;
338 unsigned int expected_size;
339 unsigned int expected_levels;
340 }
341 tests[] =
342 {
343 { 2, 32, 2 },
344 { 6, 128, 4 },
345 { 10, 256, 5 },
346 { 12, 256, 5 },
347 { 72, 256, 8 },
348 { 250, 256, 9 },
349 { 258, 512, 10 },
350 { 512, 512, 10 },
351 };
352 const unsigned int size = ARRAY_SIZE(testW);
353 TEXTMETRICA metrics, expmetrics;
354 IDirect3DTexture9 *texture;
355 D3DSURFACE_DESC surf_desc;
356 IDirect3DDevice9 *bufdev;
357 GLYPHMETRICS glyph_metrics;
359 ID3DXSprite *sprite;
360 RECT rect, blackbox;
362 int ref, i, height;
365 POINT cellinc;
366 HRESULT hr;
367 WORD glyph;
368 BOOL ret;
369 HDC hdc;
370 char c;
371
372 /* D3DXCreateFont */
375 ok(hr == D3D_OK, "D3DXCreateFont returned %#x, expected %#x\n", hr, D3D_OK);
379
381 ok(hr == D3D_OK, "D3DXCreateFont returned %#x, expected %#x\n", hr, D3D_OK);
383
385 ok(hr == D3D_OK, "D3DXCreateFont returned %#x, expected %#x\n", hr, D3D_OK);
387
389 ok(hr == D3D_OK, "D3DXCreateFont returned %#x, expected %#x\n", hr, D3D_OK);
391
393 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFont returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
394
396 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFont returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
397
399 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFont returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
400
401
402 /* D3DXCreateFontIndirect */
403 desc.Height = 12;
404 desc.Width = 0;
405 desc.Weight = FW_DONTCARE;
406 desc.MipLevels = 0;
407 desc.Italic = FALSE;
408 desc.CharSet = DEFAULT_CHARSET;
409 desc.OutputPrecision = OUT_DEFAULT_PRECIS;
410 desc.Quality = DEFAULT_QUALITY;
411 desc.PitchAndFamily = DEFAULT_PITCH;
412 strcpy(desc.FaceName, "Tahoma");
414 ok(hr == D3D_OK, "D3DXCreateFontIndirect returned %#x, expected %#x\n", hr, D3D_OK);
416
418 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFontIndirect returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
419
421 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFontIndirect returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
422
424 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFontIndirect returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
425
426
427 /* ID3DXFont_GetDevice */
429 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
430 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
431
433 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
434
436 hr = ID3DXFont_GetDevice(font, &bufdev);
437 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
438 check_release((IUnknown *)bufdev, ref);
439
441
442
443 /* ID3DXFont_GetDesc */
446 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
447
449 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
450
452 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
453
454 ok(desc.Height == 12, "Got unexpected height %d.\n", desc.Height);
455 ok(desc.Width == 8, "Got unexpected width %u.\n", desc.Width);
456 ok(desc.Weight == FW_BOLD, "Got unexpected weight %u.\n", desc.Weight);
457 ok(desc.MipLevels == 2, "Got unexpected miplevels %u.\n", desc.MipLevels);
458 ok(desc.Italic == TRUE, "Got unexpected italic %#x.\n", desc.Italic);
459 ok(desc.CharSet == ANSI_CHARSET, "Got unexpected charset %u.\n", desc.CharSet);
460 ok(desc.OutputPrecision == OUT_RASTER_PRECIS, "Got unexpected output precision %u.\n", desc.OutputPrecision);
461 ok(desc.Quality == ANTIALIASED_QUALITY, "Got unexpected quality %u.\n", desc.Quality);
462 ok(desc.PitchAndFamily == VARIABLE_PITCH, "Got unexpected pitch and family %#x.\n", desc.PitchAndFamily);
463 ok(!strcmp(desc.FaceName, "Tahoma"), "Got unexpected facename %s.\n", debugstr_a(desc.FaceName));
464
466
467
468 /* ID3DXFont_GetDC + ID3DXFont_GetTextMetrics */
470 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
471 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
472
474 ok(!!hdc, "Got unexpected hdc %p.\n", hdc);
475
477 ok(ret, "Got unexpected ret %#x.\n", ret);
478 ret = GetTextMetricsA(hdc, &expmetrics);
479 ok(ret, "Got unexpected ret %#x.\n", ret);
480
481 ok(metrics.tmHeight == expmetrics.tmHeight, "Got unexpected height %d, expected %d.\n",
482 metrics.tmHeight, expmetrics.tmHeight);
483 ok(metrics.tmAscent == expmetrics.tmAscent, "Got unexpected ascent %d, expected %d.\n",
484 metrics.tmAscent, expmetrics.tmAscent);
485 ok(metrics.tmDescent == expmetrics.tmDescent, "Got unexpected descent %d, expected %d.\n",
486 metrics.tmDescent, expmetrics.tmDescent);
487 ok(metrics.tmInternalLeading == expmetrics.tmInternalLeading, "Got unexpected internal leading %d, expected %d.\n",
488 metrics.tmInternalLeading, expmetrics.tmInternalLeading);
489 ok(metrics.tmExternalLeading == expmetrics.tmExternalLeading, "Got unexpected external leading %d, expected %d.\n",
490 metrics.tmExternalLeading, expmetrics.tmExternalLeading);
491 ok(metrics.tmAveCharWidth == expmetrics.tmAveCharWidth, "Got unexpected average char width %d, expected %d.\n",
492 metrics.tmAveCharWidth, expmetrics.tmAveCharWidth);
493 ok(metrics.tmMaxCharWidth == expmetrics.tmMaxCharWidth, "Got unexpected maximum char width %d, expected %d.\n",
494 metrics.tmMaxCharWidth, expmetrics.tmMaxCharWidth);
495 ok(metrics.tmWeight == expmetrics.tmWeight, "Got unexpected weight %d, expected %d.\n",
496 metrics.tmWeight, expmetrics.tmWeight);
497 ok(metrics.tmOverhang == expmetrics.tmOverhang, "Got unexpected overhang %d, expected %d.\n",
498 metrics.tmOverhang, expmetrics.tmOverhang);
499 ok(metrics.tmDigitizedAspectX == expmetrics.tmDigitizedAspectX, "Got unexpected digitized x aspect %d, expected %d.\n",
500 metrics.tmDigitizedAspectX, expmetrics.tmDigitizedAspectX);
501 ok(metrics.tmDigitizedAspectY == expmetrics.tmDigitizedAspectY, "Got unexpected digitized y aspect %d, expected %d.\n",
502 metrics.tmDigitizedAspectY, expmetrics.tmDigitizedAspectY);
503 ok(metrics.tmFirstChar == expmetrics.tmFirstChar, "Got unexpected first char %u, expected %u.\n",
504 metrics.tmFirstChar, expmetrics.tmFirstChar);
505 ok(metrics.tmLastChar == expmetrics.tmLastChar, "Got unexpected last char %u, expected %u.\n",
506 metrics.tmLastChar, expmetrics.tmLastChar);
507 ok(metrics.tmDefaultChar == expmetrics.tmDefaultChar, "Got unexpected default char %u, expected %u.\n",
508 metrics.tmDefaultChar, expmetrics.tmDefaultChar);
509 ok(metrics.tmBreakChar == expmetrics.tmBreakChar, "Got unexpected break char %u, expected %u.\n",
510 metrics.tmBreakChar, expmetrics.tmBreakChar);
511 ok(metrics.tmItalic == expmetrics.tmItalic, "Got unexpected italic %u, expected %u.\n",
512 metrics.tmItalic, expmetrics.tmItalic);
513 ok(metrics.tmUnderlined == expmetrics.tmUnderlined, "Got unexpected underlined %u, expected %u.\n",
514 metrics.tmUnderlined, expmetrics.tmUnderlined);
515 ok(metrics.tmStruckOut == expmetrics.tmStruckOut, "Got unexpected struck out %u, expected %u.\n",
516 metrics.tmStruckOut, expmetrics.tmStruckOut);
517 ok(metrics.tmPitchAndFamily == expmetrics.tmPitchAndFamily, "Got unexpected pitch and family %u, expected %u.\n",
518 metrics.tmPitchAndFamily, expmetrics.tmPitchAndFamily);
519 ok(metrics.tmCharSet == expmetrics.tmCharSet, "Got unexpected charset %u, expected %u.\n",
520 metrics.tmCharSet, expmetrics.tmCharSet);
521
523
524
525 /* ID3DXFont_PreloadText */
527 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
528 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
529
531 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
533 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
535 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
536 hr = ID3DXFont_PreloadTextA(font, "test", -1);
537 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
539 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
540 hr = ID3DXFont_PreloadTextA(font, "", -1);
541 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
542
544 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
546 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
548 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
550 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
552 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
554 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
555
557
558
559 /* ID3DXFont_GetGlyphData, ID3DXFont_PreloadGlyphs, ID3DXFont_PreloadCharacters */
561 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
562 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
563
565 ok(!!hdc, "Got unexpected hdc %p.\n", hdc);
566
567 hr = ID3DXFont_GetGlyphData(font, 0, NULL, &blackbox, &cellinc);
568 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
569 hr = ID3DXFont_GetGlyphData(font, 0, &texture, NULL, &cellinc);
571 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
572 hr = ID3DXFont_GetGlyphData(font, 0, &texture, &blackbox, NULL);
574 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
575
577 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
579 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
580
582 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
583
584 for (c = 'b'; c <= 'z'; ++c)
585 {
586 count = GetGlyphIndicesA(hdc, &c, 1, &glyph, 0);
587 ok(count != GDI_ERROR, "Got unexpected count %u.\n", count);
588
589 hr = ID3DXFont_GetGlyphData(font, glyph, &texture, &blackbox, &cellinc);
590 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
591
593 todo_wine ok(levels == 5, "Character %c: got unexpected levels %u.\n", c, levels);
594 hr = IDirect3DTexture9_GetLevelDesc(texture, 0, &surf_desc);
595 ok(hr == D3D_OK, "Character %c: got unexpected hr %#x.\n", c, hr);
596 ok(surf_desc.Format == D3DFMT_A8R8G8B8, "Character %c: got unexpected format %#x.\n", c, surf_desc.Format);
597 ok(surf_desc.Usage == 0, "Character %c: got unexpected usage %#x.\n", c, surf_desc.Usage);
598 ok(surf_desc.Width == 256, "Character %c: got unexpected width %u.\n", c, surf_desc.Width);
599 ok(surf_desc.Height == 256, "Character %c: got unexpected height %u.\n", c, surf_desc.Height);
600 ok(surf_desc.Pool == D3DPOOL_MANAGED, "Character %c: got unexpected pool %u.\n", c, surf_desc.Pool);
601
602 count = GetGlyphOutlineW(hdc, glyph, GGO_GLYPH_INDEX | GGO_METRICS, &glyph_metrics, 0, NULL, &mat);
603 ok(count != GDI_ERROR, "Got unexpected count %#x.\n", count);
604
606 ok(ret, "Got unexpected ret %#x.\n", ret);
607
608 todo_wine ok(blackbox.right - blackbox.left == glyph_metrics.gmBlackBoxX + 2, "Character %c: got %d, expected %d.\n",
609 c, blackbox.right - blackbox.left, glyph_metrics.gmBlackBoxX + 2);
610 todo_wine ok(blackbox.bottom - blackbox.top == glyph_metrics.gmBlackBoxY + 2, "Character %c: got %d, expected %d.\n",
611 c, blackbox.bottom - blackbox.top, glyph_metrics.gmBlackBoxY + 2);
612 ok(cellinc.x == glyph_metrics.gmptGlyphOrigin.x - 1, "Character %c: got %d, expected %d.\n",
613 c, cellinc.x, glyph_metrics.gmptGlyphOrigin.x - 1);
614 ok(cellinc.y == tm.tmAscent - glyph_metrics.gmptGlyphOrigin.y - 1, "Character %c: got %d, expected %d.\n",
615 c, cellinc.y, tm.tmAscent - glyph_metrics.gmptGlyphOrigin.y - 1);
616
618 }
619
621 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
622
623 /* Test multiple textures */
624 hr = ID3DXFont_PreloadGlyphs(font, 0, 1000);
625 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
626
627 /* Test glyphs that are not rendered */
628 for (glyph = 1; glyph < 4; ++glyph)
629 {
630 texture = (IDirect3DTexture9 *)0xdeadbeef;
631 hr = ID3DXFont_GetGlyphData(font, glyph, &texture, &blackbox, &cellinc);
632 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
633 ok(!texture, "Got unexpected texture %p.\n", texture);
634 }
635
637
638 c = 'a';
639 for (i = 0; i < ARRAY_SIZE(tests); ++i)
640 {
643 ok(hr == D3D_OK, "Test %u: got unexpected hr %#x.\n", i, hr);
644
646 ok(!!hdc, "Test %u: got unexpected hdc %p.\n", i, hdc);
647
648 count = GetGlyphIndicesA(hdc, &c, 1, &glyph, 0);
649 ok(count != GDI_ERROR, "Test %u: got unexpected count %u.\n", i, count);
650
652 ok(hr == D3D_OK, "Test %u: got unexpected hr %#x.\n", i, hr);
653
655 todo_wine_if(tests[i].expected_levels < 9)
656 ok(levels == tests[i].expected_levels, "Test %u: got unexpected levels %u.\n", i, levels);
657
658 hr = IDirect3DTexture9_GetLevelDesc(texture, 0, &surf_desc);
659 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
660 ok(surf_desc.Format == D3DFMT_A8R8G8B8, "Test %u: got unexpected format %#x.\n", i, surf_desc.Format);
661 ok(surf_desc.Usage == 0, "Test %u: got unexpected usage %#x.\n", i, surf_desc.Usage);
662 ok(surf_desc.Width == tests[i].expected_size, "Test %u: got unexpected width %u.\n", i, surf_desc.Width);
663 ok(surf_desc.Height == tests[i].expected_size, "Test %u: got unexpected height %u.\n", i, surf_desc.Height);
664 ok(surf_desc.Pool == D3DPOOL_MANAGED, "Test %u: got unexpected pool %u.\n", i, surf_desc.Pool);
665
667
668 /* ID3DXFontImpl_DrawText */
670 SetRect(&rect, 0, 0, 640, 480);
671
672 IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
673
676 ok (hr == D3D_OK, "Test %d: got unexpected hr %#x.\n", i, hr);
677
678 height = ID3DXFont_DrawTextW(font, sprite, testW, -1, &rect, DT_TOP, 0xffffffff);
679 ok(height == tests[i].font_height, "Test %d: got unexpected height %u.\n", i, height);
681 ok(height == tests[i].font_height, "Test %d: got unexpected height %u.\n", i, height);
683 ok(height == tests[i].font_height, "Test %d: got unexpected height %u.\n", i, height);
685 ok(height == tests[i].font_height, "Test %d: got unexpected height %u.\n", i, height);
686
689 DT_LEFT | DT_CALCRECT, 0xffffffff);
690 ok(height == tests[i].font_height, "Test %d: got unexpected height %u.\n", i, height);
691 ok(!rect.left, "Test %d: got unexpected rect left %d.\n", i, rect.left);
692 ok(!rect.top, "Test %d: got unexpected rect top %d.\n", i, rect.top);
693 ok(rect.right, "Test %d: got unexpected rect right %d.\n", i, rect.right);
694 ok(rect.bottom == tests[i].font_height, "Test %d: got unexpected rect bottom %d.\n", i, rect.bottom);
695
697 ok (hr == D3D_OK, "Test %d: got unexpected hr %#x.\n", i, hr);
700
702 }
703
704
705 /* ID3DXFont_DrawTextA, ID3DXFont_DrawTextW */
707 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
708 ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
709
710 SetRect(&rect, 10, 10, 200, 200);
711
712 height = ID3DXFont_DrawTextA(font, NULL, "test", -2, &rect, 0, 0xFF00FF);
713 ok(height == 12, "Got unexpected height %d.\n", height);
714
715 height = ID3DXFont_DrawTextA(font, NULL, "test", -1, &rect, 0, 0xFF00FF);
716 ok(height == 12, "Got unexpected height %d.\n", height);
717
718 height = ID3DXFont_DrawTextA(font, NULL, "test", 0, &rect, 0, 0xFF00FF);
719 ok(height == 0, "Got unexpected height %d.\n", height);
720
721 height = ID3DXFont_DrawTextA(font, NULL, "test", 1, &rect, 0, 0xFF00FF);
722 ok(height == 12, "Got unexpected height %d.\n", height);
723
724 height = ID3DXFont_DrawTextA(font, NULL, "test", 2, &rect, 0, 0xFF00FF);
725 ok(height == 12, "Got unexpected height %d.\n", height);
726
727 height = ID3DXFont_DrawTextA(font, NULL, "", 0, &rect, 0, 0xff00ff);
728 ok(height == 0, "Got unexpected height %d.\n", height);
729
730 height = ID3DXFont_DrawTextA(font, NULL, "", -1, &rect, 0, 0xff00ff);
731 ok(height == 0, "Got unexpected height %d.\n", height);
732
733 height = ID3DXFont_DrawTextA(font, NULL, "test", -1, NULL, 0, 0xFF00FF);
734 ok(height == 12, "Got unexpected height %d.\n", height);
735
736 height = ID3DXFont_DrawTextA(font, NULL, "test", -1, NULL, DT_CALCRECT, 0xFF00FF);
737 ok(height == 12, "Got unexpected height %d.\n", height);
738
739 height = ID3DXFont_DrawTextA(font, NULL, NULL, -1, NULL, 0, 0xFF00FF);
740 ok(height == 0, "Got unexpected height %d.\n", height);
741
742 SetRect(&rect, 10, 10, 50, 50);
743
744 height = ID3DXFont_DrawTextA(font, NULL, long_text, -1, &rect, DT_WORDBREAK, 0xff00ff);
745 todo_wine ok(height == 60, "Got unexpected height %d.\n", height);
746
747 height = ID3DXFont_DrawTextA(font, NULL, long_text, -1, &rect, DT_WORDBREAK | DT_NOCLIP, 0xff00ff);
748 ok(height == 96, "Got unexpected height %d.\n", height);
749
750 SetRect(&rect, 10, 10, 200, 200);
751
752 height = ID3DXFont_DrawTextW(font, NULL, testW, -1, &rect, 0, 0xFF00FF);
753 ok(height == 12, "Got unexpected height %d.\n", height);
754
755 height = ID3DXFont_DrawTextW(font, NULL, testW, 0, &rect, 0, 0xFF00FF);
756 ok(height == 0, "Got unexpected height %d.\n", height);
757
758 height = ID3DXFont_DrawTextW(font, NULL, testW, 1, &rect, 0, 0xFF00FF);
759 ok(height == 12, "Got unexpected height %d.\n", height);
760
761 height = ID3DXFont_DrawTextW(font, NULL, testW, 2, &rect, 0, 0xFF00FF);
762 ok(height == 12, "Got unexpected height %d.\n", height);
763
764 height = ID3DXFont_DrawTextW(font, NULL, L"", 0, &rect, 0, 0xff00ff);
765 ok(height == 0, "Got unexpected height %d.\n", height);
766
767 height = ID3DXFont_DrawTextW(font, NULL, L"", -1, &rect, 0, 0xff00ff);
768 ok(height == 0, "Got unexpected height %d.\n", height);
769
770 height = ID3DXFont_DrawTextW(font, NULL, testW, -1, NULL, 0, 0xFF00FF);
771 ok(height == 12, "Got unexpected height %d.\n", height);
772
774 ok(height == 12, "Got unexpected height %d.\n", height);
775
776 height = ID3DXFont_DrawTextW(font, NULL, NULL, -1, NULL, 0, 0xFF00FF);
777 ok(height == 0, "Got unexpected height %d.\n", height);
778
779 SetRect(&rect, 10, 10, 50, 50);
780
781 height = ID3DXFont_DrawTextW(font, NULL, long_textW, -1, &rect, DT_WORDBREAK, 0xff00ff);
782 todo_wine ok(height == 60, "Got unexpected height %d.\n", height);
783
784 height = ID3DXFont_DrawTextW(font, NULL, long_textW, -1, &rect, DT_WORDBREAK | DT_NOCLIP, 0xff00ff);
785 ok(height == 96, "Got unexpected height %d.\n", height);
786
787 height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, NULL, 0, 0xff00ff);
788 ok(height == 24, "Got unexpected height %d.\n", height);
789
790 height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, 0, 0xff00ff);
791 ok(height == 24, "Got unexpected height %d.\n", height);
792
793 height = ID3DXFont_DrawTextW(font, NULL, L"a\r\na", -1, &rect, 0, 0xff00ff);
794 ok(height == 24, "Got unexpected height %d.\n", height);
795
796 height = ID3DXFont_DrawTextW(font, NULL, L"a\ra", -1, &rect, 0, 0xff00ff);
797 ok(height == 12, "Got unexpected height %d.\n", height);
798
799 height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, DT_SINGLELINE, 0xff00ff);
800 ok(height == 12, "Got unexpected height %d.\n", height);
801
802 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_SINGLELINE, 0xff00ff);
803 ok(height == 12, "Got unexpected height %d.\n", height);
804
805 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, 0, 0xff00ff);
806 ok(height == 24, "Got unexpected height %d.\n", height);
807
808 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
809 ok(height == 36, "Got unexpected height %d.\n", height);
810
811 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_WORDBREAK | DT_SINGLELINE, 0xff00ff);
812 ok(height == 12, "Got unexpected height %d.\n", height);
813
814 height = ID3DXFont_DrawTextW(font, NULL, L"1\n2\n3\n4\n5\n6", -1, &rect, 0, 0xff00ff);
815 ok(height == 48, "Got unexpected height %d.\n", height);
816
817 height = ID3DXFont_DrawTextW(font, NULL, L"1\n2\n3\n4\n5\n6", -1, &rect, DT_NOCLIP, 0xff00ff);
818 ok(height == 72, "Got unexpected height %d.\n", height);
819
820 height = ID3DXFont_DrawTextW(font, NULL, L"\t\t\t\t\t\t\t\t\t\t", -1, &rect, DT_WORDBREAK, 0xff00ff);
821 todo_wine ok(height == 0, "Got unexpected height %d.\n", height);
822
823 height = ID3DXFont_DrawTextW(font, NULL, L"\t\t\t\t\t\t\t\t\t\ta", -1, &rect, DT_WORDBREAK, 0xff00ff);
824 todo_wine ok(height == 12, "Got unexpected height %d.\n", height);
825
826 height = ID3DXFont_DrawTextW(font, NULL, L"\taaaaaaaaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
827 todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
828
829 height = ID3DXFont_DrawTextW(font, NULL, L"\taaaaaaaaaa", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
830 ok(height == 36, "Got unexpected height %d.\n", height);
831
832 height = ID3DXFont_DrawTextW(font, NULL, L"\taaa\taaa\taaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
833 ok(height == 24, "Got unexpected height %d.\n", height);
834
835 height = ID3DXFont_DrawTextW(font, NULL, L"\taaa\taaa\taaa", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
836 todo_wine ok(height == 48, "Got unexpected height %d.\n", height);
837
838 height = ID3DXFont_DrawTextW(font, NULL, L"\t\t\t\t\t\t\t\t\t\t", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
839 todo_wine ok(height == 60, "Got unexpected height %d.\n", height);
840
841 height = ID3DXFont_DrawTextW(font, NULL, L"a\ta", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
842 ok(height == 12, "Got unexpected height %d.\n", height);
843
844 height = ID3DXFont_DrawTextW(font, NULL, L"a\ta\ta", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
845 todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
846
847 height = ID3DXFont_DrawTextW(font, NULL, L"aaaaaaaaaaaaaaaaaaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
848 ok(height == 36, "Got unexpected height %d.\n", height);
849
850 height = ID3DXFont_DrawTextW(font, NULL, L"a a", -1, &rect, DT_WORDBREAK, 0xff00ff);
851 ok(height == 36, "Got unexpected height %d.\n", height);
852
853 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
854 ok(height == 36, "Got unexpected height %d.\n", height);
855
856 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_RIGHT, 0xff00ff);
857 ok(height == 36, "Got unexpected height %d.\n", height);
858
859 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CENTER, 0xff00ff);
860 ok(height == 36, "Got unexpected height %d.\n", height);
861
862 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM, 0xff00ff);
863 ok(height == 40, "Got unexpected height %d.\n", height);
864
865 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER, 0xff00ff);
866 ok(height == 32, "Got unexpected height %d.\n", height);
867
868 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT, 0xff00ff);
869 ok(height == 24, "Got unexpected height %d.\n", height);
870
871 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER, 0xff00ff);
872 ok(height == 24, "Got unexpected height %d.\n", height);
873
874 SetRect(&rect, 10, 10, 50, 50);
875 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
876 ok(height == 24, "Got unexpected height %d.\n", height);
877 check_rect(&rect, 10, 10, 30, 34);
878
879 SetRect(&rect, -10, 10, 30, 50);
880 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
881 ok(height == 24, "Got unexpected height %d.\n", height);
882 check_rect(&rect, -10, 10, 10, 34);
883
884 SetRect(&rect, 10, -10, 50, 30);
885 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
886 ok(height == 24, "Got unexpected height %d.\n", height);
887 check_rect(&rect, 10, -10, 30, 14);
888
889 SetRect(&rect, 10, 10, -30, 50);
890 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
891 ok(height == 24, "Got unexpected height %d.\n", height);
892 check_rect(&rect, 10, 10, 30, 34);
893
894 SetRect(&rect, 10, 10, 50, -30);
895 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
896 ok(height == 24, "Got unexpected height %d.\n", height);
897 check_rect(&rect, 10, 10, 30, 34);
898
899 SetRect(&rect, 10, 10, 50, 50);
900 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
901 ok(height == 24, "Got unexpected height %d.\n", height);
902 check_rect(&rect, 10, 10, 30, 34);
903
904 SetRect(&rect, -10, 10, 30, 50);
905 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
906 ok(height == 24, "Got unexpected height %d.\n", height);
907 check_rect(&rect, -10, 10, 10, 34);
908
909 SetRect(&rect, 10, -10, 50, 30);
910 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
911 ok(height == 24, "Got unexpected height %d.\n", height);
912 check_rect(&rect, 10, -10, 30, 14);
913
914 SetRect(&rect, 10, 10, -30, 50);
915 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
916 ok(height == 12, "Got unexpected height %d.\n", height);
917 check_rect(&rect, 10, 10, 53, 22);
918
919 SetRect(&rect, 10, 10, 50, -30);
920 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
921 ok(height == 24, "Got unexpected height %d.\n", height);
922 check_rect(&rect, 10, 10, 30, 34);
923
924 SetRect(&rect, 10, 10, 50, 50);
925 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
926 ok(height == 40, "Got unexpected height %d.\n", height);
927 check_rect(&rect, 10, 26, 30, 50);
928
929 SetRect(&rect, -10, 10, 30, 50);
930 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
931 ok(height == 40, "Got unexpected height %d.\n", height);
932 check_rect(&rect, -10, 26, 10, 50);
933
934 SetRect(&rect, 10, -10, 50, 30);
935 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
936 ok(height == 40, "Got unexpected height %d.\n", height);
937 check_rect(&rect, 10, 6, 30, 30);
938
939 SetRect(&rect, 10, 10, -30, 50);
940 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
941 ok(height == 40, "Got unexpected height %d.\n", height);
942 check_rect(&rect, 10, 26, 30, 50);
943
944 SetRect(&rect, 10, 10, 50, -30);
945 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
946 ok(height == -40, "Got unexpected height %d.\n", height);
947 check_rect(&rect, 10, -54, 30, -30);
948
949 SetRect(&rect, 10, 10, 50, 50);
950 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
951 ok(height == 40, "Got unexpected height %d.\n", height);
952 check_rect(&rect, 10, 26, 30, 50);
953
954 SetRect(&rect, -10, 10, 30, 50);
955 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
956 ok(height == 40, "Got unexpected height %d.\n", height);
957 check_rect(&rect, -10, 26, 10, 50);
958
959 SetRect(&rect, 10, -10, 50, 30);
960 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
961 ok(height == 40, "Got unexpected height %d.\n", height);
962 check_rect(&rect, 10, 6, 30, 30);
963
964 SetRect(&rect, 10, 10, -30, 50);
965 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
966 ok(height == 40, "Got unexpected height %d.\n", height);
967 check_rect(&rect, 10, 38, 53, 50);
968
969 SetRect(&rect, 10, 10, 50, -30);
970 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
971 ok(height == -40, "Got unexpected height %d.\n", height);
972 check_rect(&rect, 10, -54, 30, -30);
973
974 SetRect(&rect, 10, 10, 50, 50);
975 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
976 ok(height == 32, "Got unexpected height %d.\n", height);
977 check_rect(&rect, 10, 18, 30, 42);
978
979 SetRect(&rect, -10, 10, 30, 50);
980 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
981 ok(height == 32, "Got unexpected height %d.\n", height);
982 check_rect(&rect, -10, 18, 10, 42);
983
984 SetRect(&rect, 10, -10, 50, 30);
985 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
986 ok(height == 32, "Got unexpected height %d.\n", height);
987 check_rect(&rect, 10, -2, 30, 22);
988
989 SetRect(&rect, 10, 10, -30, 50);
990 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
991 ok(height == 32, "Got unexpected height %d.\n", height);
992 check_rect(&rect, 10, 18, 30, 42);
993
994 SetRect(&rect, 10, 10, 50, -30);
995 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
996 ok(height == -8, "Got unexpected height %d.\n", height);
997 check_rect(&rect, 10, -22, 30, 2);
998
999 SetRect(&rect, 10, 10, 50, 50);
1000 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1001 ok(height == 32, "Got unexpected height %d.\n", height);
1002 check_rect(&rect, 10, 18, 30, 42);
1003
1004 SetRect(&rect, -10, 10, 30, 50);
1005 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1006 ok(height == 32, "Got unexpected height %d.\n", height);
1007 check_rect(&rect, -10, 18, 10, 42);
1008
1009 SetRect(&rect, 10, -10, 50, 30);
1010 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1011 ok(height == 32, "Got unexpected height %d.\n", height);
1012 check_rect(&rect, 10, -2, 30, 22);
1013
1014 SetRect(&rect, 10, 10, -30, 50);
1015 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1016 ok(height == 26, "Got unexpected height %d.\n", height);
1017 check_rect(&rect, 10, 24, 53, 36);
1018
1019 SetRect(&rect, 10, 10, 50, -30);
1020 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1021 ok(height == -8, "Got unexpected height %d.\n", height);
1022 check_rect(&rect, 10, -22, 30, 2);
1023
1024 SetRect(&rect, 10, 10, 50, 50);
1025 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1026 ok(height == 24, "Got unexpected height %d.\n", height);
1027 check_rect(&rect, 30, 10, 50, 34);
1028
1029 SetRect(&rect, -10, 10, 30, 50);
1030 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1031 ok(height == 24, "Got unexpected height %d.\n", height);
1032 check_rect(&rect, 10, 10, 30, 34);
1033
1034 SetRect(&rect, 10, -10, 50, 30);
1035 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1036 ok(height == 24, "Got unexpected height %d.\n", height);
1037 check_rect(&rect, 30, -10, 50, 14);
1038
1039 SetRect(&rect, 10, 10, -30, 50);
1040 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1041 ok(height == 24, "Got unexpected height %d.\n", height);
1042 check_rect(&rect, -50, 10, -30, 34);
1043
1044 SetRect(&rect, 10, 10, 50, -30);
1045 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1046 ok(height == 24, "Got unexpected height %d.\n", height);
1047 check_rect(&rect, 30, 10, 50, 34);
1048
1049 SetRect(&rect, 10, 10, 50, 50);
1050 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1051 ok(height == 24, "Got unexpected height %d.\n", height);
1052 check_rect(&rect, 30, 10, 50, 34);
1053
1054 SetRect(&rect, -10, 10, 30, 50);
1055 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1056 ok(height == 24, "Got unexpected height %d.\n", height);
1057 check_rect(&rect, 10, 10, 30, 34);
1058
1059 SetRect(&rect, 10, -10, 50, 30);
1060 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1061 ok(height == 24, "Got unexpected height %d.\n", height);
1062 check_rect(&rect, 30, -10, 50, 14);
1063
1064 SetRect(&rect, 10, 10, -30, 50);
1065 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1066 ok(height == 12, "Got unexpected height %d.\n", height);
1067 check_rect(&rect, -73, 10, -30, 22);
1068
1069 SetRect(&rect, 10, 10, 50, -30);
1070 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1071 ok(height == 24, "Got unexpected height %d.\n", height);
1072 check_rect(&rect, 30, 10, 50, 34);
1073
1074 SetRect(&rect, 10, 10, 50, 50);
1075 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1076 ok(height == 24, "Got unexpected height %d.\n", height);
1077 check_rect(&rect, 20, 10, 40, 34);
1078
1079 SetRect(&rect, -10, 10, 30, 50);
1080 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1081 ok(height == 24, "Got unexpected height %d.\n", height);
1082 check_rect(&rect, 0, 10, 20, 34);
1083
1084 SetRect(&rect, 10, -10, 50, 30);
1085 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1086 ok(height == 24, "Got unexpected height %d.\n", height);
1087 check_rect(&rect, 20, -10, 40, 14);
1088
1089 SetRect(&rect, 10, 10, -30, 50);
1090 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1091 ok(height == 24, "Got unexpected height %d.\n", height);
1092 check_rect(&rect, -20, 10, 0, 34);
1093
1094 SetRect(&rect, 10, 10, 50, -30);
1095 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1096 ok(height == 24, "Got unexpected height %d.\n", height);
1097 check_rect(&rect, 20, 10, 40, 34);
1098
1099 SetRect(&rect, 10, 10, 50, 50);
1100 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1101 ok(height == 24, "Got unexpected height %d.\n", height);
1102 check_rect(&rect, 20, 10, 40, 34);
1103
1104 SetRect(&rect, -10, 10, 30, 50);
1105 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1106 ok(height == 24, "Got unexpected height %d.\n", height);
1107 check_rect(&rect, 0, 10, 20, 34);
1108
1109 SetRect(&rect, 10, -10, 50, 30);
1110 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1111 ok(height == 24, "Got unexpected height %d.\n", height);
1112 check_rect(&rect, 20, -10, 40, 14);
1113
1114 SetRect(&rect, 10, 10, -30, 50);
1115 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1116 ok(height == 12, "Got unexpected height %d.\n", height);
1117 check_rect(&rect, -31, 10, 12, 22);
1118
1119 SetRect(&rect, 10, 10, 50, -30);
1120 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1121 ok(height == 24, "Got unexpected height %d.\n", height);
1122 check_rect(&rect, 20, 10, 40, 34);
1123
1124 SetRect(&rect, 10, 10, 50, 50);
1125 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1126 ok(height == 32, "Got unexpected height %d.\n", height);
1127 check_rect(&rect, 20, 18, 40, 42);
1128
1129 SetRect(&rect, 10, 10, 50, 50);
1130 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1131 ok(height == 32, "Got unexpected height %d.\n", height);
1132 check_rect(&rect, 20, 18, 40, 42);
1133
1134 SetRect(&rect, -10, 10, 30, 50);
1135 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1136 ok(height == 32, "Got unexpected height %d.\n", height);
1137 check_rect(&rect, 0, 18, 20, 42);
1138
1139 SetRect(&rect, 10, -10, 50, 30);
1140 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1141 ok(height == 32, "Got unexpected height %d.\n", height);
1142 check_rect(&rect, 20, -2, 40, 22);
1143
1144 SetRect(&rect, 10, 10, -30, 50);
1145 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1146 ok(height == 32, "Got unexpected height %d.\n", height);
1147 check_rect(&rect, -20, 18, 0, 42);
1148
1149 SetRect(&rect, 10, 10, 50, -30);
1150 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1151 ok(height == -8, "Got unexpected height %d.\n", height);
1152 check_rect(&rect, 20, -22, 40, 2);
1153
1154 SetRect(&rect, 10, 10, 50, 50);
1155 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1156 ok(height == 32, "Got unexpected height %d.\n", height);
1157 check_rect(&rect, 20, 18, 40, 42);
1158
1159 SetRect(&rect, 10, 10, 50, 50);
1160 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1161 ok(height == 32, "Got unexpected height %d.\n", height);
1162 check_rect(&rect, 20, 18, 40, 42);
1163
1164 SetRect(&rect, -10, 10, 30, 50);
1165 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1166 ok(height == 32, "Got unexpected height %d.\n", height);
1167 check_rect(&rect, 0, 18, 20, 42);
1168
1169 SetRect(&rect, 10, -10, 50, 30);
1170 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1171 ok(height == 32, "Got unexpected height %d.\n", height);
1172 check_rect(&rect, 20, -2, 40, 22);
1173
1174 SetRect(&rect, 10, 10, -30, 50);
1175 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1176 ok(height == 26, "Got unexpected height %d.\n", height);
1177 check_rect(&rect, -31, 24, 12, 36);
1178
1179 SetRect(&rect, 10, 10, 50, -30);
1180 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1181 ok(height == -8, "Got unexpected height %d.\n", height);
1182 check_rect(&rect, 20, -22, 40, 2);
1183
1185}
1186
1187static void test_D3DXCreateRenderToSurface(IDirect3DDevice9 *device)
1188{
1189 int i;
1190 HRESULT hr;
1191 ULONG ref_count;
1193 ID3DXRenderToSurface *render = (void *)0xdeadbeef;
1194 static const D3DXRTS_DESC tests[] =
1195 {
1196 { 0, 256, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN },
1197 { 256, 0, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN },
1198 { 256, 0, D3DFMT_A8R8G8B8, FALSE, D3DFMT_D24S8 },
1199 { 256, 256, D3DFMT_UNKNOWN, FALSE, D3DFMT_R8G8B8 },
1201 { -1, -1, MAKEFOURCC('B','A','D','F'), TRUE, MAKEFOURCC('B','A','D','F') }
1202 };
1203
1205 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1206 ok(render == (void *)0xdeadbeef, "Got %p, expected %p\n", render, (void *)0xdeadbeef);
1207
1209 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1210
1211 for (i = 0; i < ARRAY_SIZE(tests); i++)
1212 {
1214 tests[i].DepthStencilFormat, &render);
1215 ok(hr == D3D_OK, "%d: D3DXCreateRenderToSurface returned %#x, expected %#x\n", i, hr, D3D_OK);
1216 if (SUCCEEDED(hr))
1217 {
1219 ok(hr == D3D_OK, "%d: GetDesc failed %#x\n", i, hr);
1220 if (SUCCEEDED(hr))
1221 {
1222 ok(desc.Width == tests[i].Width, "%d: Got width %u, expected %u\n", i, desc.Width, tests[i].Width);
1223 ok(desc.Height == tests[i].Height, "%d: Got height %u, expected %u\n", i, desc.Height, tests[i].Height);
1224 ok(desc.Format == tests[i].Format, "%d: Got format %#x, expected %#x\n", i, desc.Format, tests[i].Format);
1225 ok(desc.DepthStencil == tests[i].DepthStencil, "%d: Got depth stencil %d, expected %d\n",
1226 i, desc.DepthStencil, tests[i].DepthStencil);
1227 ok(desc.DepthStencilFormat == tests[i].DepthStencilFormat, "%d: Got depth stencil format %#x, expected %#x\n",
1228 i, desc.DepthStencilFormat, tests[i].DepthStencilFormat);
1229 }
1231 }
1232 }
1233
1234 /* check device ref count */
1235 ref_count = get_ref((IUnknown *)device);
1237 check_ref((IUnknown *)device, ref_count + 1);
1239}
1240
1241/* runs a set of tests for the ID3DXRenderToSurface interface created with given parameters */
1243 BOOL depth_stencil, D3DFORMAT depth_stencil_format, BOOL render_target)
1244{
1245 HRESULT hr;
1246 D3DFORMAT fmt;
1247 HRESULT expected_value;
1248 IDirect3DSurface9 *surface;
1249 ID3DXRenderToSurface *render;
1250 D3DVIEWPORT9 viewport = { 0, 0, width, height, 0.0, 1.0 };
1251
1252 hr = D3DXCreateRenderToSurface(device, width, height, format, depth_stencil, depth_stencil_format, &render);
1253 if (FAILED(hr))
1254 {
1255 skip("Failed to create ID3DXRenderToSurface\n");
1256 return;
1257 }
1258
1259 if (render_target)
1261 else
1263 if (FAILED(hr))
1264 {
1265 skip("Failed to create surface\n");
1267 return;
1268 }
1269
1270 /* viewport */
1271 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1272 ok(hr == D3D_OK, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3D_OK);
1273 check_ref((IUnknown *)surface, 2);
1275
1276 /* invalid viewport */
1277 viewport.Width = 2 * width;
1278 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1279 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1280
1281 viewport.X = width / 2;
1282 viewport.Width = width;
1283 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1284 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1285
1286 viewport.X = width;
1287 viewport.Width = width;
1288 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1289 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1290
1291 /* rendering to a part of a surface is only allowed for render target surfaces */
1292 expected_value = render_target ? D3D_OK : D3DERR_INVALIDCALL;
1293
1294 viewport.X = 0;
1295 viewport.Width = width / 2;
1296 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1297 ok(hr == expected_value, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, expected_value);
1299
1300 viewport.X = width / 2;
1301 viewport.Width = width - width / 2;
1302 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1303 ok(hr == expected_value, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, expected_value);
1305
1306 check_release((IUnknown *)surface, 0);
1307
1308 /* surfaces with different sizes */
1310 if (FAILED(hr))
1311 {
1312 skip("Failed to create surface\n");
1314 return;
1315 }
1317 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1318 check_release((IUnknown *)surface, 0);
1319
1321 if (FAILED(hr))
1322 {
1323 skip("Failed to create surface\n");
1325 return;
1326 }
1328 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1329 viewport.X = 0;
1330 viewport.Y = 0;
1331 viewport.Width = width;
1332 viewport.Height = height;
1333 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1334 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1335 check_release((IUnknown *)surface, 0);
1336
1337 /* surfaces with different formats */
1339 {
1341
1343 if (FAILED(hr))
1344 {
1345 skip("Failed to create surface\n");
1346 continue;
1347 }
1348
1350 ok(hr == expected_result, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, expected_result);
1351
1353 check_release((IUnknown *)surface, 0);
1354 }
1355
1357}
1358
1359struct device_state
1360{
1361 IDirect3DSurface9 *render_target;
1362 IDirect3DSurface9 *depth_stencil;
1364};
1365
1367{
1368 if (state->render_target) IDirect3DSurface9_Release(state->render_target);
1369 if (state->depth_stencil) IDirect3DSurface9_Release(state->depth_stencil);
1370 memset(state, 0, sizeof(*state));
1371}
1372
1373static HRESULT retrieve_device_state(IDirect3DDevice9 *device, struct device_state *state)
1374{
1375 HRESULT hr;
1376
1377 memset(state, 0, sizeof(*state));
1378
1379 hr = IDirect3DDevice9_GetRenderTarget(device, 0, &state->render_target);
1380 if (FAILED(hr)) goto cleanup;
1381
1383 if (hr == D3DERR_NOTFOUND)
1384 state->depth_stencil = NULL;
1385 else if (FAILED(hr))
1386 goto cleanup;
1387
1389 if (SUCCEEDED(hr)) return hr;
1390
1391cleanup:
1393 return hr;
1394}
1395
1396static HRESULT apply_device_state(IDirect3DDevice9 *device, struct device_state *state)
1397{
1398 HRESULT hr;
1400
1401 hr = IDirect3DDevice9_SetRenderTarget(device, 0, state->render_target);
1402 if (FAILED(hr)) status = hr;
1403
1405 if (FAILED(hr)) status = hr;
1406
1408 if (FAILED(hr)) status = hr;
1409
1410 return status;
1411}
1412
1413static void compare_device_state(struct device_state *state1, struct device_state *state2, BOOL equal)
1414{
1415 BOOL cmp;
1416 const char *message = equal ? "differs" : "is the same";
1417
1418 cmp = state1->render_target == state2->render_target;
1419 ok(equal ? cmp : !cmp, "Render target %s %p, %p\n", message, state1->render_target, state2->render_target);
1420
1421 cmp = state1->depth_stencil == state2->depth_stencil;
1422 ok(equal ? cmp : !cmp, "Depth stencil surface %s %p, %p\n", message, state1->depth_stencil, state2->depth_stencil);
1423
1424 cmp = state1->viewport.X == state2->viewport.X && state1->viewport.Y == state2->viewport.Y
1425 && state1->viewport.Width == state2->viewport.Width && state1->viewport.Height == state2->viewport.Height;
1426 ok(equal ? cmp : !cmp, "Viewport %s (%u, %u, %u, %u), (%u, %u, %u, %u)\n", message,
1427 state1->viewport.X, state1->viewport.Y, state1->viewport.Width, state1->viewport.Height,
1428 state2->viewport.X, state2->viewport.Y, state2->viewport.Width, state2->viewport.Height);
1429}
1430
1432{
1433 HRESULT hr;
1434 IDirect3DSurface9 *surface = NULL;
1435 ID3DXRenderToSurface *render = NULL;
1436 struct device_state pre_state;
1437 struct device_state current_state;
1438 IDirect3DSurface9 *depth_stencil_surface;
1439
1440 /* make sure there is a depth stencil surface present */
1441 hr = IDirect3DDevice9_GetDepthStencilSurface(device, &depth_stencil_surface);
1442 if (SUCCEEDED(hr))
1443 {
1444 IDirect3DSurface9_Release(depth_stencil_surface);
1445 depth_stencil_surface = NULL;
1446 }
1447 else if (hr == D3DERR_NOTFOUND)
1448 {
1450 D3DMULTISAMPLE_NONE, 0, TRUE, &depth_stencil_surface, NULL);
1451 if (SUCCEEDED(hr)) IDirect3DDevice9_SetDepthStencilSurface(device, depth_stencil_surface);
1452 }
1453
1454 if (FAILED(hr))
1455 {
1456 skip("Failed to create depth stencil surface\n");
1457 return;
1458 }
1459
1461 FALSE, &surface, NULL);
1462 if (FAILED(hr))
1463 {
1464 skip("Failed to create render target\n");
1465 goto cleanup;
1466 }
1467
1468 hr = retrieve_device_state(device, &pre_state);
1469 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1470
1472 ok(hr == D3D_OK, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3D_OK);
1473 if (SUCCEEDED(hr))
1474 {
1476 ok(hr == D3D_OK, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3D_OK);
1477
1478 hr = retrieve_device_state(device, &current_state);
1479 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1480 compare_device_state(&current_state, &pre_state, FALSE);
1481 release_device_state(&current_state);
1482
1484 ok(hr == D3D_OK, "ID3DXRenderToSurface::EndScene returned %#x, expected %#x\n", hr, D3D_OK);
1485
1486 hr = retrieve_device_state(device, &current_state);
1487 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1488 compare_device_state(&current_state, &pre_state, TRUE);
1489 release_device_state(&current_state);
1490
1492 }
1493
1495 if (SUCCEEDED(hr))
1496 {
1498 ok(hr == D3D_OK, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3D_OK);
1499
1500 hr = retrieve_device_state(device, &current_state);
1501 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1502 compare_device_state(&current_state, &pre_state, FALSE);
1503 release_device_state(&current_state);
1504
1506 ok(hr == D3D_OK, "ID3DXRenderToSurface::EndScene returned %#x, expected %#x\n", hr, D3D_OK);
1507
1508 hr = retrieve_device_state(device, &current_state);
1509 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1510 compare_device_state(&current_state, &pre_state, TRUE);
1511 release_device_state(&current_state);
1512
1514 ok(hr == D3D_OK, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3D_OK);
1515
1516 hr = retrieve_device_state(device, &current_state);
1517 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1518 compare_device_state(&current_state, &pre_state, FALSE);
1519 release_device_state(&current_state);
1520
1522
1523 /* if EndScene isn't called, the device state isn't restored */
1524 hr = retrieve_device_state(device, &current_state);
1525 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1526 compare_device_state(&current_state, &pre_state, FALSE);
1527 release_device_state(&current_state);
1528
1529 hr = apply_device_state(device, &pre_state);
1530 ok(SUCCEEDED(hr), "Failed to restore previous device state\n");
1531
1533 }
1534
1535 release_device_state(&pre_state);
1536
1537cleanup:
1538 if (depth_stencil_surface)
1539 {
1541 IDirect3DSurface9_Release(depth_stencil_surface);
1542 }
1543
1544 if (surface) check_release((IUnknown *)surface, 0);
1545}
1546
1547static void test_ID3DXRenderToSurface(IDirect3DDevice9 *device)
1548{
1549 int i;
1550 HRESULT hr;
1551 ULONG ref_count;
1552 IDirect3DDevice9 *out_device;
1553 ID3DXRenderToSurface *render;
1554 IDirect3DSurface9 *surface;
1555 D3DVIEWPORT9 viewport = { 0, 0, 256, 256, 0.0, 1.0 };
1556 D3DXRTS_DESC tests[] = {
1557 { 256, 256, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN },
1558 { 256, 256, D3DFMT_A8R8G8B8, TRUE, D3DFMT_D24S8 },
1559 { 256, 256, D3DFMT_A8R8G8B8, TRUE, D3DFMT_D24X8 },
1560 { 512, 512, D3DFMT_X8R8G8B8, FALSE, D3DFMT_X8R8G8B8 },
1561 { 1024, 1024, D3DFMT_X8R8G8B8, TRUE, D3DFMT_D24S8 }
1562 };
1563
1565 ok(hr == D3D_OK, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3D_OK);
1566 if (FAILED(hr)) return;
1567
1569 if (SUCCEEDED(hr))
1570 {
1571 ID3DXRenderToSurface *render_surface;
1572
1573 /* GetDevice */
1575 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::GetDevice returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1576
1577 ref_count = get_ref((IUnknown *)device);
1579 ok(hr == D3D_OK, "ID3DXRenderToSurface::GetDevice returned %#x, expected %#x\n", hr, D3D_OK);
1580 check_release((IUnknown *)out_device, ref_count);
1581
1582 /* BeginScene and EndScene */
1584 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::EndScene returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1585
1587 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1588
1589 ref_count = get_ref((IUnknown *)surface);
1591 ok(hr == D3D_OK, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3D_OK);
1592 if (SUCCEEDED(hr))
1593 {
1594 check_ref((IUnknown *)surface, ref_count + 1);
1595
1597 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1598
1600 ok(hr == D3D_OK, "ID3DXRenderToSurface::EndScene returned %#x, expected %#x\n", hr, D3D_OK);
1601
1602 check_ref((IUnknown *)surface, ref_count);
1603 }
1604
1605 /* error handling is deferred to BeginScene */
1606 hr = D3DXCreateRenderToSurface(device, 256, 256, D3DFMT_A8R8G8B8, TRUE, D3DFMT_UNKNOWN, &render_surface);
1607 ok(hr == D3D_OK, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3D_OK);
1608 hr = ID3DXRenderToSurface_BeginScene(render_surface, surface, NULL);
1609 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1610 check_release((IUnknown *)render_surface, 0);
1611
1612 check_release((IUnknown *)surface, 0);
1613 }
1614 else skip("Failed to create surface\n");
1615
1617
1618 for (i = 0; i < ARRAY_SIZE(tests); i++)
1619 {
1620 check_ID3DXRenderToSurface(device, tests[i].Width, tests[i].Height, tests[i].Format, tests[i].DepthStencil, tests[i].DepthStencilFormat, TRUE);
1621 check_ID3DXRenderToSurface(device, tests[i].Width, tests[i].Height, tests[i].Format, tests[i].DepthStencil, tests[i].DepthStencilFormat, FALSE);
1622 }
1623
1625}
1626
1627static void test_D3DXCreateRenderToEnvMap(IDirect3DDevice9 *device)
1628{
1629 int i;
1630 HRESULT hr;
1631 ULONG ref_count;
1633 ID3DXRenderToEnvMap *render;
1634 static const struct {
1635 D3DXRTE_DESC parameters;
1636 D3DXRTE_DESC expected_values;
1637 } tests[] = {
1640 { { 256, 4, D3DFMT_A8R8G8B8, FALSE, D3DFMT_D24S8 }, { 256, 4, D3DFMT_A8R8G8B8, FALSE, D3DFMT_D24S8 } },
1641 { { 256, 256, D3DFMT_UNKNOWN, FALSE, D3DFMT_R8G8B8 }, { 256, 9, D3DFMT_A8R8G8B8, FALSE, D3DFMT_R8G8B8 } },
1642 { { -1, -1, D3DFMT_A8R8G8B8, TRUE, D3DFMT_DXT1 }, { 256, 9, D3DFMT_A8R8G8B8, TRUE, D3DFMT_DXT1 } },
1643 { { 256, 1, D3DFMT_X8R8G8B8, TRUE, D3DFMT_UNKNOWN }, { 256, 1, D3DFMT_X8R8G8B8, TRUE, D3DFMT_UNKNOWN } }
1644 };
1645
1646 for (i = 0; i < ARRAY_SIZE(tests); i++)
1647 {
1648 const D3DXRTE_DESC *parameters = &tests[i].parameters;
1649 const D3DXRTE_DESC *expected = &tests[i].expected_values;
1650 hr = D3DXCreateRenderToEnvMap(device, parameters->Size, parameters->MipLevels, parameters->Format,
1651 parameters->DepthStencil, parameters->DepthStencilFormat, &render);
1652 ok(hr == D3D_OK, "%d: D3DXCreateRenderToEnvMap returned %#x, expected %#x\n", i, hr, D3D_OK);
1653 if (SUCCEEDED(hr))
1654 {
1656 ok(hr == D3D_OK, "%d: GetDesc failed %#x\n", i, hr);
1657 if (SUCCEEDED(hr))
1658 {
1659 ok(desc.Size == expected->Size, "%d: Got size %u, expected %u\n", i, desc.Size, expected->Size);
1660 ok(desc.MipLevels == expected->MipLevels, "%d: Got miplevels %u, expected %u\n", i, desc.MipLevels, expected->MipLevels);
1661 ok(desc.Format == expected->Format, "%d: Got format %#x, expected %#x\n", i, desc.Format, expected->Format);
1662 ok(desc.DepthStencil == expected->DepthStencil, "%d: Got depth stencil %d, expected %d\n",
1663 i, expected->DepthStencil, expected->DepthStencil);
1664 ok(desc.DepthStencilFormat == expected->DepthStencilFormat, "%d: Got depth stencil format %#x, expected %#x\n",
1665 i, expected->DepthStencilFormat, expected->DepthStencilFormat);
1666 }
1668 }
1669 }
1670
1671 /* check device ref count */
1672 ref_count = get_ref((IUnknown *)device);
1674 check_ref((IUnknown *)device, ref_count + 1);
1676}
1677
1678static void test_ID3DXRenderToEnvMap_cube_map(IDirect3DDevice9 *device)
1679{
1680 HRESULT hr;
1681 IDirect3DCubeTexture9 *cube_texture = NULL;
1682 ID3DXRenderToEnvMap *render = NULL;
1683 struct device_state pre_state;
1684 struct device_state current_state;
1685
1687 &cube_texture, NULL);
1688 if (FAILED(hr))
1689 {
1690 skip("Failed to create cube texture\n");
1691 return;
1692 }
1693
1694 hr = retrieve_device_state(device, &pre_state);
1695 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1696
1698 ok(hr == D3D_OK, "D3DCreateRenderToEnvMap returned %#x, expected %#x\n", hr, D3D_OK);
1699 if (SUCCEEDED(hr))
1700 {
1701 DWORD face;
1702
1704 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::End returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1705
1706 hr = ID3DXRenderToEnvMap_BeginCube(render, cube_texture);
1707 ok(hr == D3D_OK, "ID3DXRenderToEnvMap::BeginCube returned %#x, expected %#x\n", hr, D3D_OK);
1708
1709 hr = retrieve_device_state(device, &current_state);
1710 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1711 compare_device_state(&current_state, &pre_state, TRUE);
1712 release_device_state(&current_state);
1713
1715 {
1717 ok(hr == D3D_OK, "ID3DXRenderToEnvMap::Face returned %#x, expected %#x\n", hr, D3D_OK);
1718
1719 hr = retrieve_device_state(device, &current_state);
1720 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1721 compare_device_state(&current_state, &pre_state, FALSE);
1722 release_device_state(&current_state);
1723 }
1724
1726 ok(hr == D3D_OK, "ID3DXRenderToEnvMap::End returned %#x, expected %#x\n", hr, D3D_OK);
1727
1728 hr = retrieve_device_state(device, &current_state);
1729 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1730 compare_device_state(&current_state, &pre_state, TRUE);
1731 release_device_state(&current_state);
1732
1734 }
1735
1736 release_device_state(&pre_state);
1737
1738 check_release((IUnknown *)cube_texture, 0);
1739}
1740
1741static void test_ID3DXRenderToEnvMap(IDirect3DDevice9 *device)
1742{
1743 HRESULT hr;
1744 ID3DXRenderToEnvMap *render;
1745 IDirect3DSurface9 *depth_stencil_surface;
1746
1748 if (SUCCEEDED(hr))
1749 {
1750 ULONG ref_count;
1751 IDirect3DDevice9 *out_device;
1752
1754 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::GetDesc returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1755
1757 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::GetDevice returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1758
1759 ref_count = get_ref((IUnknown *)device);
1760 hr = ID3DXRenderToEnvMap_GetDevice(render, &out_device);
1761 ok(hr == D3D_OK, "ID3DXRenderToEnvMap::GetDevice returned %#x, expected %#x\n", hr, D3D_OK);
1762 ok(out_device == device, "ID3DXRenderToEnvMap::GetDevice returned different device\n");
1763 check_release((IUnknown *)device, ref_count);
1764
1766 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::End returned %#x, expected %#x\n", hr, D3D_OK);
1767
1769 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::BeginCube returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1770
1772 todo_wine ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::BeginHemisphere returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1773
1775 todo_wine ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::BeginParabolic returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1776
1778 todo_wine ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::BeginSphere returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
1779
1781 } else skip("Failed to create ID3DXRenderToEnvMap\n");
1782
1783 /* make sure there is a depth stencil surface present */
1784 hr = IDirect3DDevice9_GetDepthStencilSurface(device, &depth_stencil_surface);
1785 if (SUCCEEDED(hr))
1786 {
1787 IDirect3DSurface9_Release(depth_stencil_surface);
1788 depth_stencil_surface = NULL;
1789 }
1790 else if (hr == D3DERR_NOTFOUND)
1791 {
1793 D3DMULTISAMPLE_NONE, 0, TRUE, &depth_stencil_surface, NULL);
1794 if (SUCCEEDED(hr)) IDirect3DDevice9_SetDepthStencilSurface(device, depth_stencil_surface);
1795 }
1796
1797 if (FAILED(hr))
1798 {
1799 skip("Failed to create depth stencil surface\n");
1800 return;
1801 }
1802
1804
1805 if (depth_stencil_surface)
1806 {
1808 IDirect3DSurface9_Release(depth_stencil_surface);
1809 }
1810}
1811
1813{
1814 HWND wnd;
1815 IDirect3D9 *d3d;
1816 IDirect3DDevice9 *device;
1818 HRESULT hr;
1819
1820 if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
1821 640, 480, NULL, NULL, NULL, NULL)))
1822 {
1823 skip("Couldn't create application window\n");
1824 return;
1825 }
1826 if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
1827 {
1828 skip("Couldn't create IDirect3D9 object\n");
1829 DestroyWindow(wnd);
1830 return;
1831 }
1832
1833 ZeroMemory(&d3dpp, sizeof(d3dpp));
1834 d3dpp.Windowed = TRUE;
1837 if(FAILED(hr)) {
1838 skip("Failed to create IDirect3DDevice9 object %#x\n", hr);
1839 IDirect3D9_Release(d3d);
1840 DestroyWindow(wnd);
1841 return;
1842 }
1843
1851
1853 check_release((IUnknown*)d3d, 0);
1854 if (wnd) DestroyWindow(wnd);
1855}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
static int state
Definition: maze.c:121
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define ARRAY_SIZE(A)
Definition: main.h:33
#define U(x)
Definition: wordpad.c:45
@ D3DMULTISAMPLE_NONE
Definition: d3d8types.h:672
@ D3DFMT_R8G8B8
Definition: d3d8types.h:603
@ D3DFMT_A8R8G8B8
Definition: d3d8types.h:604
@ D3DFMT_DXT1
Definition: d3d8types.h:634
@ D3DFMT_D24S8
Definition: d3d8types.h:643
@ D3DFMT_D24X8
Definition: d3d8types.h:645
@ D3DFMT_UNKNOWN
Definition: d3d8types.h:601
@ D3DFMT_X8R8G8B8
Definition: d3d8types.h:605
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
@ D3DRTYPE_TEXTURE
Definition: d3d8types.h:812
@ D3DSWAPEFFECT_DISCARD
Definition: d3d8types.h:851
@ D3DCUBEMAP_FACE_POSITIVE_X
Definition: d3d8types.h:550
@ D3DCUBEMAP_FACE_NEGATIVE_Z
Definition: d3d8types.h:555
@ D3DDEVTYPE_HAL
Definition: d3d8types.h:576
#define D3DUSAGE_RENDERTARGET
Definition: d3d8types.h:91
@ D3DPOOL_DEFAULT
Definition: d3d8types.h:709
@ D3DPOOL_MANAGED
Definition: d3d8types.h:710
enum _D3DFORMAT D3DFORMAT
#define D3DCOLOR_XRGB(r, g, b)
Definition: d3d8types.h:44
@ D3DTS_VIEW
Definition: d3d8types.h:955
@ D3DTS_PROJECTION
Definition: d3d8types.h:956
#define D3DTS_WORLD
Definition: d3d8types.h:85
#define D3DCLEAR_TARGET
Definition: d3d8types.h:30
IDirect3D9 *WINAPI Direct3DCreate9(UINT SDKVersion)
Definition: d3d9.c:57
#define IDirect3DTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:1032
#define IDirect3DDevice9_EndScene(p)
Definition: d3d9.h:1549
#define IDirect3DDevice9_BeginScene(p)
Definition: d3d9.h:1548
#define IDirect3DDevice9_GetDirect3D(p, a)
Definition: d3d9.h:1513
#define IDirect3D9_CreateDevice(p, a, b, c, d, e, f)
Definition: d3d9.h:235
#define IDirect3DTexture9_GetLevelCount(p)
Definition: d3d9.h:1027
#define IDirect3DDevice9_SetViewport(p, a)
Definition: d3d9.h:1554
#define IDirect3DDevice9_CreateTexture(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1530
#define IDirect3DDevice9_SetRenderTarget(p, a, b)
Definition: d3d9.h:1544
#define IDirect3DDevice9_SetDepthStencilSurface(p, a)
Definition: d3d9.h:1546
#define IDirect3DDevice9_CreateDepthStencilSurface(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1536
#define IDirect3DDevice9_GetViewport(p, a)
Definition: d3d9.h:1555
#define IDirect3DDevice9_CreateCubeTexture(p, a, b, c, d, e, f, g)
Definition: d3d9.h:1532
#define IDirect3D9_Release(p)
Definition: d3d9.h:220
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1508
#define IDirect3DDevice9_Clear(p, a, b, c, d, e, f)
Definition: d3d9.h:1550
#define IDirect3D9_CheckDeviceFormat(p, a, b, c, d, e, f)
Definition: d3d9.h:229
#define IDirect3DDevice9_GetDepthStencilSurface(p, a)
Definition: d3d9.h:1547
#define IDirect3DDevice9_GetTransform(p, a, b)
Definition: d3d9.h:1552
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
#define IDirect3DTexture9_Release(p)
Definition: d3d9.h:1014
#define IDirect3DDevice9_CreateRenderTarget(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1535
#define IDirect3DDevice9_CreateOffscreenPlainSurface(p, a, b, c, d, e, f)
Definition: d3d9.h:1543
#define IDirect3DDevice9_GetRenderTarget(p, a, b)
Definition: d3d9.h:1545
#define D3D_OK
Definition: d3d.h:106
#define D3DERR_INVALIDCALL
struct ID3DXBuffer ID3DXBuffer
Definition: d3dx8core.h:51
struct ID3DXFont ID3DXFont
Definition: d3dx8core.h:53
#define ID3DXSprite_Release(p)
Definition: d3dx9core.h:442
#define ID3DXRenderToEnvMap_BeginCube(p, a)
Definition: d3dx9core.h:332
#define ID3DXSprite_SetTransform(p, a)
Definition: d3dx9core.h:446
#define ID3DXRenderToSurface_GetDevice(p, a)
Definition: d3dx9core.h:392
#define ID3DXBuffer_GetBufferSize(p)
Definition: d3dx9core.h:86
#define ID3DXFont_PreloadCharacters(p, a, b)
Definition: d3dx9core.h:175
#define ID3DXFont_PreloadTextW(p, a, b)
Definition: d3dx9core.h:178
#define D3DXSPRITE_ALPHABLEND
Definition: d3dx9core.h:37
#define ID3DXSprite_OnLostDevice(p)
Definition: d3dx9core.h:453
#define ID3DXSprite_Begin(p, a)
Definition: d3dx9core.h:449
#define ID3DXRenderToEnvMap_GetDesc(p, a)
Definition: d3dx9core.h:331
#define ID3DXFont_GetDescA(p, a)
Definition: d3dx9core.h:169
#define ID3DXSprite_Draw(p, a, b, c, d, e)
Definition: d3dx9core.h:450
#define ID3DXRenderToEnvMap_GetDevice(p, a)
Definition: d3dx9core.h:330
#define ID3DXFont_GetTextMetricsW(p, a)
Definition: d3dx9core.h:172
#define ID3DXSprite_SetWorldViewLH(p, a, b)
Definition: d3dx9core.h:448
#define ID3DXFont_GetDC(p)
Definition: d3dx9core.h:173
#define ID3DXSprite_GetTransform(p, a)
Definition: d3dx9core.h:445
#define ID3DXRenderToEnvMap_End(p, a)
Definition: d3dx9core.h:337
#define ID3DXFont_Release(p)
Definition: d3dx9core.h:166
#define ID3DXSprite_GetDevice(p, a)
Definition: d3dx9core.h:444
#define ID3DXFont_GetGlyphData(p, a, b, c, d)
Definition: d3dx9core.h:174
#define ID3DXFont_GetTextMetricsA(p, a)
Definition: d3dx9core.h:171
#define ID3DXSprite_SetWorldViewRH(p, a, b)
Definition: d3dx9core.h:447
#define ID3DXRenderToEnvMap_BeginHemisphere(p, a, b)
Definition: d3dx9core.h:334
#define ID3DXSprite_OnResetDevice(p)
Definition: d3dx9core.h:454
#define ID3DXRenderToSurface_GetDesc(p, a)
Definition: d3dx9core.h:393
#define ID3DXRenderToEnvMap_Release(p)
Definition: d3dx9core.h:328
#define ID3DXBuffer_Release(p)
Definition: d3dx9core.h:83
#define ID3DXFont_PreloadGlyphs(p, a, b)
Definition: d3dx9core.h:176
#define ID3DXSprite_Flush(p)
Definition: d3dx9core.h:451
#define ID3DXRenderToEnvMap_BeginParabolic(p, a, b)
Definition: d3dx9core.h:335
#define ID3DXFont_DrawTextA(p, a, b, c, d, e, f)
Definition: d3dx9core.h:179
#define ID3DXFont_GetDevice(p, a)
Definition: d3dx9core.h:168
#define ID3DXRenderToEnvMap_Face(p, a, b)
Definition: d3dx9core.h:336
#define ID3DXRenderToSurface_EndScene(p, a)
Definition: d3dx9core.h:395
#define ID3DXFont_PreloadTextA(p, a, b)
Definition: d3dx9core.h:177
#define D3DXSPRITE_DO_NOT_ADDREF_TEXTURE
Definition: d3dx9core.h:41
#define ID3DXRenderToEnvMap_BeginSphere(p, a)
Definition: d3dx9core.h:333
#define ID3DXFont_DrawTextW(p, a, b, c, d, e, f)
Definition: d3dx9core.h:180
#define ID3DXSprite_End(p)
Definition: d3dx9core.h:452
#define ID3DXRenderToSurface_BeginScene(p, a, b)
Definition: d3dx9core.h:394
#define ID3DXRenderToSurface_Release(p)
Definition: d3dx9core.h:390
#define D3DX_FILTER_POINT
Definition: d3dx9tex.h:28
#define D3DX_FILTER_NONE
Definition: d3dx9tex.h:27
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HRESULT WINAPI D3DXCreateBuffer(DWORD size, ID3DXBuffer **buffer)
Definition: core.c:131
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: font.c:844
HRESULT WINAPI D3DXCreateFontIndirectA(IDirect3DDevice9 *device, const D3DXFONT_DESCA *desc, ID3DXFont **font)
Definition: font.c:892
D3DXMATRIX *WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:443
WORD face[3]
Definition: mesh.c:4747
HRESULT WINAPI D3DXCreateRenderToEnvMap(IDirect3DDevice9 *device, UINT size, UINT mip_levels, D3DFORMAT format, BOOL depth_stencil, D3DFORMAT depth_stencil_format, ID3DXRenderToEnvMap **out)
Definition: render.c:749
HRESULT WINAPI D3DXCreateRenderToSurface(IDirect3DDevice9 *device, UINT width, UINT height, D3DFORMAT format, BOOL depth_stencil, D3DFORMAT depth_stencil_format, ID3DXRenderToSurface **out)
Definition: render.c:376
static void cleanup(void)
Definition: main.c:1335
#define MAKEFOURCC(ch0, ch1, ch2, ch3)
Definition: dmdls.h:24
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned short WORD
Definition: ntddk_ex.h:93
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint texture
Definition: glext.h:6295
GLuint buffer
Definition: glext.h:5915
const GLubyte * c
Definition: glext.h:8905
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLenum GLuint GLint GLenum face
Definition: glext.h:7025
GLsizei GLenum const GLvoid GLuint GLsizei GLfloat * metrics
Definition: glext.h:11745
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
GLsizei levels
Definition: glext.h:7884
const GLfloat * m
Definition: glext.h:10848
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
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
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
Definition: fabs.c:17
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
static const WCHAR testW[]
Definition: jsregexp.c:44
#define c
Definition: ke_i.h:80
#define debugstr_a
Definition: kernel32.h:31
static struct test_info tests[]
HDC hdc
Definition: main.c:9
static int font_height(HFONT hFont)
Definition: combo.c:612
static HDC
Definition: imagelist.c:92
static const WCHAR desc[]
Definition: protectdata.c:36
BOOL expected
Definition: store.c:2063
static void test_ID3DXRenderToSurface(IDirect3DDevice9 *device)
Definition: core.c:1547
static void compare_device_state(struct device_state *state1, struct device_state *state2, BOOL equal)
Definition: core.c:1413
static void check_mat(D3DXMATRIX got, D3DXMATRIX exp)
Definition: core.c:47
static void test_ID3DXRenderToSurface_device_state(IDirect3DDevice9 *device)
Definition: core.c:1431
#define check_rect(rect, left, top, right, bottom)
Definition: core.c:67
#define check_ref(obj, exp)
Definition: core.c:32
static void test_ID3DXSprite(IDirect3DDevice9 *device)
Definition: core.c:105
static void check_ID3DXRenderToSurface(IDirect3DDevice9 *device, UINT width, UINT height, D3DFORMAT format, BOOL depth_stencil, D3DFORMAT depth_stencil_format, BOOL render_target)
Definition: core.c:1242
static void _check_ref(unsigned int line, IUnknown *obj, int exp)
Definition: core.c:33
static void test_ID3DXBuffer(void)
Definition: core.c:76
static HRESULT apply_device_state(IDirect3DDevice9 *device, struct device_state *state)
Definition: core.c:1396
static int get_ref(IUnknown *obj)
Definition: core.c:26
static void _check_rect(unsigned int line, const RECT *rect, int left, int top, int right, int bottom)
Definition: core.c:68
static void test_ID3DXFont(IDirect3DDevice9 *device)
Definition: core.c:329
static HRESULT retrieve_device_state(IDirect3DDevice9 *device, struct device_state *state)
Definition: core.c:1373
static void test_D3DXCreateRenderToSurface(IDirect3DDevice9 *device)
Definition: core.c:1187
static void _check_release(unsigned int line, IUnknown *obj, int exp)
Definition: core.c:40
static void test_ID3DXRenderToEnvMap_cube_map(IDirect3DDevice9 *device)
Definition: core.c:1678
#define admitted_error
Definition: core.c:46
static void test_D3DXCreateRenderToEnvMap(IDirect3DDevice9 *device)
Definition: core.c:1627
static void test_ID3DXRenderToEnvMap(IDirect3DDevice9 *device)
Definition: core.c:1741
static void release_device_state(struct device_state *state)
Definition: core.c:1366
#define check_release(obj, exp)
Definition: core.c:39
static const MAT2 mat
Definition: font.c:66
const char * expected_result
Definition: mimeole.c:1468
#define todo_wine_if(is_todo)
Definition: custom.c:76
#define todo_wine
Definition: custom.c:79
#define cmp(status, error)
Definition: error.c:114
DWORD exp
Definition: msg.c:16058
Definition: mk_font.cpp:20
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define equal(x, y)
Definition: reader.cc:56
#define D3DADAPTER_DEFAULT
Definition: d3d8.h:57
#define D3D_SDK_VERSION
Definition: d3d8.h:56
#define D3DERR_NOTFOUND
Definition: d3d8.h:80
#define D3DCREATE_SOFTWARE_VERTEXPROCESSING
Definition: d3d8.h:44
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI D3DXCreateSprite(struct IDirect3DDevice9 *device, struct ID3DXSprite **sprite)
Definition: sprite.c:569
static void render(void)
Definition: ssstars.c:272
& rect
Definition: startmenu.cpp:1413
D3DSWAPEFFECT SwapEffect
Definition: d3d8types.h:1128
D3DFORMAT Format
Definition: d3d8types.h:1170
UINT MipLevels
Definition: d3dx9core.h:293
BOOL DepthStencil
Definition: d3dx9core.h:295
D3DFORMAT DepthStencilFormat
Definition: d3dx9core.h:296
D3DFORMAT Format
Definition: d3dx9core.h:294
UINT gmBlackBoxY
Definition: wingdi.h:2443
UINT gmBlackBoxX
Definition: wingdi.h:2442
POINT gmptGlyphOrigin
Definition: wingdi.h:2444
Definition: wingdi.h:2472
D3DVIEWPORT9 viewport
Definition: render.c:34
IDirect3DSurface9 * render_target
Definition: core.c:1361
IDirect3DSurface9 * depth_stencil
Definition: render.c:33
Definition: devices.h:37
Definition: dsound.c:943
Definition: parser.c:49
Definition: tftpd.h:60
Definition: send.c:48
Definition: sprite.c:40
Definition: ps.c:97
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
BYTE tmStruckOut
Definition: wingdi.h:2378
BYTE tmPitchAndFamily
Definition: wingdi.h:2379
BYTE tmCharSet
Definition: wingdi.h:2380
LONG tmDescent
Definition: wingdi.h:2363
LONG tmDigitizedAspectX
Definition: wingdi.h:2370
BYTE tmFirstChar
Definition: wingdi.h:2372
LONG tmExternalLeading
Definition: wingdi.h:2365
LONG tmWeight
Definition: wingdi.h:2368
BYTE tmBreakChar
Definition: wingdi.h:2375
LONG tmInternalLeading
Definition: wingdi.h:2364
BYTE tmLastChar
Definition: wingdi.h:2373
BYTE tmUnderlined
Definition: wingdi.h:2377
LONG tmMaxCharWidth
Definition: wingdi.h:2367
LONG tmAveCharWidth
Definition: wingdi.h:2366
BYTE tmDefaultChar
Definition: wingdi.h:2374
LONG tmAscent
Definition: wingdi.h:2362
LONG tmOverhang
Definition: wingdi.h:2369
LONG tmHeight
Definition: wingdi.h:2361
BYTE tmItalic
Definition: wingdi.h:2376
LONG tmDigitizedAspectY
Definition: wingdi.h:2371
Definition: time.h:68
uint32_t ULONG
Definition: typedefs.h:59
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
int ret
#define ZeroMemory
Definition: winbase.h:1712
#define DEFAULT_PITCH
Definition: wingdi.h:443
#define VARIABLE_PITCH
Definition: wingdi.h:445
#define FW_DONTCARE
Definition: wingdi.h:368
#define ANTIALIASED_QUALITY
Definition: wingdi.h:440
#define DEFAULT_QUALITY
Definition: wingdi.h:436
#define FW_BOLD
Definition: wingdi.h:378
#define OUT_RASTER_PRECIS
Definition: wingdi.h:421
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
#define GGO_GLYPH_INDEX
Definition: wingdi.h:855
#define ANSI_CHARSET
Definition: wingdi.h:383
#define GDI_ERROR
Definition: wingdi.h:1309
DWORD WINAPI GetGlyphIndicesA(_In_ HDC hdc, _In_reads_(c) LPCSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
BOOL WINAPI GetTextMetricsA(_In_ HDC, _Out_ LPTEXTMETRICA)
Definition: text.c:200
#define GGO_METRICS
Definition: wingdi.h:848
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)
#define DT_CENTER
Definition: winuser.h:527
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315
#define DT_SINGLELINE
Definition: winuser.h:540
#define DT_NOCLIP
Definition: winuser.h:536
#define DT_LEFT
Definition: winuser.h:534
#define DT_TOP
Definition: winuser.h:542
#define DT_WORDBREAK
Definition: winuser.h:544
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
#define DT_VCENTER
Definition: winuser.h:543
#define DT_BOTTOM
Definition: winuser.h:525
#define DT_RIGHT
Definition: winuser.h:538
#define DT_EXPANDTABS
Definition: winuser.h:532
#define DT_CALCRECT
Definition: winuser.h:526
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180