ReactOS 0.4.15-dev-7906-g1b85a5f
offscreen.c File Reference
#include <vgaddi.h>
Include dependency graph for offscreen.c:

Go to the source code of this file.

Functions

VOID VGADDI_BltFromSavedScreenBits (IN ULONG DestX, IN ULONG DestY, IN PSAVED_SCREEN_BITS Src, IN ULONG SizeX, IN ULONG SizeY)
 
VOID VGADDI_BltToSavedScreenBits (IN PSAVED_SCREEN_BITS Dest, IN ULONG SourceX, IN ULONG SourceY, IN ULONG SizeX, IN ULONG SizeY)
 
VOID VGADDI_FreeSavedScreenBits (PSAVED_SCREEN_BITS SavedBits)
 
PSAVED_SCREEN_BITS VGADDI_AllocSavedScreenBits (ULONG Size)
 
VOID VGADDI_InitializeOffScreenMem (IN ULONG Start, IN ULONG Length)
 

Variables

static LIST_ENTRY SavedBitsList
 

Function Documentation

◆ VGADDI_AllocSavedScreenBits()

PSAVED_SCREEN_BITS VGADDI_AllocSavedScreenBits ( ULONG  Size)

Definition at line 121 of file offscreen.c.

122{
123 PSAVED_SCREEN_BITS Current;
124 PLIST_ENTRY CurrentEntry;
127
128 Best = NULL;
129 CurrentEntry = SavedBitsList.Flink;
130 while (CurrentEntry != &SavedBitsList)
131 {
132 Current = CONTAINING_RECORD(CurrentEntry, SAVED_SCREEN_BITS, ListEntry);
133
134 if (Current->Free && Current->Size >= Size &&
135 (Best == NULL || (Current->Size - Size) < (Best->Size - Size)))
136 {
137 Best = Current;
138 }
139
140 CurrentEntry = CurrentEntry->Flink;
141 }
142
143 if (!Best)
144 return NULL;
145
146 if (Best->Size == Size)
147 {
148 Best->Free = FALSE;
149 return Best;
150 }
151 else
152 {
154 New->Free = FALSE;
155 New->Offset = Best->Offset + Size;
156 New->Size = Size;
157 Best->Size -= Size;
158 InsertHeadList(&Best->ListEntry, &New->ListEntry);
159 return New;
160 }
161}
#define ALLOC_TAG
Definition: btrfs_drv.h:87
#define NULL
Definition: types.h:112
#define FALSE
Definition: types.h:117
#define InsertHeadList(ListHead, Entry)
static LIST_ENTRY SavedBitsList
Definition: offscreen.c:15
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
#define New(t)
Definition: rtf.h:1086
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
LIST_ENTRY ListEntry
Definition: vgaddi.h:94
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by DrvSetPointerShape(), and InitPointer().

◆ VGADDI_BltFromSavedScreenBits()

VOID VGADDI_BltFromSavedScreenBits ( IN ULONG  DestX,
IN ULONG  DestY,
IN PSAVED_SCREEN_BITS  Src,
IN ULONG  SizeX,
IN ULONG  SizeY 
)

Definition at line 20 of file offscreen.c.

26{
27 PUCHAR DestOffset;
28 PUCHAR SrcOffset;
29 ULONG i, j;
30
31 /* Select write mode 1. */
34
35 SrcOffset = (PUCHAR)vidmem + Src->Offset;
36 for (i = 0; i < SizeY; i++)
37 {
38 DestOffset = (PUCHAR)vidmem + (i + DestY) * 80 + (DestX >> 3);
39 //FIXME: in the loop below we should treat the case when SizeX is not divisible by 8, i.e. partial bytes
40 for (j = 0; j < SizeX>>3; j++, SrcOffset++, DestOffset++)
41 {
42 (VOID)READ_REGISTER_UCHAR(SrcOffset);
43 WRITE_REGISTER_UCHAR(DestOffset, 0);
44 }
45 }
46
47 /* Select write mode 2. */
50}
#define VOID
Definition: acefi.h:82
#define GRA_D
Definition: vgavideo.h:60
#define GRA_I
Definition: vgavideo.h:59
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
#define for
Definition: utility.h:88
#define WRITE_PORT_UCHAR(p, d)
Definition: pc98vid.h:21
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
PBYTE vidmem
Definition: vgavideo.c:18
NTKERNELAPI VOID NTAPI WRITE_REGISTER_UCHAR(IN PUCHAR Register, IN UCHAR Value)
NTKERNELAPI UCHAR NTAPI READ_REGISTER_UCHAR(IN PUCHAR Register)

