ReactOS  0.4.14-dev-599-g2d4d3f5
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);
57  HeapFree(GetProcessHeap(), 0, ctx);
58 }
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define GetProcessHeap()
Definition: compat.h:403
BOOL WINAPI DeleteDC(_In_ HDC)
struct tagContext Context
Definition: acpixf.h:1030
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ 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 }
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HDC BackgroundDc
Definition: rosperf.h:30
INT WndHeight
Definition: rosperf.h:32
int32_t INT
Definition: typedefs.h:56
FORCEINLINE VOID SetPixel(IN ULONG Left, IN ULONG Top, IN UCHAR Color)
Definition: vga.c:93
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define RGB(r, g, b)
Definition: wingdi.h:2939
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
INT WndWidth
Definition: rosperf.h:31

◆ 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 }
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
HDC BackgroundDc
Definition: rosperf.h:30
INT WndHeight
Definition: rosperf.h:32
BOOL WINAPI PatBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
ULONG DbgPrint(IN PCSTR Format, IN ...)
BYTE SourceConstantAlpha
Definition: wingdi.h:2760
#define AC_SRC_OVER
Definition: wingdi.h:1368
#define PATCOPY
Definition: wingdi.h:334
#define AlphaBlend
Definition: misc.c:293
struct tagContext Context
Definition: acpixf.h:1030
BLENDFUNCTION BlendFunc
Definition: general.c:32
INT WndWidth
Definition: rosperf.h:31

◆ DbgPrint()

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

Referenced by AlphaBlendProc().