* Sync up to trunk HEAD (r62286).
[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
13 #define NDEBUG
14 #include <debug.h>
15
16 /* FUNCTIONS ******************************************************************/
17
18 VOID
19 GuiCopyFromGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer)
20 {
21 /*
22 * This function supposes that the system clipboard was opened.
23 */
24
25 // PCONSOLE Console = Buffer->Header.Console;
26
27 UNIMPLEMENTED;
28 }
29
30 VOID
31 GuiPasteToGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer)
32 {
33 /*
34 * This function supposes that the system clipboard was opened.
35 */
36
37 // PCONSOLE Console = Buffer->Header.Console;
38
39 UNIMPLEMENTED;
40 }
41
42 VOID
43 GuiPaintGraphicsBuffer(PGRAPHICS_SCREEN_BUFFER Buffer,
44 PGUI_CONSOLE_DATA GuiData,
45 PRECT rcView,
46 PRECT rcFramebuffer)
47 {
48 if (Buffer->BitMap == NULL) return;
49
50 rcFramebuffer->left = Buffer->ViewOrigin.X * 1 + rcView->left;
51 rcFramebuffer->top = Buffer->ViewOrigin.Y * 1 + rcView->top;
52 rcFramebuffer->right = Buffer->ViewOrigin.X * 1 + rcView->right;
53 rcFramebuffer->bottom = Buffer->ViewOrigin.Y * 1 + rcView->bottom;
54
55 /* Grab the mutex */
56 NtWaitForSingleObject(Buffer->Mutex, FALSE, NULL);
57
58 /*
59 * The seventh parameter (YSrc) of SetDIBitsToDevice always designates
60 * the Y-coordinate of the "lower-left corner" of the image, be the DIB
61 * in bottom-up or top-down mode.
62 */
63 SetDIBitsToDevice(GuiData->hMemDC,
64 /* Coordinates / size of the repainted rectangle, in the framebuffer's frame */
65 rcFramebuffer->left,
66 rcFramebuffer->top,
67 rcFramebuffer->right - rcFramebuffer->left,
68 rcFramebuffer->bottom - rcFramebuffer->top,
69 /* Coordinates / size of the corresponding image portion, in the graphics screen-buffer's frame */
70 rcFramebuffer->left,
71 rcFramebuffer->top,
72 0,
73 Buffer->ScreenBufferSize.Y, // == Buffer->BitMapInfo->bmiHeader.biHeight
74 Buffer->BitMap,
75 Buffer->BitMapInfo,
76 Buffer->BitMapUsage);
77
78 /* Release the mutex */
79 NtReleaseMutant(Buffer->Mutex, NULL);
80 }
81
82 /* EOF */