ReactOS 0.4.17-dev-966-gf06eace
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(exp.m[i][j]-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 got.m[0][0],got.m[0][1],got.m[0][2],got.m[0][3],
58 got.m[1][0],got.m[1][1],got.m[1][2],got.m[1][3],
59 got.m[2][0],got.m[2][1],got.m[2][2],got.m[2][3],
60 got.m[3][0],got.m[3][1],got.m[3][2],got.m[3][3],
61 exp.m[0][0],exp.m[0][1],exp.m[0][2],exp.m[0][3],
62 exp.m[1][0],exp.m[1][1],exp.m[1][2],exp.m[1][3],
63 exp.m[2][0],exp.m[2][1],exp.m[2][2],exp.m[2][3],
64 exp.m[3][0],exp.m[3][1],exp.m[3][2],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 %ld\n", rect->left);
71 ok_(__FILE__, line)(rect->top == top, "Unexpected rect.top %ld\n", rect->top);
72 ok_(__FILE__, line)(rect->right == right, "Unexpected rect.right %ld\n", rect->right);
73 ok_(__FILE__, line)(rect->bottom == bottom, "Unexpected rect.bottom %ld\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 %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
85
87 ok(hr == D3D_OK, "D3DXCreateBuffer failed, got %#lx, expected %#lx\n", hr, D3D_OK);
88
90 ok(!size, "GetBufferSize failed, got %lu, expected %u\n", size, 0);
91
93 ok(!count, "ID3DXBuffer has %lu references left\n", count);
94
96 ok(hr == D3D_OK, "D3DXCreateBuffer failed, got %#lx, expected %#lx\n", hr, D3D_OK);
97
99 ok(size == 3, "GetBufferSize failed, got %lu, expected %u\n", size, 3);
100
102 ok(!count, "ID3DXBuffer has %lu references left\n", count);
103}
104
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: %#lx)\n", hr);
125 if (FAILED(hr)) return;
126
128 ok (hr == D3D_OK, "Failed to create second texture (error code: %#lx)\n", hr);
129 if (FAILED(hr)) {
131 return;
132 }
133
134 /* Test D3DXCreateSprite */
136 ok (hr == D3DERR_INVALIDCALL, "D3DXCreateSprite returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
137
139 ok (hr == D3DERR_INVALIDCALL, "D3DXCreateSprite returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
140
142 ok (hr == D3D_OK, "D3DXCreateSprite returned %#lx, expected %#lx\n", hr, D3D_OK);
143
144
145 /* Test ID3DXSprite_GetDevice */
147 ok (hr == D3DERR_INVALIDCALL, "GetDevice returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
148
149 hr = ID3DXSprite_GetDevice(sprite, &cmpdev); /* cmpdev == NULL */
150 ok (hr == D3D_OK, "GetDevice returned %#lx, expected %#lx\n", hr, D3D_OK);
151
152 hr = ID3DXSprite_GetDevice(sprite, &cmpdev); /* cmpdev != NULL */
153 ok (hr == D3D_OK, "GetDevice returned %#lx, expected %#lx\n", hr, D3D_OK);
154
157
158
159 /* Test ID3DXSprite_GetTransform */
161 ok (hr == D3DERR_INVALIDCALL, "GetTransform returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
163 ok (hr == D3D_OK, "GetTransform returned %#lx, expected %#lx\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 mat.m[0][0]=2.1f; mat.m[0][1]=6.5f; mat.m[0][2]=-9.6f; mat.m[0][3]=1.7f;
173 mat.m[1][0]=4.2f; mat.m[1][1]=-2.5f; mat.m[1][2]=2.1f; mat.m[1][3]=5.5f;
174 mat.m[2][0]=-2.6f; mat.m[2][1]=0.3f; mat.m[2][2]=8.6f; mat.m[2][3]=8.4f;
175 mat.m[3][0]=6.7f; mat.m[3][1]=-5.1f; mat.m[3][2]=6.1f; mat.m[3][3]=2.2f;
176
178 ok (hr == D3DERR_INVALIDCALL, "SetTransform returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
179
181 ok (hr == D3D_OK, "SetTransform returned %#lx, expected %#lx\n", hr, D3D_OK);
182 if(SUCCEEDED(hr)) {
184 if(SUCCEEDED(hr)) check_mat(cmpmat, mat);
185 else skip("GetTransform returned %#lx\n", hr);
186 }
187
188 /* Test ID3DXSprite_SetWorldViewLH/RH */
189 todo_wine {
191 ok (hr == D3D_OK, "SetWorldViewLH returned %#lx, expected %#lx\n", hr, D3D_OK);
193 ok (hr == D3D_OK, "SetWorldViewLH returned %#lx, expected %#lx\n", hr, D3D_OK);
195 ok (hr == D3D_OK, "SetWorldViewLH returned %#lx, expected %#lx\n", hr, D3D_OK);
197 ok (hr == D3D_OK, "SetWorldViewLH returned %#lx, expected %#lx\n", hr, D3D_OK);
198
200 ok (hr == D3D_OK, "SetWorldViewRH returned %#lx, expected %#lx\n", hr, D3D_OK);
202 ok (hr == D3D_OK, "SetWorldViewRH returned %#lx, expected %#lx\n", hr, D3D_OK);
204 ok (hr == D3D_OK, "SetWorldViewRH returned %#lx, expected %#lx\n", hr, D3D_OK);
206 ok (hr == D3D_OK, "SetWorldViewRH returned %#lx, expected %#lx\n", hr, D3D_OK);
207 }
209
210 /* Test ID3DXSprite_Begin*/
212 ok (hr == D3D_OK, "Begin returned %#lx, expected %#lx\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 %#lx, expected %#lx\n", hr, D3D_OK);
229
231 ok (hr == D3D_OK, "End returned %#lx, expected %#lx\n", hr, D3D_OK);
232
233 hr = ID3DXSprite_Flush(sprite); /* May not be called before next Begin */
234 ok (hr == D3DERR_INVALIDCALL, "Flush returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
236 ok (hr == D3DERR_INVALIDCALL, "End returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
237
238 /* Test ID3DXSprite_Draw */
240 ok (hr == D3D_OK, "Begin returned %#lx, expected %#lx\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 %#lx, expected %#lx\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 %#lx, expected %#lx\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 %#lx, expected %#lx\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 %#lx, expected %#lx\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 %#lx, expected %#lx\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 %#lx, expected %#lx\n", hr, D3D_OK);
266 hr = ID3DXSprite_Draw(sprite, tex1, NULL, NULL, NULL, 0);
267 ok (hr == D3D_OK, "Draw returned %#lx, expected %#lx\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 %#lx, expected %#lx\n", hr, D3D_OK);
272 hr = ID3DXSprite_Flush(sprite); /* Flushing twice should work */
273 ok (hr == D3D_OK, "Flush returned %#lx, expected %#lx\n", hr, D3D_OK);
274 check_ref((IUnknown*)tex1, texref1); check_ref((IUnknown*)tex2, texref2);
275
277 ok (hr == D3D_OK, "End returned %#lx, expected %#lx\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 %#lx, expected %#lx\n", hr, D3D_OK);
285 ok (hr == D3D_OK, "OnLostDevice returned %#lx, expected %#lx\n", hr, D3D_OK);
287 ok (hr == D3D_OK, "OnResetDevice returned %#lx, expected %#lx\n", hr, D3D_OK);
289 ok (hr == D3D_OK, "OnResetDevice returned %#lx, expected %#lx\n", hr, D3D_OK);
290
291 /* Make sure everything works like before */
293 ok (hr == D3D_OK, "Begin returned %#lx, expected %#lx\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 %#lx, expected %#lx\n", hr, D3D_OK);
297 ok (hr == D3D_OK, "Flush returned %#lx, expected %#lx\n", hr, D3D_OK);
299 ok (hr == D3D_OK, "End returned %#lx, expected %#lx\n", hr, D3D_OK);
300
301 /* OnResetDevice makes the interface "forget" the Begin call */
303 ok (hr == D3D_OK, "Begin returned %#lx, expected %#lx\n", hr, D3D_OK);
305 ok (hr == D3D_OK, "OnResetDevice returned %#lx, expected %#lx\n", hr, D3D_OK);
307 ok (hr == D3DERR_INVALIDCALL, "End returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
308
309 /* Test D3DXSPRITE_DO_NOT_ADDREF_TEXTURE */
311 ok (hr == D3D_OK, "Begin returned %#lx, expected %#lx\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 %#lx, expected %#lx\n", hr, D3D_OK);
315 ok (hr == D3D_OK, "OnResetDevice returned %#lx, expected %#lx\n", hr, D3D_OK);
316 check_ref((IUnknown*)tex2, 1);
317
319 ok (hr == D3D_OK, "Begin returned %#lx, expected %#lx\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 %#lx, expected %#lx\n", hr, D3D_OK);
323 ok (hr == D3D_OK, "End returned %#lx, expected %#lx\n", hr, D3D_OK);
324
327 check_release((IUnknown*)tex2, 0);
328 check_release((IUnknown*)tex1, 0);
329}
330
332{
333 static const WCHAR testW[] = L"test";
334 static const char long_text[] = "Example text to test clipping and other related things";
335 static const WCHAR long_textW[] = L"Example text to test clipping and other related things";
336 static const MAT2 mat = { {0,1}, {0,0}, {0,0}, {0,1} };
337 static const struct
338 {
339 int font_height;
340 unsigned int expected_size;
341 unsigned int expected_levels;
342 }
343 tests[] =
344 {
345 { 2, 32, 2 },
346 { 6, 128, 4 },
347 { 10, 256, 5 },
348 { 12, 256, 5 },
349 { 72, 256, 8 },
350 { 250, 256, 9 },
351 { 258, 512, 10 },
352 { 512, 512, 10 },
353 };
354 const unsigned int size = ARRAY_SIZE(testW);
355 TEXTMETRICA metrics, expmetrics;
356 IDirect3DTexture9 *texture;
357 D3DSURFACE_DESC surf_desc;
358 IDirect3DDevice9 *bufdev;
359 GLYPHMETRICS glyph_metrics;
361 ID3DXSprite *sprite;
362 RECT rect, blackbox;
364 int ref, i, height;
367 POINT cellinc;
368 HRESULT hr;
369 WORD glyph;
370 BOOL ret;
371 HDC hdc;
372 char c;
373
374 /* D3DXCreateFont */
377 ok(hr == D3D_OK, "D3DXCreateFont returned %#lx, expected %#lx\n", hr, D3D_OK);
381
383 ok(hr == D3D_OK, "D3DXCreateFont returned %#lx, expected %#lx\n", hr, D3D_OK);
385
387 ok(hr == D3D_OK, "D3DXCreateFont returned %#lx, expected %#lx\n", hr, D3D_OK);
389
391 ok(hr == D3D_OK, "D3DXCreateFont returned %#lx, expected %#lx\n", hr, D3D_OK);
393
395 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFont returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
396
398 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFont returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
399
401 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFont returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
402
403
404 /* D3DXCreateFontIndirect */
405 desc.Height = 12;
406 desc.Width = 0;
407 desc.Weight = FW_DONTCARE;
408 desc.MipLevels = 0;
409 desc.Italic = FALSE;
410 desc.CharSet = DEFAULT_CHARSET;
411 desc.OutputPrecision = OUT_DEFAULT_PRECIS;
412 desc.Quality = DEFAULT_QUALITY;
413 desc.PitchAndFamily = DEFAULT_PITCH;
414 strcpy(desc.FaceName, "Tahoma");
416 ok(hr == D3D_OK, "D3DXCreateFontIndirect returned %#lx, expected %#lx\n", hr, D3D_OK);
418
420 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFontIndirect returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
421
423 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFontIndirect returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
424
426 ok(hr == D3DERR_INVALIDCALL, "D3DXCreateFontIndirect returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
427
428
429 /* ID3DXFont_GetDevice */
431 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
432 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
433
435 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
436
438 hr = ID3DXFont_GetDevice(font, &bufdev);
439 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
440 check_release((IUnknown *)bufdev, ref);
441
443
444
445 /* ID3DXFont_GetDesc */
448 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
449
451 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
452
454 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
455
456 ok(desc.Height == 12, "Got unexpected height %d.\n", desc.Height);
457 ok(desc.Width == 8, "Got unexpected width %u.\n", desc.Width);
458 ok(desc.Weight == FW_BOLD, "Got unexpected weight %u.\n", desc.Weight);
459 ok(desc.MipLevels == 2, "Got unexpected miplevels %u.\n", desc.MipLevels);
460 ok(desc.Italic == TRUE, "Got unexpected italic %#x.\n", desc.Italic);
461 ok(desc.CharSet == ANSI_CHARSET, "Got unexpected charset %u.\n", desc.CharSet);
462 ok(desc.OutputPrecision == OUT_RASTER_PRECIS, "Got unexpected output precision %u.\n", desc.OutputPrecision);
463 ok(desc.Quality == ANTIALIASED_QUALITY, "Got unexpected quality %u.\n", desc.Quality);
464 ok(desc.PitchAndFamily == VARIABLE_PITCH, "Got unexpected pitch and family %#x.\n", desc.PitchAndFamily);
465 ok(!strcmp(desc.FaceName, "Tahoma"), "Got unexpected facename %s.\n", debugstr_a(desc.FaceName));
466
468
469
470 /* ID3DXFont_GetDC + ID3DXFont_GetTextMetrics */
472 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
473 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
474
476 ok(!!hdc, "Got unexpected hdc %p.\n", hdc);
477
479 ok(ret, "Got unexpected ret %#x.\n", ret);
480 ret = GetTextMetricsA(hdc, &expmetrics);
481 ok(ret, "Got unexpected ret %#x.\n", ret);
482
483 ok(metrics.tmHeight == expmetrics.tmHeight, "Got unexpected height %ld, expected %ld.\n",
484 metrics.tmHeight, expmetrics.tmHeight);
485 ok(metrics.tmAscent == expmetrics.tmAscent, "Got unexpected ascent %ld, expected %ld.\n",
486 metrics.tmAscent, expmetrics.tmAscent);
487 ok(metrics.tmDescent == expmetrics.tmDescent, "Got unexpected descent %ld, expected %ld.\n",
488 metrics.tmDescent, expmetrics.tmDescent);
489 ok(metrics.tmInternalLeading == expmetrics.tmInternalLeading, "Got unexpected internal leading %ld, expected %ld.\n",
490 metrics.tmInternalLeading, expmetrics.tmInternalLeading);
491 ok(metrics.tmExternalLeading == expmetrics.tmExternalLeading, "Got unexpected external leading %ld, expected %ld.\n",
492 metrics.tmExternalLeading, expmetrics.tmExternalLeading);
493 ok(metrics.tmAveCharWidth == expmetrics.tmAveCharWidth, "Got unexpected average char width %ld, expected %ld.\n",
494 metrics.tmAveCharWidth, expmetrics.tmAveCharWidth);
495 ok(metrics.tmMaxCharWidth == expmetrics.tmMaxCharWidth, "Got unexpected maximum char width %ld, expected %ld.\n",
496 metrics.tmMaxCharWidth, expmetrics.tmMaxCharWidth);
497 ok(metrics.tmWeight == expmetrics.tmWeight, "Got unexpected weight %ld, expected %ld.\n",
498 metrics.tmWeight, expmetrics.tmWeight);
499 ok(metrics.tmOverhang == expmetrics.tmOverhang, "Got unexpected overhang %ld, expected %ld.\n",
500 metrics.tmOverhang, expmetrics.tmOverhang);
501 ok(metrics.tmDigitizedAspectX == expmetrics.tmDigitizedAspectX, "Got unexpected digitized x aspect %ld, expected %ld.\n",
502 metrics.tmDigitizedAspectX, expmetrics.tmDigitizedAspectX);
503 ok(metrics.tmDigitizedAspectY == expmetrics.tmDigitizedAspectY, "Got unexpected digitized y aspect %ld, expected %ld.\n",
504 metrics.tmDigitizedAspectY, expmetrics.tmDigitizedAspectY);
505 ok(metrics.tmFirstChar == expmetrics.tmFirstChar, "Got unexpected first char %u, expected %u.\n",
506 metrics.tmFirstChar, expmetrics.tmFirstChar);
507 ok(metrics.tmLastChar == expmetrics.tmLastChar, "Got unexpected last char %u, expected %u.\n",
508 metrics.tmLastChar, expmetrics.tmLastChar);
509 ok(metrics.tmDefaultChar == expmetrics.tmDefaultChar, "Got unexpected default char %u, expected %u.\n",
510 metrics.tmDefaultChar, expmetrics.tmDefaultChar);
511 ok(metrics.tmBreakChar == expmetrics.tmBreakChar, "Got unexpected break char %u, expected %u.\n",
512 metrics.tmBreakChar, expmetrics.tmBreakChar);
513 ok(metrics.tmItalic == expmetrics.tmItalic, "Got unexpected italic %u, expected %u.\n",
514 metrics.tmItalic, expmetrics.tmItalic);
515 ok(metrics.tmUnderlined == expmetrics.tmUnderlined, "Got unexpected underlined %u, expected %u.\n",
516 metrics.tmUnderlined, expmetrics.tmUnderlined);
517 ok(metrics.tmStruckOut == expmetrics.tmStruckOut, "Got unexpected struck out %u, expected %u.\n",
518 metrics.tmStruckOut, expmetrics.tmStruckOut);
519 ok(metrics.tmPitchAndFamily == expmetrics.tmPitchAndFamily, "Got unexpected pitch and family %u, expected %u.\n",
520 metrics.tmPitchAndFamily, expmetrics.tmPitchAndFamily);
521 ok(metrics.tmCharSet == expmetrics.tmCharSet, "Got unexpected charset %u, expected %u.\n",
522 metrics.tmCharSet, expmetrics.tmCharSet);
523
525
526
527 /* ID3DXFont_PreloadText */
529 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
530 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
531
533 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
535 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
537 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
538 hr = ID3DXFont_PreloadTextA(font, "test", -1);
539 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
541 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
542 hr = ID3DXFont_PreloadTextA(font, "", -1);
543 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
544
546 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
548 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
550 ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#lx.\n", hr);
552 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
554 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
556 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
557
559
560
561 /* ID3DXFont_GetGlyphData, ID3DXFont_PreloadGlyphs, ID3DXFont_PreloadCharacters */
563 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
564 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
565
567 ok(!!hdc, "Got unexpected hdc %p.\n", hdc);
568
569 hr = ID3DXFont_GetGlyphData(font, 0, NULL, &blackbox, &cellinc);
570 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
571 hr = ID3DXFont_GetGlyphData(font, 0, &texture, NULL, &cellinc);
573 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
574 hr = ID3DXFont_GetGlyphData(font, 0, &texture, &blackbox, NULL);
576 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
577
579 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
581 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
582
584 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
585
586 for (c = 'b'; c <= 'z'; ++c)
587 {
588 winetest_push_context("Character %c", c);
589 count = GetGlyphIndicesA(hdc, &c, 1, &glyph, 0);
590 ok(count != GDI_ERROR, "Unexpected count %lu.\n", count);
591
592 hr = ID3DXFont_GetGlyphData(font, glyph, &texture, &blackbox, &cellinc);
593 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
594
596 todo_wine ok(levels == 5, "Unexpected levels %lu.\n", levels);
597 hr = IDirect3DTexture9_GetLevelDesc(texture, 0, &surf_desc);
598 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
599 ok(surf_desc.Format == D3DFMT_A8R8G8B8, "Unexpected format %#x.\n", surf_desc.Format);
600 ok(surf_desc.Usage == 0, "Unexpected usage %#lx.\n", surf_desc.Usage);
601 ok(surf_desc.Width == 256, "Unexpected width %u.\n", surf_desc.Width);
602 ok(surf_desc.Height == 256, "Unexpected height %u.\n", surf_desc.Height);
603 ok(surf_desc.Pool == D3DPOOL_MANAGED, "Unexpected pool %u.\n", surf_desc.Pool);
604
605 count = GetGlyphOutlineW(hdc, glyph, GGO_GLYPH_INDEX | GGO_METRICS, &glyph_metrics, 0, NULL, &mat);
606 ok(count != GDI_ERROR, "Unexpected count %#lx.\n", count);
607
609 ok(ret, "Unexpected ret %#x.\n", ret);
610
611 todo_wine ok(blackbox.right - blackbox.left == glyph_metrics.gmBlackBoxX + 2, "Got %ld, expected %d.\n",
612 blackbox.right - blackbox.left, glyph_metrics.gmBlackBoxX + 2);
613 todo_wine ok(blackbox.bottom - blackbox.top == glyph_metrics.gmBlackBoxY + 2, "Got %ld, expected %d.\n",
614 blackbox.bottom - blackbox.top, glyph_metrics.gmBlackBoxY + 2);
615 ok(cellinc.x == glyph_metrics.gmptGlyphOrigin.x - 1, "Got %ld, expected %ld.\n",
616 cellinc.x, glyph_metrics.gmptGlyphOrigin.x - 1);
617 ok(cellinc.y == tm.tmAscent - glyph_metrics.gmptGlyphOrigin.y - 1, "Got %ld, expected %ld.\n",
618 cellinc.y, tm.tmAscent - glyph_metrics.gmptGlyphOrigin.y - 1);
619
622 }
623
625 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
626
627 /* Test multiple textures */
628 hr = ID3DXFont_PreloadGlyphs(font, 0, 1000);
629 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
630
631 /* Test glyphs that are not rendered */
632 for (glyph = 1; glyph < 4; ++glyph)
633 {
634 texture = (IDirect3DTexture9 *)0xdeadbeef;
635 hr = ID3DXFont_GetGlyphData(font, glyph, &texture, &blackbox, &cellinc);
636 ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
637 ok(!texture, "Got unexpected texture %p.\n", texture);
638 }
639
641
642 c = 'a';
643 for (i = 0; i < ARRAY_SIZE(tests); ++i)
644 {
645 winetest_push_context("Test %u", i);
648 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
649
651 ok(!!hdc, "Unexpected hdc %p.\n", hdc);
652
653 count = GetGlyphIndicesA(hdc, &c, 1, &glyph, 0);
654 ok(count != GDI_ERROR, "Unexpected count %lu.\n", count);
655
657 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
658
660 todo_wine_if(tests[i].expected_levels < 9)
661 ok(levels == tests[i].expected_levels, "Unexpected levels %lu.\n", levels);
662
663 hr = IDirect3DTexture9_GetLevelDesc(texture, 0, &surf_desc);
664 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
665 ok(surf_desc.Format == D3DFMT_A8R8G8B8, "Unexpected format %#x.\n", surf_desc.Format);
666 ok(surf_desc.Usage == 0, "Unexpected usage %#lx.\n", surf_desc.Usage);
667 ok(surf_desc.Width == tests[i].expected_size, "Unexpected width %u.\n", surf_desc.Width);
668 ok(surf_desc.Height == tests[i].expected_size, "Unexpected height %u.\n", surf_desc.Height);
669 ok(surf_desc.Pool == D3DPOOL_MANAGED, "Unexpected pool %u.\n", surf_desc.Pool);
670
672
673 /* ID3DXFontImpl_DrawText */
675 SetRect(&rect, 0, 0, 640, 480);
676
677 IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xff000000, 1.0f, 0);
678
681 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
682
683 height = ID3DXFont_DrawTextW(font, sprite, testW, -1, &rect, DT_TOP, 0xffffffff);
684 ok(height == tests[i].font_height, "Unexpected height %u.\n", height);
686 ok(height == tests[i].font_height, "Unexpected height %u.\n", height);
688 ok(height == tests[i].font_height, "Unexpected height %u.\n", height);
690 ok(height == tests[i].font_height, "Unexpected height %u.\n", height);
691
694 DT_LEFT | DT_CALCRECT, 0xffffffff);
695 ok(height == tests[i].font_height, "Unexpected height %u.\n", height);
696 ok(!rect.left, "Unexpected rect left %ld.\n", rect.left);
697 ok(!rect.top, "Unexpected rect top %ld.\n", rect.top);
698 ok(rect.right, "Unexpected rect right %ld.\n", rect.right);
699 ok(rect.bottom == tests[i].font_height, "Unexpected rect bottom %ld.\n", rect.bottom);
700
702 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
705
708 }
709
710
711 /* ID3DXFont_DrawTextA, ID3DXFont_DrawTextW */
713 DEFAULT_QUALITY, DEFAULT_PITCH, "Tahoma", &font);
714 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
715
716 SetRect(&rect, 10, 10, 200, 200);
717
718 height = ID3DXFont_DrawTextA(font, NULL, "test", -2, &rect, 0, 0xFF00FF);
719 ok(height == 12, "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", 0, &rect, 0, 0xFF00FF);
725 ok(height == 0, "Got unexpected height %d.\n", height);
726
727 height = ID3DXFont_DrawTextA(font, NULL, "test", 1, &rect, 0, 0xFF00FF);
728 ok(height == 12, "Got unexpected height %d.\n", height);
729
730 height = ID3DXFont_DrawTextA(font, NULL, "test", 2, &rect, 0, 0xFF00FF);
731 ok(height == 12, "Got unexpected height %d.\n", height);
732
733 height = ID3DXFont_DrawTextA(font, NULL, "", 0, &rect, 0, 0xff00ff);
734 ok(height == 0, "Got unexpected height %d.\n", height);
735
736 height = ID3DXFont_DrawTextA(font, NULL, "", -1, &rect, 0, 0xff00ff);
737 ok(height == 0, "Got unexpected height %d.\n", height);
738
739 height = ID3DXFont_DrawTextA(font, NULL, "test", -1, NULL, 0, 0xFF00FF);
740 ok(height == 12, "Got unexpected height %d.\n", height);
741
742 height = ID3DXFont_DrawTextA(font, NULL, "test", -1, NULL, DT_CALCRECT, 0xFF00FF);
743 ok(height == 12, "Got unexpected height %d.\n", height);
744
745 height = ID3DXFont_DrawTextA(font, NULL, NULL, -1, NULL, 0, 0xFF00FF);
746 ok(height == 0, "Got unexpected height %d.\n", height);
747
748 SetRect(&rect, 10, 10, 50, 50);
749
750 height = ID3DXFont_DrawTextA(font, NULL, long_text, -1, &rect, DT_WORDBREAK, 0xff00ff);
751 todo_wine ok(height == 60, "Got unexpected height %d.\n", height);
752
753 height = ID3DXFont_DrawTextA(font, NULL, long_text, -1, &rect, DT_WORDBREAK | DT_NOCLIP, 0xff00ff);
754 ok(height == 96, "Got unexpected height %d.\n", height);
755
756 SetRect(&rect, 10, 10, 200, 200);
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, 0, &rect, 0, 0xFF00FF);
762 ok(height == 0, "Got unexpected height %d.\n", height);
763
764 height = ID3DXFont_DrawTextW(font, NULL, testW, 1, &rect, 0, 0xFF00FF);
765 ok(height == 12, "Got unexpected height %d.\n", height);
766
767 height = ID3DXFont_DrawTextW(font, NULL, testW, 2, &rect, 0, 0xFF00FF);
768 ok(height == 12, "Got unexpected height %d.\n", height);
769
770 height = ID3DXFont_DrawTextW(font, NULL, L"", 0, &rect, 0, 0xff00ff);
771 ok(height == 0, "Got unexpected height %d.\n", height);
772
773 height = ID3DXFont_DrawTextW(font, NULL, L"", -1, &rect, 0, 0xff00ff);
774 ok(height == 0, "Got unexpected height %d.\n", height);
775
776 height = ID3DXFont_DrawTextW(font, NULL, testW, -1, NULL, 0, 0xFF00FF);
777 ok(height == 12, "Got unexpected height %d.\n", height);
778
780 ok(height == 12, "Got unexpected height %d.\n", height);
781
782 height = ID3DXFont_DrawTextW(font, NULL, NULL, -1, NULL, 0, 0xFF00FF);
783 ok(height == 0, "Got unexpected height %d.\n", height);
784
785 SetRect(&rect, 10, 10, 50, 50);
786
787 height = ID3DXFont_DrawTextW(font, NULL, long_textW, -1, &rect, DT_WORDBREAK, 0xff00ff);
788 todo_wine ok(height == 60, "Got unexpected height %d.\n", height);
789
790 height = ID3DXFont_DrawTextW(font, NULL, long_textW, -1, &rect, DT_WORDBREAK | DT_NOCLIP, 0xff00ff);
791 ok(height == 96, "Got unexpected height %d.\n", height);
792
793 height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, NULL, 0, 0xff00ff);
794 ok(height == 24, "Got unexpected height %d.\n", height);
795
796 height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, 0, 0xff00ff);
797 ok(height == 24, "Got unexpected height %d.\n", height);
798
799 height = ID3DXFont_DrawTextW(font, NULL, L"a\r\na", -1, &rect, 0, 0xff00ff);
800 ok(height == 24, "Got unexpected height %d.\n", height);
801
802 height = ID3DXFont_DrawTextW(font, NULL, L"a\ra", -1, &rect, 0, 0xff00ff);
803 ok(height == 12, "Got unexpected height %d.\n", height);
804
805 height = ID3DXFont_DrawTextW(font, NULL, L"a\na", -1, &rect, DT_SINGLELINE, 0xff00ff);
806 ok(height == 12, "Got unexpected height %d.\n", height);
807
808 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_SINGLELINE, 0xff00ff);
809 ok(height == 12, "Got unexpected height %d.\n", height);
810
811 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, 0, 0xff00ff);
812 ok(height == 24, "Got unexpected height %d.\n", height);
813
814 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
815 ok(height == 36, "Got unexpected height %d.\n", height);
816
817 height = ID3DXFont_DrawTextW(font, NULL, L"a\naaaaa aaaa", -1, &rect, DT_WORDBREAK | DT_SINGLELINE, 0xff00ff);
818 ok(height == 12, "Got unexpected height %d.\n", height);
819
820 height = ID3DXFont_DrawTextW(font, NULL, L"1\n2\n3\n4\n5\n6", -1, &rect, 0, 0xff00ff);
821 ok(height == 48, "Got unexpected height %d.\n", height);
822
823 height = ID3DXFont_DrawTextW(font, NULL, L"1\n2\n3\n4\n5\n6", -1, &rect, DT_NOCLIP, 0xff00ff);
824 ok(height == 72, "Got unexpected height %d.\n", height);
825
826 height = ID3DXFont_DrawTextW(font, NULL, L"\t\t\t\t\t\t\t\t\t\t", -1, &rect, DT_WORDBREAK, 0xff00ff);
827 todo_wine ok(height == 0, "Got unexpected height %d.\n", height);
828
829 height = ID3DXFont_DrawTextW(font, NULL, L"\t\t\t\t\t\t\t\t\t\ta", -1, &rect, DT_WORDBREAK, 0xff00ff);
830 todo_wine ok(height == 12, "Got unexpected height %d.\n", height);
831
832 height = ID3DXFont_DrawTextW(font, NULL, L"\taaaaaaaaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
833 todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
834
835 height = ID3DXFont_DrawTextW(font, NULL, L"\taaaaaaaaaa", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
836 ok(height == 36, "Got unexpected height %d.\n", height);
837
838 height = ID3DXFont_DrawTextW(font, NULL, L"\taaa\taaa\taaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
839 ok(height == 24, "Got unexpected height %d.\n", height);
840
841 height = ID3DXFont_DrawTextW(font, NULL, L"\taaa\taaa\taaa", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
842 todo_wine ok(height == 48, "Got unexpected height %d.\n", height);
843
844 height = ID3DXFont_DrawTextW(font, NULL, L"\t\t\t\t\t\t\t\t\t\t", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
845 todo_wine ok(height == 60, "Got unexpected height %d.\n", height);
846
847 height = ID3DXFont_DrawTextW(font, NULL, L"a\ta", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
848 ok(height == 12, "Got unexpected height %d.\n", height);
849
850 height = ID3DXFont_DrawTextW(font, NULL, L"a\ta\ta", -1, &rect, DT_EXPANDTABS | DT_WORDBREAK, 0xff00ff);
851 todo_wine ok(height == 24, "Got unexpected height %d.\n", height);
852
853 height = ID3DXFont_DrawTextW(font, NULL, L"aaaaaaaaaaaaaaaaaaaa", -1, &rect, DT_WORDBREAK, 0xff00ff);
854 ok(height == 36, "Got unexpected height %d.\n", height);
855
856 height = ID3DXFont_DrawTextW(font, NULL, L"a a", -1, &rect, DT_WORDBREAK, 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, 0xff00ff);
860 ok(height == 36, "Got unexpected height %d.\n", height);
861
862 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_RIGHT, 0xff00ff);
863 ok(height == 36, "Got unexpected height %d.\n", height);
864
865 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CENTER, 0xff00ff);
866 ok(height == 36, "Got unexpected height %d.\n", height);
867
868 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM, 0xff00ff);
869 ok(height == 40, "Got unexpected height %d.\n", height);
870
871 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER, 0xff00ff);
872 ok(height == 32, "Got unexpected height %d.\n", height);
873
874 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT, 0xff00ff);
875 ok(height == 24, "Got unexpected height %d.\n", height);
876
877 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER, 0xff00ff);
878 ok(height == 24, "Got unexpected height %d.\n", height);
879
880 SetRect(&rect, 10, 10, 50, 50);
881 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
882 ok(height == 24, "Got unexpected height %d.\n", height);
883 check_rect(&rect, 10, 10, 30, 34);
884
885 SetRect(&rect, -10, 10, 30, 50);
886 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
887 ok(height == 24, "Got unexpected height %d.\n", height);
888 check_rect(&rect, -10, 10, 10, 34);
889
890 SetRect(&rect, 10, -10, 50, 30);
891 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
892 ok(height == 24, "Got unexpected height %d.\n", height);
893 check_rect(&rect, 10, -10, 30, 14);
894
895 SetRect(&rect, 10, 10, -30, 50);
896 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
897 ok(height == 24, "Got unexpected height %d.\n", height);
898 check_rect(&rect, 10, 10, 30, 34);
899
900 SetRect(&rect, 10, 10, 50, -30);
901 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CALCRECT, 0xff00ff);
902 ok(height == 24, "Got unexpected height %d.\n", height);
903 check_rect(&rect, 10, 10, 30, 34);
904
905 SetRect(&rect, 10, 10, 50, 50);
906 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
907 ok(height == 24, "Got unexpected height %d.\n", height);
908 check_rect(&rect, 10, 10, 30, 34);
909
910 SetRect(&rect, -10, 10, 30, 50);
911 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
912 ok(height == 24, "Got unexpected height %d.\n", height);
913 check_rect(&rect, -10, 10, 10, 34);
914
915 SetRect(&rect, 10, -10, 50, 30);
916 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
917 ok(height == 24, "Got unexpected height %d.\n", height);
918 check_rect(&rect, 10, -10, 30, 14);
919
920 SetRect(&rect, 10, 10, -30, 50);
921 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
922 ok(height == 12, "Got unexpected height %d.\n", height);
923 check_rect(&rect, 10, 10, 53, 22);
924
925 SetRect(&rect, 10, 10, 50, -30);
926 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
927 ok(height == 24, "Got unexpected height %d.\n", height);
928 check_rect(&rect, 10, 10, 30, 34);
929
930 SetRect(&rect, 10, 10, 50, 50);
931 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
932 ok(height == 40, "Got unexpected height %d.\n", height);
933 check_rect(&rect, 10, 26, 30, 50);
934
935 SetRect(&rect, -10, 10, 30, 50);
936 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
937 ok(height == 40, "Got unexpected height %d.\n", height);
938 check_rect(&rect, -10, 26, 10, 50);
939
940 SetRect(&rect, 10, -10, 50, 30);
941 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
942 ok(height == 40, "Got unexpected height %d.\n", height);
943 check_rect(&rect, 10, 6, 30, 30);
944
945 SetRect(&rect, 10, 10, -30, 50);
946 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
947 ok(height == 40, "Got unexpected height %d.\n", height);
948 check_rect(&rect, 10, 26, 30, 50);
949
950 SetRect(&rect, 10, 10, 50, -30);
951 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_BOTTOM | DT_CALCRECT, 0xff00ff);
952 ok(height == -40, "Got unexpected height %d.\n", height);
953 check_rect(&rect, 10, -54, 30, -30);
954
955 SetRect(&rect, 10, 10, 50, 50);
956 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
957 ok(height == 40, "Got unexpected height %d.\n", height);
958 check_rect(&rect, 10, 26, 30, 50);
959
960 SetRect(&rect, -10, 10, 30, 50);
961 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
962 ok(height == 40, "Got unexpected height %d.\n", height);
963 check_rect(&rect, -10, 26, 10, 50);
964
965 SetRect(&rect, 10, -10, 50, 30);
966 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
967 ok(height == 40, "Got unexpected height %d.\n", height);
968 check_rect(&rect, 10, 6, 30, 30);
969
970 SetRect(&rect, 10, 10, -30, 50);
971 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
972 ok(height == 40, "Got unexpected height %d.\n", height);
973 check_rect(&rect, 10, 38, 53, 50);
974
975 SetRect(&rect, 10, 10, 50, -30);
976 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_BOTTOM | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
977 ok(height == -40, "Got unexpected height %d.\n", height);
978 check_rect(&rect, 10, -54, 30, -30);
979
980 SetRect(&rect, 10, 10, 50, 50);
981 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
982 ok(height == 32, "Got unexpected height %d.\n", height);
983 check_rect(&rect, 10, 18, 30, 42);
984
985 SetRect(&rect, -10, 10, 30, 50);
986 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
987 ok(height == 32, "Got unexpected height %d.\n", height);
988 check_rect(&rect, -10, 18, 10, 42);
989
990 SetRect(&rect, 10, -10, 50, 30);
991 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
992 ok(height == 32, "Got unexpected height %d.\n", height);
993 check_rect(&rect, 10, -2, 30, 22);
994
995 SetRect(&rect, 10, 10, -30, 50);
996 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
997 ok(height == 32, "Got unexpected height %d.\n", height);
998 check_rect(&rect, 10, 18, 30, 42);
999
1000 SetRect(&rect, 10, 10, 50, -30);
1001 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_VCENTER | DT_CALCRECT, 0xff00ff);
1002 ok(height == -8, "Got unexpected height %d.\n", height);
1003 check_rect(&rect, 10, -22, 30, 2);
1004
1005 SetRect(&rect, 10, 10, 50, 50);
1006 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1007 ok(height == 32, "Got unexpected height %d.\n", height);
1008 check_rect(&rect, 10, 18, 30, 42);
1009
1010 SetRect(&rect, -10, 10, 30, 50);
1011 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1012 ok(height == 32, "Got unexpected height %d.\n", height);
1013 check_rect(&rect, -10, 18, 10, 42);
1014
1015 SetRect(&rect, 10, -10, 50, 30);
1016 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1017 ok(height == 32, "Got unexpected height %d.\n", height);
1018 check_rect(&rect, 10, -2, 30, 22);
1019
1020 SetRect(&rect, 10, 10, -30, 50);
1021 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1022 ok(height == 26, "Got unexpected height %d.\n", height);
1023 check_rect(&rect, 10, 24, 53, 36);
1024
1025 SetRect(&rect, 10, 10, 50, -30);
1026 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1027 ok(height == -8, "Got unexpected height %d.\n", height);
1028 check_rect(&rect, 10, -22, 30, 2);
1029
1030 SetRect(&rect, 10, 10, 50, 50);
1031 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1032 ok(height == 24, "Got unexpected height %d.\n", height);
1033 check_rect(&rect, 30, 10, 50, 34);
1034
1035 SetRect(&rect, -10, 10, 30, 50);
1036 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1037 ok(height == 24, "Got unexpected height %d.\n", height);
1038 check_rect(&rect, 10, 10, 30, 34);
1039
1040 SetRect(&rect, 10, -10, 50, 30);
1041 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1042 ok(height == 24, "Got unexpected height %d.\n", height);
1043 check_rect(&rect, 30, -10, 50, 14);
1044
1045 SetRect(&rect, 10, 10, -30, 50);
1046 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1047 ok(height == 24, "Got unexpected height %d.\n", height);
1048 check_rect(&rect, -50, 10, -30, 34);
1049
1050 SetRect(&rect, 10, 10, 50, -30);
1051 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_RIGHT | DT_CALCRECT, 0xff00ff);
1052 ok(height == 24, "Got unexpected height %d.\n", height);
1053 check_rect(&rect, 30, 10, 50, 34);
1054
1055 SetRect(&rect, 10, 10, 50, 50);
1056 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1057 ok(height == 24, "Got unexpected height %d.\n", height);
1058 check_rect(&rect, 30, 10, 50, 34);
1059
1060 SetRect(&rect, -10, 10, 30, 50);
1061 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1062 ok(height == 24, "Got unexpected height %d.\n", height);
1063 check_rect(&rect, 10, 10, 30, 34);
1064
1065 SetRect(&rect, 10, -10, 50, 30);
1066 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1067 ok(height == 24, "Got unexpected height %d.\n", height);
1068 check_rect(&rect, 30, -10, 50, 14);
1069
1070 SetRect(&rect, 10, 10, -30, 50);
1071 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1072 ok(height == 12, "Got unexpected height %d.\n", height);
1073 check_rect(&rect, -73, 10, -30, 22);
1074
1075 SetRect(&rect, 10, 10, 50, -30);
1076 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_RIGHT | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1077 ok(height == 24, "Got unexpected height %d.\n", height);
1078 check_rect(&rect, 30, 10, 50, 34);
1079
1080 SetRect(&rect, 10, 10, 50, 50);
1081 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1082 ok(height == 24, "Got unexpected height %d.\n", height);
1083 check_rect(&rect, 20, 10, 40, 34);
1084
1085 SetRect(&rect, -10, 10, 30, 50);
1086 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1087 ok(height == 24, "Got unexpected height %d.\n", height);
1088 check_rect(&rect, 0, 10, 20, 34);
1089
1090 SetRect(&rect, 10, -10, 50, 30);
1091 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1092 ok(height == 24, "Got unexpected height %d.\n", height);
1093 check_rect(&rect, 20, -10, 40, 14);
1094
1095 SetRect(&rect, 10, 10, -30, 50);
1096 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1097 ok(height == 24, "Got unexpected height %d.\n", height);
1098 check_rect(&rect, -20, 10, 0, 34);
1099
1100 SetRect(&rect, 10, 10, 50, -30);
1101 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_CALCRECT, 0xff00ff);
1102 ok(height == 24, "Got unexpected height %d.\n", height);
1103 check_rect(&rect, 20, 10, 40, 34);
1104
1105 SetRect(&rect, 10, 10, 50, 50);
1106 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1107 ok(height == 24, "Got unexpected height %d.\n", height);
1108 check_rect(&rect, 20, 10, 40, 34);
1109
1110 SetRect(&rect, -10, 10, 30, 50);
1111 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1112 ok(height == 24, "Got unexpected height %d.\n", height);
1113 check_rect(&rect, 0, 10, 20, 34);
1114
1115 SetRect(&rect, 10, -10, 50, 30);
1116 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1117 ok(height == 24, "Got unexpected height %d.\n", height);
1118 check_rect(&rect, 20, -10, 40, 14);
1119
1120 SetRect(&rect, 10, 10, -30, 50);
1121 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1122 ok(height == 12, "Got unexpected height %d.\n", height);
1123 check_rect(&rect, -31, 10, 12, 22);
1124
1125 SetRect(&rect, 10, 10, 50, -30);
1126 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1127 ok(height == 24, "Got unexpected height %d.\n", height);
1128 check_rect(&rect, 20, 10, 40, 34);
1129
1130 SetRect(&rect, 10, 10, 50, 50);
1131 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1132 ok(height == 32, "Got unexpected height %d.\n", height);
1133 check_rect(&rect, 20, 18, 40, 42);
1134
1135 SetRect(&rect, 10, 10, 50, 50);
1136 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1137 ok(height == 32, "Got unexpected height %d.\n", height);
1138 check_rect(&rect, 20, 18, 40, 42);
1139
1140 SetRect(&rect, -10, 10, 30, 50);
1141 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1142 ok(height == 32, "Got unexpected height %d.\n", height);
1143 check_rect(&rect, 0, 18, 20, 42);
1144
1145 SetRect(&rect, 10, -10, 50, 30);
1146 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1147 ok(height == 32, "Got unexpected height %d.\n", height);
1148 check_rect(&rect, 20, -2, 40, 22);
1149
1150 SetRect(&rect, 10, 10, -30, 50);
1151 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1152 ok(height == 32, "Got unexpected height %d.\n", height);
1153 check_rect(&rect, -20, 18, 0, 42);
1154
1155 SetRect(&rect, 10, 10, 50, -30);
1156 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa\naaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_CALCRECT, 0xff00ff);
1157 ok(height == -8, "Got unexpected height %d.\n", height);
1158 check_rect(&rect, 20, -22, 40, 2);
1159
1160 SetRect(&rect, 10, 10, 50, 50);
1161 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1162 ok(height == 32, "Got unexpected height %d.\n", height);
1163 check_rect(&rect, 20, 18, 40, 42);
1164
1165 SetRect(&rect, 10, 10, 50, 50);
1166 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1167 ok(height == 32, "Got unexpected height %d.\n", height);
1168 check_rect(&rect, 20, 18, 40, 42);
1169
1170 SetRect(&rect, -10, 10, 30, 50);
1171 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1172 ok(height == 32, "Got unexpected height %d.\n", height);
1173 check_rect(&rect, 0, 18, 20, 42);
1174
1175 SetRect(&rect, 10, -10, 50, 30);
1176 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1177 ok(height == 32, "Got unexpected height %d.\n", height);
1178 check_rect(&rect, 20, -2, 40, 22);
1179
1180 SetRect(&rect, 10, 10, -30, 50);
1181 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1182 ok(height == 26, "Got unexpected height %d.\n", height);
1183 check_rect(&rect, -31, 24, 12, 36);
1184
1185 SetRect(&rect, 10, 10, 50, -30);
1186 height = ID3DXFont_DrawTextW(font, NULL, L"aaaa aaaa", -1, &rect, DT_CENTER | DT_VCENTER | DT_WORDBREAK | DT_CALCRECT, 0xff00ff);
1187 ok(height == -8, "Got unexpected height %d.\n", height);
1188 check_rect(&rect, 20, -22, 40, 2);
1189
1191}
1192
1194{
1195 int i;
1196 HRESULT hr;
1197 ULONG ref_count;
1199 ID3DXRenderToSurface *render = (void *)0xdeadbeef;
1200 static const D3DXRTS_DESC tests[] =
1201 {
1202 { 0, 256, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN },
1203 { 256, 0, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN },
1204 { 256, 0, D3DFMT_A8R8G8B8, FALSE, D3DFMT_D24S8 },
1205 { 256, 256, D3DFMT_UNKNOWN, FALSE, D3DFMT_R8G8B8 },
1207 { -1, -1, MAKEFOURCC('B','A','D','F'), TRUE, MAKEFOURCC('B','A','D','F') }
1208 };
1209
1211 ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
1212 ok(render == (void *)0xdeadbeef, "Got %p, expected %p\n", render, (void *)0xdeadbeef);
1213
1215 ok(hr == D3DERR_INVALIDCALL, "Unexpected hr %#lx.\n", hr);
1216
1217 for (i = 0; i < ARRAY_SIZE(tests); ++i)
1218 {
1219 winetest_push_context("Test %u", i);
1221 tests[i].DepthStencilFormat, &render);
1222 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
1224 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
1225 ok(desc.Width == tests[i].Width, "Width %u, expected %u.\n", desc.Width, tests[i].Width);
1226 ok(desc.Height == tests[i].Height, "Height %u, expected %u.\n", desc.Height, tests[i].Height);
1227 ok(desc.Format == tests[i].Format, "Format %#x, expected %#x.\n", desc.Format, tests[i].Format);
1228 ok(desc.DepthStencil == tests[i].DepthStencil, "Depth stencil %d, expected %d.\n",
1229 desc.DepthStencil, tests[i].DepthStencil);
1230 ok(desc.DepthStencilFormat == tests[i].DepthStencilFormat, "Depth stencil format %#x, expected %#x.\n",
1231 desc.DepthStencilFormat, tests[i].DepthStencilFormat);
1234 }
1235
1236 /* check device ref count */
1237 ref_count = get_ref((IUnknown *)device);
1239 check_ref((IUnknown *)device, ref_count + 1);
1241}
1242
1243/* runs a set of tests for the ID3DXRenderToSurface interface created with given parameters */
1245 BOOL depth_stencil, D3DFORMAT depth_stencil_format, BOOL render_target)
1246{
1247 HRESULT hr;
1248 D3DFORMAT fmt;
1249 HRESULT expected_value;
1250 IDirect3DSurface9 *surface;
1251 ID3DXRenderToSurface *render;
1252 D3DVIEWPORT9 viewport = { 0, 0, width, height, 0.0, 1.0 };
1253
1255 if (FAILED(hr))
1256 {
1257 skip("Failed to create ID3DXRenderToSurface\n");
1258 return;
1259 }
1260
1261 if (render_target)
1263 else
1265 if (FAILED(hr))
1266 {
1267 skip("Failed to create surface\n");
1269 return;
1270 }
1271
1272 /* viewport */
1273 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1274 ok(hr == D3D_OK, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3D_OK);
1275 check_ref((IUnknown *)surface, 2);
1277
1278 /* invalid viewport */
1279 viewport.Width = 2 * width;
1280 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1281 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1282
1283 viewport.X = width / 2;
1284 viewport.Width = width;
1285 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1286 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1287
1288 viewport.X = width;
1289 viewport.Width = width;
1290 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1291 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1292
1293 /* rendering to a part of a surface is only allowed for render target surfaces */
1294 expected_value = render_target ? D3D_OK : D3DERR_INVALIDCALL;
1295
1296 viewport.X = 0;
1297 viewport.Width = width / 2;
1298 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1299 ok(hr == expected_value, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, expected_value);
1301
1302 viewport.X = width / 2;
1303 viewport.Width = width - width / 2;
1304 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1305 ok(hr == expected_value, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, expected_value);
1307
1308 check_release((IUnknown *)surface, 0);
1309
1310 /* surfaces with different sizes */
1312 if (FAILED(hr))
1313 {
1314 skip("Failed to create surface\n");
1316 return;
1317 }
1319 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1320 check_release((IUnknown *)surface, 0);
1321
1323 if (FAILED(hr))
1324 {
1325 skip("Failed to create surface\n");
1327 return;
1328 }
1330 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1331 viewport.X = 0;
1332 viewport.Y = 0;
1333 viewport.Width = width;
1334 viewport.Height = height;
1335 hr = ID3DXRenderToSurface_BeginScene(render, surface, &viewport);
1336 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1337 check_release((IUnknown *)surface, 0);
1338
1339 /* surfaces with different formats */
1341 {
1343
1345 if (FAILED(hr))
1346 {
1347 skip("Failed to create surface\n");
1348 continue;
1349 }
1350
1352 ok(hr == expected_result, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, expected_result);
1353
1355 check_release((IUnknown *)surface, 0);
1356 }
1357
1359}
1360
1361struct device_state
1362{
1366};
1367
1369{
1370 if (state->render_target) IDirect3DSurface9_Release(state->render_target);
1371 if (state->depth_stencil) IDirect3DSurface9_Release(state->depth_stencil);
1372 memset(state, 0, sizeof(*state));
1373}
1374
1376{
1377 HRESULT hr;
1378
1379 memset(state, 0, sizeof(*state));
1380
1381 hr = IDirect3DDevice9_GetRenderTarget(device, 0, &state->render_target);
1382 if (FAILED(hr)) goto cleanup;
1383
1385 if (hr == D3DERR_NOTFOUND)
1386 state->depth_stencil = NULL;
1387 else if (FAILED(hr))
1388 goto cleanup;
1389
1391 if (SUCCEEDED(hr)) return hr;
1392
1393cleanup:
1395 return hr;
1396}
1397
1399{
1400 HRESULT hr;
1402
1403 hr = IDirect3DDevice9_SetRenderTarget(device, 0, state->render_target);
1404 if (FAILED(hr)) status = hr;
1405
1407 if (FAILED(hr)) status = hr;
1408
1410 if (FAILED(hr)) status = hr;
1411
1412 return status;
1413}
1414
1415static void compare_device_state(struct device_state *state1, struct device_state *state2, BOOL equal)
1416{
1417 BOOL cmp;
1418 const char *message = equal ? "differs" : "is the same";
1419
1420 cmp = state1->render_target == state2->render_target;
1421 ok(equal ? cmp : !cmp, "Render target %s %p, %p\n", message, state1->render_target, state2->render_target);
1422
1423 cmp = state1->depth_stencil == state2->depth_stencil;
1424 ok(equal ? cmp : !cmp, "Depth stencil surface %s %p, %p\n", message, state1->depth_stencil, state2->depth_stencil);
1425
1426 cmp = state1->viewport.X == state2->viewport.X && state1->viewport.Y == state2->viewport.Y
1427 && state1->viewport.Width == state2->viewport.Width && state1->viewport.Height == state2->viewport.Height;
1428 ok(equal ? cmp : !cmp, "Viewport %s (%lu, %lu, %lu, %lu), (%lu, %lu, %lu, %lu)\n", message,
1429 state1->viewport.X, state1->viewport.Y, state1->viewport.Width, state1->viewport.Height,
1430 state2->viewport.X, state2->viewport.Y, state2->viewport.Width, state2->viewport.Height);
1431}
1432
1434{
1435 HRESULT hr;
1436 IDirect3DSurface9 *surface = NULL;
1437 ID3DXRenderToSurface *render = NULL;
1438 struct device_state pre_state;
1439 struct device_state current_state;
1440 IDirect3DSurface9 *depth_stencil_surface;
1441
1442 /* make sure there is a depth stencil surface present */
1443 hr = IDirect3DDevice9_GetDepthStencilSurface(device, &depth_stencil_surface);
1444 if (SUCCEEDED(hr))
1445 {
1446 IDirect3DSurface9_Release(depth_stencil_surface);
1447 depth_stencil_surface = NULL;
1448 }
1449 else if (hr == D3DERR_NOTFOUND)
1450 {
1452 D3DMULTISAMPLE_NONE, 0, TRUE, &depth_stencil_surface, NULL);
1453 if (SUCCEEDED(hr)) IDirect3DDevice9_SetDepthStencilSurface(device, depth_stencil_surface);
1454 }
1455
1456 if (FAILED(hr))
1457 {
1458 skip("Failed to create depth stencil surface\n");
1459 return;
1460 }
1461
1463 FALSE, &surface, NULL);
1464 if (FAILED(hr))
1465 {
1466 skip("Failed to create render target\n");
1467 goto cleanup;
1468 }
1469
1470 hr = retrieve_device_state(device, &pre_state);
1471 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1472
1474 ok(hr == D3D_OK, "D3DXCreateRenderToSurface returned %#lx, expected %#lx\n", hr, D3D_OK);
1475 if (SUCCEEDED(hr))
1476 {
1478 ok(hr == D3D_OK, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3D_OK);
1479
1480 hr = retrieve_device_state(device, &current_state);
1481 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1482 compare_device_state(&current_state, &pre_state, FALSE);
1483 release_device_state(&current_state);
1484
1486 ok(hr == D3D_OK, "ID3DXRenderToSurface::EndScene returned %#lx, expected %#lx\n", hr, D3D_OK);
1487
1488 hr = retrieve_device_state(device, &current_state);
1489 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1490 compare_device_state(&current_state, &pre_state, TRUE);
1491 release_device_state(&current_state);
1492
1494 }
1495
1497 if (SUCCEEDED(hr))
1498 {
1500 ok(hr == D3D_OK, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3D_OK);
1501
1502 hr = retrieve_device_state(device, &current_state);
1503 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1504 compare_device_state(&current_state, &pre_state, FALSE);
1505 release_device_state(&current_state);
1506
1508 ok(hr == D3D_OK, "ID3DXRenderToSurface::EndScene returned %#lx, expected %#lx\n", hr, D3D_OK);
1509
1510 hr = retrieve_device_state(device, &current_state);
1511 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1512 compare_device_state(&current_state, &pre_state, TRUE);
1513 release_device_state(&current_state);
1514
1516 ok(hr == D3D_OK, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3D_OK);
1517
1518 hr = retrieve_device_state(device, &current_state);
1519 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1520 compare_device_state(&current_state, &pre_state, FALSE);
1521 release_device_state(&current_state);
1522
1524
1525 /* if EndScene isn't called, the device state isn't restored */
1526 hr = retrieve_device_state(device, &current_state);
1527 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1528 compare_device_state(&current_state, &pre_state, FALSE);
1529 release_device_state(&current_state);
1530
1531 hr = apply_device_state(device, &pre_state);
1532 ok(SUCCEEDED(hr), "Failed to restore previous device state\n");
1533
1535 }
1536
1537 release_device_state(&pre_state);
1538
1539cleanup:
1540 if (depth_stencil_surface)
1541 {
1543 IDirect3DSurface9_Release(depth_stencil_surface);
1544 }
1545
1546 if (surface) check_release((IUnknown *)surface, 0);
1547}
1548
1550{
1551 int i;
1552 HRESULT hr;
1553 ULONG ref_count;
1554 IDirect3DDevice9 *out_device;
1555 ID3DXRenderToSurface *render;
1556 IDirect3DSurface9 *surface;
1557 D3DVIEWPORT9 viewport = { 0, 0, 256, 256, 0.0, 1.0 };
1558 D3DXRTS_DESC tests[] = {
1559 { 256, 256, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN },
1560 { 256, 256, D3DFMT_A8R8G8B8, TRUE, D3DFMT_D24S8 },
1561 { 256, 256, D3DFMT_A8R8G8B8, TRUE, D3DFMT_D24X8 },
1562 { 512, 512, D3DFMT_X8R8G8B8, FALSE, D3DFMT_X8R8G8B8 },
1563 { 1024, 1024, D3DFMT_X8R8G8B8, TRUE, D3DFMT_D24S8 }
1564 };
1565
1567 ok(hr == D3D_OK, "D3DXCreateRenderToSurface returned %#lx, expected %#lx\n", hr, D3D_OK);
1568 if (FAILED(hr)) return;
1569
1571 if (SUCCEEDED(hr))
1572 {
1573 ID3DXRenderToSurface *render_surface;
1574
1575 /* GetDevice */
1577 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::GetDevice returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1578
1579 ref_count = get_ref((IUnknown *)device);
1581 ok(hr == D3D_OK, "ID3DXRenderToSurface::GetDevice returned %#lx, expected %#lx\n", hr, D3D_OK);
1582 check_release((IUnknown *)out_device, ref_count);
1583
1584 /* BeginScene and EndScene */
1586 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::EndScene returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1587
1589 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1590
1591 ref_count = get_ref((IUnknown *)surface);
1593 ok(hr == D3D_OK, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3D_OK);
1594 if (SUCCEEDED(hr))
1595 {
1596 check_ref((IUnknown *)surface, ref_count + 1);
1597
1599 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1600
1602 ok(hr == D3D_OK, "ID3DXRenderToSurface::EndScene returned %#lx, expected %#lx\n", hr, D3D_OK);
1603
1604 check_ref((IUnknown *)surface, ref_count);
1605 }
1606
1607 /* error handling is deferred to BeginScene */
1608 hr = D3DXCreateRenderToSurface(device, 256, 256, D3DFMT_A8R8G8B8, TRUE, D3DFMT_UNKNOWN, &render_surface);
1609 ok(hr == D3D_OK, "D3DXCreateRenderToSurface returned %#lx, expected %#lx\n", hr, D3D_OK);
1610 hr = ID3DXRenderToSurface_BeginScene(render_surface, surface, NULL);
1611 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToSurface::BeginScene returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1612 check_release((IUnknown *)render_surface, 0);
1613
1614 check_release((IUnknown *)surface, 0);
1615 }
1616 else skip("Failed to create surface\n");
1617
1619
1620 for (i = 0; i < ARRAY_SIZE(tests); i++)
1621 {
1622 check_ID3DXRenderToSurface(device, tests[i].Width, tests[i].Height, tests[i].Format, tests[i].DepthStencil, tests[i].DepthStencilFormat, TRUE);
1623 check_ID3DXRenderToSurface(device, tests[i].Width, tests[i].Height, tests[i].Format, tests[i].DepthStencil, tests[i].DepthStencilFormat, FALSE);
1624 }
1625
1627}
1628
1630{
1631 int i;
1632 HRESULT hr;
1633 ULONG ref_count;
1635 ID3DXRenderToEnvMap *render;
1636 static const struct {
1638 D3DXRTE_DESC expected_values;
1639 } tests[] = {
1642 { { 256, 4, D3DFMT_A8R8G8B8, FALSE, D3DFMT_D24S8 }, { 256, 4, D3DFMT_A8R8G8B8, FALSE, D3DFMT_D24S8 } },
1643 { { 256, 256, D3DFMT_UNKNOWN, FALSE, D3DFMT_R8G8B8 }, { 256, 9, D3DFMT_A8R8G8B8, FALSE, D3DFMT_R8G8B8 } },
1644 { { -1, -1, D3DFMT_A8R8G8B8, TRUE, D3DFMT_DXT1 }, { 256, 9, D3DFMT_A8R8G8B8, TRUE, D3DFMT_DXT1 } },
1645 { { 256, 1, D3DFMT_X8R8G8B8, TRUE, D3DFMT_UNKNOWN }, { 256, 1, D3DFMT_X8R8G8B8, TRUE, D3DFMT_UNKNOWN } }
1646 };
1647
1648 for (i = 0; i < ARRAY_SIZE(tests); ++i)
1649 {
1650 const D3DXRTE_DESC *parameters = &tests[i].parameters;
1651 const D3DXRTE_DESC *expected = &tests[i].expected_values;
1652
1653 winetest_push_context("Test %u", i);
1654 hr = D3DXCreateRenderToEnvMap(device, parameters->Size, parameters->MipLevels, parameters->Format,
1655 parameters->DepthStencil, parameters->DepthStencilFormat, &render);
1656 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
1658 ok(hr == D3D_OK, "Unexpected hr %#lx.\n", hr);
1659 ok(desc.Size == expected->Size, "Got size %u, expected %u.\n", desc.Size, expected->Size);
1660 ok(desc.MipLevels == expected->MipLevels, "Got miplevels %u, expected %u.\n", desc.MipLevels, expected->MipLevels);
1661 ok(desc.Format == expected->Format, "Got format %#x, expected %#x.\n", desc.Format, expected->Format);
1662 ok(desc.DepthStencil == expected->DepthStencil, "Got depth stencil %d, expected %d.\n",
1663 expected->DepthStencil, expected->DepthStencil);
1664 ok(desc.DepthStencilFormat == expected->DepthStencilFormat, "Got depth stencil format %#x, expected %#x\n",
1665 expected->DepthStencilFormat, expected->DepthStencilFormat);
1668 }
1669
1670 /* check device ref count */
1671 ref_count = get_ref((IUnknown *)device);
1673 check_ref((IUnknown *)device, ref_count + 1);
1675}
1676
1678{
1679 HRESULT hr;
1680 IDirect3DCubeTexture9 *cube_texture = NULL;
1681 ID3DXRenderToEnvMap *render = NULL;
1682 struct device_state pre_state;
1683 struct device_state current_state;
1684
1686 &cube_texture, NULL);
1687 if (FAILED(hr))
1688 {
1689 skip("Failed to create cube texture\n");
1690 return;
1691 }
1692
1693 hr = retrieve_device_state(device, &pre_state);
1694 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1695
1697 ok(hr == D3D_OK, "D3DCreateRenderToEnvMap returned %#lx, expected %#lx\n", hr, D3D_OK);
1698 if (SUCCEEDED(hr))
1699 {
1700 DWORD face;
1701
1703 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::End returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1704
1705 hr = ID3DXRenderToEnvMap_BeginCube(render, cube_texture);
1706 ok(hr == D3D_OK, "ID3DXRenderToEnvMap::BeginCube returned %#lx, expected %#lx\n", hr, D3D_OK);
1707
1708 hr = retrieve_device_state(device, &current_state);
1709 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1710 compare_device_state(&current_state, &pre_state, TRUE);
1711 release_device_state(&current_state);
1712
1714 {
1716 ok(hr == D3D_OK, "ID3DXRenderToEnvMap::Face returned %#lx, expected %#lx\n", hr, D3D_OK);
1717
1718 hr = retrieve_device_state(device, &current_state);
1719 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1720 compare_device_state(&current_state, &pre_state, FALSE);
1721 release_device_state(&current_state);
1722 }
1723
1725 ok(hr == D3D_OK, "ID3DXRenderToEnvMap::End returned %#lx, expected %#lx\n", hr, D3D_OK);
1726
1727 hr = retrieve_device_state(device, &current_state);
1728 ok(SUCCEEDED(hr), "Failed to retrieve device state\n");
1729 compare_device_state(&current_state, &pre_state, TRUE);
1730 release_device_state(&current_state);
1731
1733 }
1734
1735 release_device_state(&pre_state);
1736
1737 check_release((IUnknown *)cube_texture, 0);
1738}
1739
1741{
1742 HRESULT hr;
1743 ID3DXRenderToEnvMap *render;
1744 IDirect3DSurface9 *depth_stencil_surface;
1745
1747 if (SUCCEEDED(hr))
1748 {
1749 ULONG ref_count;
1750 IDirect3DDevice9 *out_device;
1751
1753 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::GetDesc returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1754
1756 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::GetDevice returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1757
1758 ref_count = get_ref((IUnknown *)device);
1759 hr = ID3DXRenderToEnvMap_GetDevice(render, &out_device);
1760 ok(hr == D3D_OK, "ID3DXRenderToEnvMap::GetDevice returned %#lx, expected %#lx\n", hr, D3D_OK);
1761 ok(out_device == device, "ID3DXRenderToEnvMap::GetDevice returned different device\n");
1762 check_release((IUnknown *)device, ref_count);
1763
1765 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::End returned %#lx, expected %#lx\n", hr, D3D_OK);
1766
1768 ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::BeginCube returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1769
1771 todo_wine ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::BeginHemisphere returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1772
1774 todo_wine ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::BeginParabolic returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1775
1777 todo_wine ok(hr == D3DERR_INVALIDCALL, "ID3DXRenderToEnvMap::BeginSphere returned %#lx, expected %#lx\n", hr, D3DERR_INVALIDCALL);
1778
1780 } else skip("Failed to create ID3DXRenderToEnvMap\n");
1781
1782 /* make sure there is a depth stencil surface present */
1783 hr = IDirect3DDevice9_GetDepthStencilSurface(device, &depth_stencil_surface);
1784 if (SUCCEEDED(hr))
1785 {
1786 IDirect3DSurface9_Release(depth_stencil_surface);
1787 depth_stencil_surface = NULL;
1788 }
1789 else if (hr == D3DERR_NOTFOUND)
1790 {
1792 D3DMULTISAMPLE_NONE, 0, TRUE, &depth_stencil_surface, NULL);
1793 if (SUCCEEDED(hr)) IDirect3DDevice9_SetDepthStencilSurface(device, depth_stencil_surface);
1794 }
1795
1796 if (FAILED(hr))
1797 {
1798 skip("Failed to create depth stencil surface\n");
1799 return;
1800 }
1801
1803
1804 if (depth_stencil_surface)
1805 {
1807 IDirect3DSurface9_Release(depth_stencil_surface);
1808 }
1809}
1810
1812{
1813 HWND wnd;
1814 IDirect3D9 *d3d;
1817 HRESULT hr;
1818
1819 if (!(wnd = CreateWindowA("static", "d3dx9_test", WS_OVERLAPPEDWINDOW, 0, 0,
1820 640, 480, NULL, NULL, NULL, NULL)))
1821 {
1822 skip("Couldn't create application window\n");
1823 return;
1824 }
1825 if (!(d3d = Direct3DCreate9(D3D_SDK_VERSION)))
1826 {
1827 skip("Couldn't create IDirect3D9 object\n");
1828 DestroyWindow(wnd);
1829 return;
1830 }
1831
1832 ZeroMemory(&d3dpp, sizeof(d3dpp));
1833 d3dpp.Windowed = TRUE;
1836 if(FAILED(hr)) {
1837 skip("Failed to create IDirect3DDevice9 object %#lx\n", hr);
1838 IDirect3D9_Release(d3d);
1839 DestroyWindow(wnd);
1840 return;
1841 }
1842
1850
1852 check_release((IUnknown*)d3d, 0);
1853 if (wnd) DestroyWindow(wnd);
1854}
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:20
RECT rect
Definition: combotst.c:67
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
@ 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:860
#define IDirect3DDevice9_EndScene(p)
Definition: d3d9.h:1377
#define IDirect3DDevice9_BeginScene(p)
Definition: d3d9.h:1376
#define IDirect3DDevice9_GetDirect3D(p, a)
Definition: d3d9.h:1341
#define IDirect3D9_CreateDevice(p, a, b, c, d, e, f)
Definition: d3d9.h:224
#define IDirect3DTexture9_GetLevelCount(p)
Definition: d3d9.h:855
#define IDirect3DDevice9_SetViewport(p, a)
Definition: d3d9.h:1382
#define IDirect3DDevice9_CreateTexture(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1358
#define IDirect3DDevice9_SetRenderTarget(p, a, b)
Definition: d3d9.h:1372
#define IDirect3DDevice9_SetDepthStencilSurface(p, a)
Definition: d3d9.h:1374
#define IDirect3DDevice9_CreateDepthStencilSurface(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1364
#define IDirect3DDevice9_GetViewport(p, a)
Definition: d3d9.h:1383
#define IDirect3DDevice9_CreateCubeTexture(p, a, b, c, d, e, f, g)
Definition: d3d9.h:1360
#define IDirect3D9_Release(p)
Definition: d3d9.h:209
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1336
#define IDirect3DDevice9_Clear(p, a, b, c, d, e, f)
Definition: d3d9.h:1378
#define IDirect3D9_CheckDeviceFormat(p, a, b, c, d, e, f)
Definition: d3d9.h:218
#define IDirect3DDevice9_GetDepthStencilSurface(p, a)
Definition: d3d9.h:1375
#define IDirect3DDevice9_GetTransform(p, a, b)
Definition: d3d9.h:1380
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:450
#define IDirect3DTexture9_Release(p)
Definition: d3d9.h:842
#define IDirect3DDevice9_CreateRenderTarget(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1363
#define IDirect3DDevice9_CreateOffscreenPlainSurface(p, a, b, c, d, e, f)
Definition: d3d9.h:1371
#define IDirect3DDevice9_GetRenderTarget(p, a, b)
Definition: d3d9.h:1373
#define D3D_OK
Definition: d3d.h:106
struct ID3DXBuffer ID3DXBuffer
Definition: d3dx8core.h:51
struct ID3DXFont ID3DXFont
Definition: d3dx8core.h:53
HRESULT WINAPI D3DXCreateSprite(struct IDirect3DDevice9 *device, struct ID3DXSprite **sprite)
Definition: sprite.c:561
HRESULT hr
Definition: delayimp.cpp:582
_Check_return_ _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS _Out_ UINT _Out_ UINT * Height
Definition: dispmprt.h:1445
_Check_return_ _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS _Out_ UINT * Width
Definition: dispmprt.h:1444
#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:127
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:847
HRESULT WINAPI D3DXCreateFontIndirectA(IDirect3DDevice9 *device, const D3DXFONT_DESCA *desc, ID3DXFont **font)
Definition: font.c:895
D3DXMATRIX *WINAPI D3DXMatrixOrthoOffCenterLH(D3DXMATRIX *pout, FLOAT l, FLOAT r, FLOAT b, FLOAT t, FLOAT zn, FLOAT zf)
Definition: math.c:439
WORD face[3]
Definition: mesh.c:4854
HRESULT WINAPI D3DXCreateRenderToEnvMap(IDirect3DDevice9 *device, UINT size, UINT mip_levels, D3DFORMAT format, BOOL depth_stencil, D3DFORMAT depth_stencil_format, ID3DXRenderToEnvMap **out)
Definition: render.c:748
HRESULT WINAPI D3DXCreateRenderToSurface(IDirect3DDevice9 *device, UINT width, UINT height, D3DFORMAT format, BOOL depth_stencil, D3DFORMAT depth_stencil_format, ID3DXRenderToSurface **out)
Definition: render.c:372
static void cleanup(void)
Definition: main.c:1335
_ACRTIMP double __cdecl fabs(double)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
#define MAKEFOURCC(ch0, ch1, ch2, ch3)
Definition: ddsformat.c:45
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
#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
DWORD IDirect3DSurface9
Definition: dxva2api.idl:23
DWORD IDirect3DDevice9
Definition: dxva2api.idl:22
static void depth_stencil(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
Definition: ffp_gl.c:766
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLenum GLuint texture
Definition: glext.h:6295
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
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
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
unsigned int UINT
Definition: sysinfo.c:13
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define c
Definition: ke_i.h:80
#define debugstr_a
Definition: kernel32.h:31
#define todo_wine_if(is_todo)
Definition: minitest.h:81
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:539
#define todo_wine
Definition: minitest.h:80
#define ZeroMemory
Definition: minwinbase.h:31
static struct test_info tests[]
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
BOOL expected
Definition: store.c:2000
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
static void test_ID3DXRenderToSurface(IDirect3DDevice9 *device)
Definition: core.c:1549
static void compare_device_state(struct device_state *state1, struct device_state *state2, BOOL equal)
Definition: core.c:1415
static void check_mat(D3DXMATRIX got, D3DXMATRIX exp)
Definition: core.c:47
static void test_ID3DXRenderToSurface_device_state(IDirect3DDevice9 *device)
Definition: core.c:1433
#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:1244
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:1398
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:331
static HRESULT retrieve_device_state(IDirect3DDevice9 *device, struct device_state *state)
Definition: core.c:1375
static void test_D3DXCreateRenderToSurface(IDirect3DDevice9 *device)
Definition: core.c:1193
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:1677
#define admitted_error
Definition: core.c:46
static void test_D3DXCreateRenderToEnvMap(IDirect3DDevice9 *device)
Definition: core.c:1629
static void test_ID3DXRenderToEnvMap(IDirect3DDevice9 *device)
Definition: core.c:1740
static void release_device_state(struct device_state *state)
Definition: core.c:1368
#define check_release(obj, exp)
Definition: core.c:39
static const MAT2 mat
Definition: font.c:51
const WCHAR * expected_result
Definition: mimeole.c:1441
#define cmp(status, error)
Definition: error.c:118
static const WCHAR testW[]
Definition: typelib.c:1450
DWORD exp
Definition: msg.c:18625
static BYTE parameters[]
Definition: asn.c:558
Definition: mk_font.cpp:20
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
short WCHAR
Definition: pedump.c:58
#define DT_CENTER
Definition: winuser.h:527
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4469
#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)
#define equal(x, y)
Definition: reader.cc:56
#define D3DADAPTER_DEFAULT
Definition: d3d8.h:53
#define D3D_SDK_VERSION
Definition: d3d8.h:52
#define D3DERR_NOTFOUND
Definition: d3d8.h:76
#define D3DCREATE_SOFTWARE_VERTEXPROCESSING
Definition: d3d8.h:40
strcpy
Definition: string.h:131
#define memset(x, y, z)
Definition: compat.h:39
static void render(void)
Definition: ssstars.c:272
long y
Definition: dcommon.idl:24
long x
Definition: dcommon.idl:24
Definition: dcommon.idl:28
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
float m[4][4]
Definition: d3d8types.h:1116
D3DSWAPEFFECT SwapEffect
Definition: d3d8types.h:1128
D3DFORMAT Format
Definition: d3d8types.h:1170
UINT gmBlackBoxY
Definition: wingdi.h:2889
UINT gmBlackBoxX
Definition: wingdi.h:2888
POINT gmptGlyphOrigin
Definition: wingdi.h:2890
Definition: wingdi.h:2918
D3DVIEWPORT9 viewport
Definition: render.c:30
IDirect3DSurface9 * render_target
Definition: core.c:1363
IDirect3DSurface9 * depth_stencil
Definition: render.c:29
Definition: devices.h:37
Definition: dsound.c:943
Definition: parser.c:49
Definition: tftpd.h:60
Definition: send.c:48
Definition: sprite.c:36
Definition: ps.c:97
BYTE tmStruckOut
Definition: wingdi.h:2824
BYTE tmPitchAndFamily
Definition: wingdi.h:2825
BYTE tmCharSet
Definition: wingdi.h:2826
LONG tmDescent
Definition: wingdi.h:2809
LONG tmDigitizedAspectX
Definition: wingdi.h:2816
BYTE tmFirstChar
Definition: wingdi.h:2818
LONG tmExternalLeading
Definition: wingdi.h:2811
LONG tmWeight
Definition: wingdi.h:2814
BYTE tmBreakChar
Definition: wingdi.h:2821
LONG tmInternalLeading
Definition: wingdi.h:2810
BYTE tmLastChar
Definition: wingdi.h:2819
BYTE tmUnderlined
Definition: wingdi.h:2823
LONG tmMaxCharWidth
Definition: wingdi.h:2813
LONG tmAveCharWidth
Definition: wingdi.h:2812
BYTE tmDefaultChar
Definition: wingdi.h:2820
LONG tmAscent
Definition: wingdi.h:2808
LONG tmOverhang
Definition: wingdi.h:2815
LONG tmHeight
Definition: wingdi.h:2807
BYTE tmItalic
Definition: wingdi.h:2822
LONG tmDigitizedAspectY
Definition: wingdi.h:2817
uint32_t ULONG
Definition: typedefs.h:59
#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)