3d1b8237101b3e3f4517f3fdd44b053954f145af
[reactos.git] / reactos / subsys / win32k / tests / tests / DIB_24BPP_ColorFill-performance.c
1 #include <w32k.h>
2
3 #include "regtests.h"
4
5 static void SetupSurface(SURFOBJ* surface, RECTL* rect)
6 {
7 UINT sizex;
8 UINT sizey;
9 UINT size;
10 UINT depth;
11
12 ZeroMemory(surface, sizeof(SURFOBJ));
13 depth = BitsPerFormat(BMF_24BPP);
14 sizex = rect->right - rect->left;
15 sizey = rect->bottom - rect->top;
16 size = sizey * sizex * depth;
17 surface->pvScan0 = malloc(size);
18 surface->lDelta = DIB_GetDIBWidthBytes(sizex, depth);
19 }
20
21 static void CleanupSurface(SURFOBJ* surface)
22 {
23 free(surface->pvScan0);
24 }
25
26 static void RunTest()
27 {
28 static RECTL rect = { 0, 0, 100, 100 };
29 SURFOBJ surface;
30 UINT color;
31 UINT i;
32
33 SetupSurface(&surface, &rect);
34 for (i = 0; i < 1000; i++)
35 {
36 BOOLEAN success = DIB_24BPP_ColorFill(&surface, &rect, color);
37 _AssertTrue(success);
38 if (!success)
39 break;
40 }
41 CleanupSurface(&surface);
42 }
43
44 _Dispatcher(Dib_24bpp_colorfill_performanceTest, "DIB_24BPP_ColorFill performance")