ReactOS 0.4.15-dev-7931-gfd331f1
alphablend.c File Reference
#include <windows.h>
#include <wingdi.h>
#include "rosperf.h"
Include dependency graph for alphablend.c:

Go to the source code of this file.

Classes

struct  _ALPHABLEND_CONTEXT
 

Typedefs

typedef struct _ALPHABLEND_CONTEXT ALPHABLEND_CONTEXT
 
typedef struct _ALPHABLEND_CONTEXTPALPHABLEND_CONTEXT
 

Functions

unsigned AlphaBlendInit (void **Context, PPERF_INFO PerfInfo, unsigned Reps)
 
void AlphaBlendCleanup (void *Context, PPERF_INFO PerfInfo)
 
ULONG DbgPrint (IN PCSTR Format, IN ...)
 
void AlphaBlendProc (void *Context, PPERF_INFO PerfInfo, unsigned Reps)
 

Typedef Documentation

◆ ALPHABLEND_CONTEXT

◆ PALPHABLEND_CONTEXT

Function Documentation

◆ AlphaBlendCleanup()

void AlphaBlendCleanup ( void Context,
PPERF_INFO  PerfInfo 
)

Definition at line 52 of file alphablend.c.

53{
55 DeleteDC(ctx->BitmapDc);
56 DeleteObject(ctx->Bitmap);
58}
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
pKey DeleteObject()
BOOL WINAPI DeleteDC(_In_ HDC)

◆ AlphaBlendInit()

unsigned AlphaBlendInit ( void **  Context,
PPERF_INFO  PerfInfo,
unsigned  Reps 
)

Definition at line 29 of file alphablend.c.

30{
32 INT x, y;
33
34 ctx->BitmapDc = CreateCompatibleDC(PerfInfo->BackgroundDc);
35 ctx->Bitmap = CreateCompatibleBitmap(PerfInfo->BackgroundDc, PerfInfo->WndWidth, PerfInfo->WndHeight);
36 SelectObject(ctx->BitmapDc, ctx->Bitmap);
37
38 for (y = 0; y < PerfInfo->WndHeight; y++)
39 {
40 for (x = 0; x < PerfInfo->WndWidth; x++)
41 {
42 SetPixel(ctx->BitmapDc, x, y, RGB(0xff, 0x00, 0x00));
43 }
44 }
45
46 *Context = ctx;
47
48 return Reps;
49}
FORCEINLINE VOID SetPixel(_In_ ULONG Left, _In_ ULONG Top, _In_ UCHAR Color)
Definition: arm.h:55
#define HeapAlloc
Definition: compat.h:733
#define RGB(r, g, b)
Definition: precomp.h:71
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
INT WndHeight
Definition: rosperf.h:32
HDC BackgroundDc
Definition: rosperf.h:30
INT WndWidth
Definition: rosperf.h:31
int32_t INT
Definition: typedefs.h:58
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)

◆ AlphaBlendProc()

void AlphaBlendProc ( void Context,
PPERF_INFO  PerfInfo,
unsigned  Reps 
)

Definition at line 67 of file alphablend.c.

68{
70 unsigned Rep;
71 BLENDFUNCTION BlendFunc = { AC_SRC_OVER, 0, 0, 0 };
72
73 for (Rep = 0; Rep < Reps; Rep++)
74 {
75 BlendFunc.SourceConstantAlpha = 255 * Rep / Reps;
76#if 0
77 PatBlt(PerfInfo->BackgroundDc, 0, 0, PerfInfo->WndWidth, PerfInfo->WndHeight, PATCOPY);
78#endif
79 if (!AlphaBlend(PerfInfo->BackgroundDc, 0, 0, PerfInfo->WndWidth, PerfInfo->WndHeight,
80 ctx->BitmapDc, 0, 0, PerfInfo->WndWidth, PerfInfo->WndHeight,
81 BlendFunc))
82 {
83 DbgPrint("AlphaBlend failed (0x%lx)\n", GetLastError());
84 }
85 }
86}
static const BLENDFUNCTION BlendFunc
Definition: general.c:34
#define DbgPrint
Definition: hal.h:12
BYTE SourceConstantAlpha
Definition: wingdi.h:2761
#define AlphaBlend
Definition: misc.c:293
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define AC_SRC_OVER
Definition: wingdi.h:1369
#define PATCOPY
Definition: wingdi.h:335
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)

◆ DbgPrint()

ULONG DbgPrint ( IN PCSTR  Format,
IN ...   
)