Referenced by VGADDI_HideCursor().

◆ VGADDI_BltToSavedScreenBits()

VOID VGADDI_BltToSavedScreenBits ( IN PSAVED_SCREEN_BITS  Dest,
IN ULONG  SourceX,
IN ULONG  SourceY,
IN ULONG  SizeX,
IN ULONG  SizeY 
)

Definition at line 53 of file offscreen.c.

59{
60 PUCHAR DestOffset;
61 PUCHAR SrcOffset;
62 ULONG i, j;
63
64 /* Select write mode 1. */
67
68 DestOffset = (PUCHAR)vidmem + Dest->Offset;
69
70 for (i = 0; i < SizeY; i++)
71 {
72 SrcOffset = (PUCHAR)vidmem + (SourceY + i) * 80 + (SourceX >> 3);
73 //FIXME: in the loop below we should treat the case when SizeX is not divisible by 8, i.e. partial bytes
74 for (j = 0; j < SizeX>>3; j++, SrcOffset++, DestOffset++)
75 {
76 (VOID)READ_REGISTER_UCHAR(SrcOffset);
77 WRITE_REGISTER_UCHAR(DestOffset, 0);
78 }
79 }
80
81 /* Select write mode 2. */
84}

Referenced by VGADDI_ShowCursor().

◆ VGADDI_FreeSavedScreenBits()

VOID VGADDI_FreeSavedScreenBits ( PSAVED_SCREEN_BITS  SavedBits)

Definition at line 87 of file offscreen.c.

88{
89 SavedBits->Free = TRUE;
90
91 if (SavedBits->ListEntry.Blink != &SavedBitsList)
92 {
93 PSAVED_SCREEN_BITS Previous;
94
95 Previous = CONTAINING_RECORD(SavedBits->ListEntry.Blink,
96 SAVED_SCREEN_BITS, ListEntry);
97 if (Previous->Free)
98 {
99 Previous->Size += SavedBits->Size;
100 RemoveEntryList(&SavedBits->ListEntry);
101 EngFreeMem(SavedBits);
102 SavedBits = Previous;
103 }
104 }
105 if (SavedBits->ListEntry.Flink != &SavedBitsList)
106 {
108
110 ListEntry);
111 if (Next->Free)
112 {
113 SavedBits->Size += Next->Size;
114 RemoveEntryList(&SavedBits->ListEntry);
115 EngFreeMem(SavedBits);
116 }
117 }
118}
#define TRUE
Definition: types.h:120
#define RemoveEntryList(Entry)
Definition: env_spec_w32.h:986
#define EngFreeMem
Definition: polytest.cpp:56
struct _LIST_ENTRY * Blink
Definition: typedefs.h:122

Referenced by DrvSetPointerShape().

◆ VGADDI_InitializeOffScreenMem()

VOID VGADDI_InitializeOffScreenMem ( IN ULONG  Start,
IN ULONG  Length 
)

Definition at line 164 of file offscreen.c.

167{
168 PSAVED_SCREEN_BITS FreeBits;
169
171
172 FreeBits = EngAllocMem(0, sizeof(SAVED_SCREEN_BITS), ALLOC_TAG);
173 FreeBits->Free = TRUE;
174 FreeBits->Offset = Start;
175 FreeBits->Size = Length;
177}
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
@ Start
Definition: partlist.h:33

Referenced by DrvEnableDriver().

Variable Documentation

◆ SavedBitsList

LIST_ENTRY SavedBitsList
static