Synchronize with trunk revision 59636 (just before Alex's CreateProcess revamp).
[reactos.git] / win32ss / user / winsrv / consrv / frontends / gui / graphics.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS Console Server DLL
4 * FILE: win32ss/user/winsrv/consrv/frontends/gui/graphics.c
5 * PURPOSE: GUI Terminal Front-End - Support for graphics-mode screen-buffers
6 * PROGRAMMERS: Hermes Belusca-Maito (hermes.belusca@sfr.fr)
7 */
8
9 /* INCLUDES *******************************************************************/
10
11 #include "consrv.h"
12 #include "include/conio.h"
13 #include "include/settings.h"
14 #include "guisettings.h"
15
16 #define NDEBUG
17 #include <debug.h>
18
19
20 /* FUNCTIONS ******************************************************************/
21
22 VOID
23 GuiCopyFromGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer)
24 {
25 /*
26 * This function supposes that the system clipboard was opened.
27 */
28
29 // PCONSOLE Console = Buffer->Header.Console;
30
31 UNIMPLEMENTED;
32 }
33
34 VOID
35 GuiPasteToGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer)
36 {
37 /*
38 * This function supposes that the system clipboard was opened.
39 */
40
41 // PCONSOLE Console = Buffer->Header.Console;
42
43 UNIMPLEMENTED;
44 }
45
46 VOID
47 GuiPaintGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
48 PGUI_CONSOLE_DATA GuiData,
49 HDC hDC,
50 PRECT rc)
51 {
52 if (Buffer->BitMap == NULL) return;
53
54 /* Grab the mutex */
55 NtWaitForSingleObject(Buffer->Mutex, FALSE, NULL);
56
57 /*
58 * The seventh parameter (YSrc) of SetDIBitsToDevice always designates
59 * the Y-coordinate of the "lower-left corner" of the image, be the DIB
60 * in bottom-up or top-down mode.
61 */
62 SetDIBitsToDevice(hDC,
63 /* Coordinates / size of the repainted rectangle, in the view's frame */
64 rc->left,
65 rc->top,
66 rc->right - rc->left,
67 rc->bottom - rc->top,
68 /* Coordinates / size of the corresponding image portion, in the graphics screen-buffer's frame */
69 Buffer->ViewOrigin.X + rc->left,
70 Buffer->ViewOrigin.Y + rc->top,
71 0,
72 Buffer->ScreenBufferSize.Y, // == Buffer->BitMapInfo->bmiHeader.biHeight
73 Buffer->BitMap,
74 Buffer->BitMapInfo,
75 Buffer->BitMapUsage);
76
77 /* Release the mutex */
78 NtReleaseMutant(Buffer->Mutex, NULL);
79 }
80
81 /* EOF */