ReactOS 0.4.16-dev-297-gc569aee
video.c File Reference
#include <freeldr.h>
Include dependency graph for video.c:

Go to the source code of this file.

Macros

#define RGB_MAX   64
 
#define RGB_MAX_PER_ITERATION   64
 
#define TAG_PALETTE_COLORS   'claP'
 

Functions

PVOID VideoAllocateOffScreenBuffer (VOID)
 
VOID VideoFreeOffScreenBuffer (VOID)
 
VOID VideoCopyOffScreenBufferToVRAM (VOID)
 
VOID VideoSavePaletteState (PPALETTE_ENTRY Palette, ULONG ColorCount)
 
VOID VideoRestorePaletteState (PPALETTE_ENTRY Palette, ULONG ColorCount)
 
VOID VideoSetAllColorsToBlack (ULONG ColorCount)
 
VOID VideoFadeIn (PPALETTE_ENTRY Palette, ULONG ColorCount)
 
VOID VideoFadeOut (ULONG ColorCount)
 

Variables

static PVOID VideoOffScreenBuffer = NULL
 

Macro Definition Documentation

◆ RGB_MAX

#define RGB_MAX   64

Definition at line 10 of file video.c.

◆ RGB_MAX_PER_ITERATION

#define RGB_MAX_PER_ITERATION   64

Definition at line 11 of file video.c.

◆ TAG_PALETTE_COLORS

#define TAG_PALETTE_COLORS   'claP'

Definition at line 12 of file video.c.

Function Documentation

◆ VideoAllocateOffScreenBuffer()

PVOID VideoAllocateOffScreenBuffer ( VOID  )

Definition at line 16 of file video.c.

17{
19
21
23
25
27}
#define MachVideoGetBufferSize()
Definition: machine.h:98
PVOID MmAllocateMemoryWithType(SIZE_T MemorySize, TYPE_OF_MEMORY MemoryType)
Definition: mm.c:31
static PVOID VideoOffScreenBuffer
Definition: video.c:14
VOID VideoFreeOffScreenBuffer(VOID)
Definition: video.c:29
#define BufferSize
Definition: mmc.h:75
@ LoaderFirmwareTemporary
Definition: arc.h:179
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

Referenced by TuiInitialize().

◆ VideoCopyOffScreenBufferToVRAM()

◆ VideoFadeIn()

VOID VideoFadeIn ( PPALETTE_ENTRY  Palette,
ULONG  ColorCount 
)

Definition at line 79 of file video.c.

80{
83 PPALETTE_ENTRY PaletteColors;
84
85 PaletteColors = FrLdrTempAlloc(sizeof(PALETTE_ENTRY) * ColorCount, TAG_PALETTE_COLORS);
86 if (!PaletteColors) return;
87
88 for (Index = 0; Index < RGB_MAX; Index++)
89 {
90 for (Color = 0; Color < ColorCount; Color++)
91 {
92 MachVideoGetPaletteColor(Color, &PaletteColors[Color].Red, &PaletteColors[Color].Green, &PaletteColors[Color].Blue);
93
94 // Increment each color so it approaches its real value
95 if (PaletteColors[Color].Red < Palette[Color].Red)
96 {
97 PaletteColors[Color].Red++;
98 }
99 if (PaletteColors[Color].Green < Palette[Color].Green)
100 {
101 PaletteColors[Color].Green++;
102 }
103 if (PaletteColors[Color].Blue < Palette[Color].Blue)
104 {
105 PaletteColors[Color].Blue++;
106 }
107
108 // Make sure we haven't exceeded the real value
109 if (PaletteColors[Color].Red > Palette[Color].Red)
110 {
111 PaletteColors[Color].Red = Palette[Color].Red;
112 }
113 if (PaletteColors[Color].Green > Palette[Color].Green)
114 {
115 PaletteColors[Color].Green = Palette[Color].Green;
116 }
117 if (PaletteColors[Color].Blue > Palette[Color].Blue)
118 {
119 PaletteColors[Color].Blue = Palette[Color].Blue;
120 }
121 }
122
123 // Set the colors
124 for (Color = 0; Color < ColorCount; Color++)
125 {
126 if ((Color % RGB_MAX_PER_ITERATION) == 0)
127 {
129 }
130
131 MachVideoSetPaletteColor(Color, PaletteColors[Color].Red, PaletteColors[Color].Green, PaletteColors[Color].Blue);
132 }
133 }
134
135 FrLdrTempFree(PaletteColors, TAG_PALETTE_COLORS);
136}
@ Green
Definition: bl.h:199
@ Red
Definition: bl.h:201
@ Blue
Definition: bl.h:198
#define MachVideoSetPaletteColor(Col, R, G, B)
Definition: machine.h:112
#define MachVideoGetPaletteColor(Col, R, G, B)
Definition: machine.h:114
#define MachVideoSync()
Definition: machine.h:116
FORCEINLINE PVOID FrLdrTempAlloc(_In_ SIZE_T Size, _In_ ULONG Tag)
Definition: mm.h:188
FORCEINLINE VOID FrLdrTempFree(PVOID Allocation, ULONG Tag)
Definition: mm.h:197
#define TAG_PALETTE_COLORS
Definition: video.c:12
#define RGB_MAX
Definition: video.c:10
#define RGB_MAX_PER_ITERATION
Definition: video.c:11
Definition: video.h:12
UCHAR Blue
Definition: video.h:15
UCHAR Red
Definition: video.h:13
UCHAR Green
Definition: video.h:14
_In_ WDFCOLLECTION _In_ ULONG Index
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by TuiFadeInBackdrop().

