Sync up with trunk r61578.
[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 PRECT rcView,
50 PRECT rcFramebuffer)
51 {
52 if (Buffer->BitMap == NULL) return;
53
54 rcFramebuffer->left = Buffer->ViewOrigin.X * 1 + rcView->left;
55 rcFramebuffer->top = Buffer->ViewOrigin.Y * 1 + rcView->top;
56 rcFramebuffer->right = Buffer->ViewOrigin.X * 1 + rcView->right;
57 rcFramebuffer->bottom = Buffer->ViewOrigin.Y * 1 + rcView->bottom;
58
59 /* Grab the mutex */
60 NtWaitForSingleObject(Buffer->Mutex, FALSE, NULL);
61
62 /*
63 * The seventh parameter (YSrc) of SetDIBitsToDevice always designates
64 * the Y-coordinate of the "lower-left corner" of the image, be the DIB
65 * in bottom-up or top-down mode.
66 */
67 SetDIBitsToDevice(GuiData->hMemDC,
68 /* Coordinates / size of the repainted rectangle, in the framebuffer's frame */
69 rcFramebuffer->left,
70 rcFramebuffer->top,
71 rcFramebuffer->right - rcFramebuffer->left,
72 rcFramebuffer->bottom - rcFramebuffer->top,
73 /* Coordinates / size of the corresponding image portion, in the graphics screen-buffer's frame */
74 rcFramebuffer->left,
75 rcFramebuffer->top,
76 0,
77 Buffer->ScreenBufferSize.Y, // == Buffer->BitMapInfo->bmiHeader.biHeight
78 Buffer->BitMap,
79 Buffer->BitMapInfo,
80 Buffer->BitMapUsage);
81
82 /* Release the mutex */
83 NtReleaseMutant(Buffer->Mutex, NULL);
84 }
85
86 /* EOF */