◆ VideoFadeOut()

VOID VideoFadeOut ( ULONG  ColorCount)

Definition at line 138 of file video.c.

139{
140 ULONG Index;
141 UCHAR Color;
142 UCHAR Red;
143 UCHAR Green;
144 UCHAR Blue;
145
146 for (Index = 0; Index < RGB_MAX; Index++)
147 {
148 for (Color = 0; Color < ColorCount; Color++)
149 {
150 if ((Color % RGB_MAX_PER_ITERATION) == 0)
151 {
153 }
154
156
157 if (Red > 0)
158 {
159 Red--;
160 }
161 if (Green > 0)
162 {
163 Green--;
164 }
165 if (Blue > 0)
166 {
167 Blue--;
168 }
169
171 }
172 }
173}

Referenced by TuiFadeOut().

◆ VideoFreeOffScreenBuffer()

VOID VideoFreeOffScreenBuffer ( VOID  )

Definition at line 29 of file video.c.

30{
32 return;
33
36}
VOID MmFreeMemory(PVOID MemoryPointer)
Definition: mm.c:215
#define NULL
Definition: types.h:112

Referenced by TuiUnInitialize(), and VideoAllocateOffScreenBuffer().

◆ VideoRestorePaletteState()

VOID VideoRestorePaletteState ( PPALETTE_ENTRY  Palette,
ULONG  ColorCount 
)

Definition at line 54 of file video.c.

55{
57
59
60 for (Color = 0; Color < ColorCount; Color++)
61 {
62 MachVideoSetPaletteColor((UCHAR)Color, Palette[Color].Red, Palette[Color].Green, Palette[Color].Blue);
63 }
64}

Referenced by TuiFadeOut().

◆ VideoSavePaletteState()

VOID VideoSavePaletteState ( PPALETTE_ENTRY  Palette,
ULONG  ColorCount 
)

Definition at line 44 of file video.c.

45{
47
48 for (Color = 0; Color < ColorCount; Color++)
49 {
50 MachVideoGetPaletteColor((UCHAR)Color, &Palette[Color].Red, &Palette[Color].Green, &Palette[Color].Blue);
51 }
52}

Referenced by TuiFadeInBackdrop(), and TuiFadeOut().

◆ VideoSetAllColorsToBlack()

VOID VideoSetAllColorsToBlack ( ULONG  ColorCount)

Definition at line 67 of file video.c.

68{
70
72
73 for (Color = 0; Color < ColorCount; Color++)
74 {
76 }
77}

Referenced by TuiFadeInBackdrop().

Variable Documentation

◆ VideoOffScreenBuffer

PVOID VideoOffScreenBuffer = NULL
static