ReactOS 0.4.15-dev-8191-gbc6c731
NtGdiRestoreDC.c File Reference
#include "../win32nt.h"
Include dependency graph for NtGdiRestoreDC.c:

Go to the source code of this file.

Functions

static void SetSpecialDCState (HDC hdc)
 
static void SetSpecialDCState2 (HDC hdc)
 
static void Test_IsSpecialState (HDC hdc, BOOL bMemDC)
 
static void Test_SaveRestore (HDC hdc, BOOL bMemDC)
 
 START_TEST (NtGdiRestoreDC)
 

Variables

static HBRUSH hbrush
 
static HBITMAP hbitmap
 
static HPEN hpen
 
static HFONT hfont
 
static HRGN hrgn
 
static HRGN hrgn2
 

Function Documentation

◆ SetSpecialDCState()

static void SetSpecialDCState ( HDC  hdc)
static

Definition at line 18 of file NtGdiRestoreDC.c.

19{
20 /* Select spcial Objects */
26
27 /* Colors */
28 SetDCBrushColor(hdc, RGB(12,34,56));
29 SetDCPenColor(hdc, RGB(23,34,45));
30
31 /* Coordinates */
34 SetWindowOrgEx(hdc, 12, 34, NULL);
35 SetViewportOrgEx(hdc, 56, 78, NULL);
36 SetWindowExtEx(hdc, 123, 456, NULL);
37 SetViewportExtEx(hdc, 234, 567, NULL);
38
39
40
41}
static HFONT hfont
static HRGN hrgn
static HBRUSH hbrush
static HPEN hpen
static HBITMAP hbitmap
#define NULL
Definition: types.h:112
#define RGB(r, g, b)
Definition: precomp.h:71
HDC hdc
Definition: main.c:9
COLORREF WINAPI SetDCPenColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:941
COLORREF WINAPI SetDCBrushColor(_In_ HDC hdc, _In_ COLORREF crColor)
Definition: dc.c:905
int WINAPI SetMapMode(_In_ HDC, _In_ int)
int WINAPI SetGraphicsMode(_In_ HDC, _In_ int)
Definition: dc.c:1226
#define GM_ADVANCED
Definition: wingdi.h:865
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:532
BOOL WINAPI SetViewportExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
Definition: coord.c:465
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI SetViewportOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:655
#define MM_ANISOTROPIC
Definition: wingdi.h:867
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)

Referenced by Test_SaveRestore().

◆ SetSpecialDCState2()

static void SetSpecialDCState2 ( HDC  hdc)
static

Definition at line 45 of file NtGdiRestoreDC.c.

46{
47 /* Select spcial Objects */
53
54 /* Colors */
55 SetDCBrushColor(hdc, RGB(65,43,21));
56 SetDCPenColor(hdc, RGB(54,43,32));
57
58 /* Coordinates */
61 SetWindowOrgEx(hdc, 43, 21, NULL);
62 SetViewportOrgEx(hdc, 87, 65, NULL);
63 SetWindowExtEx(hdc, 654, 321, NULL);
64 SetViewportExtEx(hdc, 765, 432, NULL);
65
66
67}
static HRGN hrgn2
#define DEFAULT_BITMAP
Definition: ntgdityp.h:195
#define GM_COMPATIBLE
Definition: wingdi.h:864
HGDIOBJ WINAPI GetStockObject(_In_ int)
#define DEFAULT_GUI_FONT
Definition: wingdi.h:909
#define MM_ISOTROPIC
Definition: wingdi.h:870

Referenced by Test_SaveRestore().

◆ START_TEST()

START_TEST ( NtGdiRestoreDC  )

Definition at line 143 of file NtGdiRestoreDC.c.

144{
145 HDC hdc;
146
149
150 SetLastError(0);
151 TEST(NtGdiRestoreDC(0, -10) == 0);
153
154 SetLastError(0);
155 TEST(NtGdiRestoreDC(hdc, 0) == 0);
157
158 SetLastError(0);
159 TEST(NtGdiRestoreDC(hdc, 1) == 0);
161
162 /* Initialize objects */
163 hbrush = CreateSolidBrush(12345);
165 hpen = CreatePen(PS_SOLID, 4, RGB(10,12,32));
167 hbitmap = CreateBitmap(10, 10, 1, 1, NULL);
169 hfont = CreateFont(10, 0, 0, 0, FW_NORMAL, 0, 0, 0, ANSI_CHARSET,
171 DEFAULT_PITCH, "Arial");
173 hrgn = CreateRectRgn(12, 14, 14, 17);
175 hrgn2 = CreateRectRgn(1, 1, 2, 2);
177
178 /* Test mem dc */
180 DeleteDC(hdc);
181
182 /* Test screen DC */
183 hdc = GetDC(0);
186 ReleaseDC(0, hdc);
187
188 /* Test info dc */
189 hdc = CreateICW(L"DISPLAY", NULL, NULL, NULL);
192 DeleteDC(hdc);
193
194}
static void Test_SaveRestore(HDC hdc, BOOL bMemDC)
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
BOOL GdiIsHandleValid(_In_ HGDIOBJ hobj)
Definition: gditools.c:29
#define ASSERT(a)
Definition: mode.c:44
#define TEST(x)
Definition: precomp.h:20
static HDC
Definition: imagelist.c:92
__kernel_entry W32KAPI BOOL APIENTRY NtGdiRestoreDC(_In_ HDC hdc, _In_ INT iLevel)
#define L(x)
Definition: ntvdm.h:50
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define DEFAULT_PITCH
Definition: wingdi.h:443
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define DEFAULT_QUALITY
Definition: wingdi.h:436
HDC WINAPI CreateICW(_In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_opt_ const DEVMODEW *)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define OUT_DEFAULT_PRECIS
Definition: wingdi.h:415
#define CreateFont
Definition: wingdi.h:4443
#define ANSI_CHARSET
Definition: wingdi.h:383
#define CLIP_DEFAULT_PRECIS
Definition: wingdi.h:426
#define FW_NORMAL
Definition: wingdi.h:373
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
#define PS_SOLID
Definition: wingdi.h:586
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)

◆ Test_IsSpecialState()

static void Test_IsSpecialState ( HDC  hdc,
BOOL  bMemDC 
)
static

Definition at line 71 of file NtGdiRestoreDC.c.

72{
73 POINT pt;
74 SIZE sz;
75
76 /* Test Objects */
80 if (bMemDC)
81 {
84 }
85 else
86 {
89 }
90
91 /* Test colors */
92 TEST(GetDCBrushColor(hdc) == RGB(12,34,56));
93 TEST(GetDCPenColor(hdc) == RGB(23,34,45));
94
95 /* Test coordinates */
99 TEST(pt.x == 12);
100 TEST(pt.y == 34);
102 TEST(pt.x == 56);
103 TEST(pt.y == 78);
104 GetWindowExtEx(hdc, &sz);
105 ok(sz.cx == 123, "sz.cx == %ld\n", sz.cx);
106 ok(sz.cy == 456, "sz.cy == %ld\n", sz.cy);
107 GetViewportExtEx(hdc, &sz);
108 TEST(sz.cx == 234);
109 TEST(sz.cy == 567);
110
111
112}
#define ok(value,...)
Definition: atltest.h:57
#define pt(x, y)
Definition: drawing.c:79
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
COLORREF WINAPI GetDCPenColor(_In_ HDC hdc)
Definition: dc.c:884
COLORREF WINAPI GetDCBrushColor(_In_ HDC hdc)
Definition: dc.c:863
int WINAPI GetGraphicsMode(_In_ HDC)
BOOL WINAPI GetWindowOrgEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:439
int WINAPI GetMapMode(_In_ HDC)
Definition: coord.c:114
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:411
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:351
BOOL WINAPI GetViewportOrgEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:383

Referenced by Test_SaveRestore().

◆ Test_SaveRestore()

static void Test_SaveRestore ( HDC  hdc,
BOOL  bMemDC 
)
static

Definition at line 117 of file NtGdiRestoreDC.c.

118{
122
123 SetLastError(0);
124 TEST(NtGdiRestoreDC(hdc, 2) == 0);
126
127 SetLastError(0);
128 TEST(NtGdiRestoreDC(hdc, 0) == 0);
130
131 SetLastError(0);
132 TEST(NtGdiRestoreDC(hdc, -2) == 0);
134
135 SetLastError(0);
136 TEST(NtGdiRestoreDC(hdc, 1) == 1);
137 TEST(GetLastError() == 0);
138
139 Test_IsSpecialState(hdc, bMemDC);
140}
static void Test_IsSpecialState(HDC hdc, BOOL bMemDC)
static void SetSpecialDCState2(HDC hdc)
static void SetSpecialDCState(HDC hdc)
__kernel_entry W32KAPI INT APIENTRY NtGdiSaveDC(_In_ HDC hdc)

Referenced by START_TEST().

Variable Documentation

◆ hbitmap

◆ hbrush

◆ hfont

HFONT hfont
static

Definition at line 13 of file NtGdiRestoreDC.c.

Referenced by _find_font_for_range(), add_hfontitem(), check_font(), check_vertical_font(), check_vertical_metrics(), create_fixed_pitch_font_proc(), create_font(), create_font_proc(), dec_ext_ref(), dec_int_ref(), default_page_paint_hook(), find_hfontitem(), find_installed_font(), fnIMLangFontLink2_GetFontCodePages(), fnIMLangFontLink_GetFontCodePages(), GDI32_GdipDrawDriverString(), gdi_get_font_metrics(), GdiConvertFont(), GdiGetLocalFont(), GdipAddPathString(), GdipCreateFont(), GdipCreateFontFromDC(), GdipCreateFontFromLogfontW(), GdipMeasureDriverString(), GdiSelectFont(), get_current_font_height(), get_font_dpi(), get_font_fsselection(), get_font_hfont(), get_glyph_indices(), get_text_metr_size(), get_tmheight(), get_tmheightW(), GetFontObjectA(), inc_ext_ref(), inc_int_ref(), MainWndProc(), MD_OnSetFont(), METADC_SelectFont(), MFDRV_SelectFont(), NtGdiSelectFont(), OleCreatePropertyFrameIndirect(), OLEFontImpl_AddRefHfont(), OLEFontImpl_ReleaseHfont(), SetSpecialDCState(), SOFTWARE_GdipDrawDriverString(), START_TEST(), test_bcm_get_ideal_size(), test_bitmap_font(), test_bitmap_font_metrics(), test_button_messages(), test_CreateFontIndirect(), test_CreateFontIndirectEx(), test_dtm_get_ideal_size(), test_east_asian_font_selection(), test_fake_bold_font(), test_font_metrics(), test_font_substitution(), test_fontsize(), test_fstype_fixup(), test_fullname(), test_fullname2_helper(), test_GdiGetCodePage(), test_GetCharABCWidths(), test_GetCharWidth32(), test_GetCharWidthI(), test_GetCurrentObject(), test_GetFontUnicodeRanges(), test_GetGlyphIndices(), test_GetGlyphOutline(), test_GetGlyphOutline_empty_contour(), test_GetGlyphOutline_metric_clipping(), test_GetKerningPairs(), test_GetOutlineTextMetrics(), test_height(), test_hfont_lifetime(), test_ifont_size(), Test_IsSpecialState(), test_logfont(), test_margins_default(), test_margins_font_change(), test_margins_usefontinfo(), test_max_height(), test_negative_width(), test_nonexistent_font(), test_oemcharset(), test_orientation(), test_outline_font(), test_RealizationInfo(), test_ScriptCacheGetHeight(), test_ScriptGetGlyphABCWidth(), test_ScriptPlace(), test_ScriptShapeOpenType(), test_SetTextJustification(), test_stock_fonts(), test_text_extents(), test_text_metrics(), TEXTOBJ_LockText(), TREEVIEW_CreateBoldUnderlineFont(), and HyperlinkCtrl::WndProc().

◆ hpen

◆ hrgn

HRGN hrgn
static

Definition at line 14 of file NtGdiRestoreDC.c.

Referenced by alpha_blend_pixels_hrgn(), CB_Paint(), check_update_rgn_(), clip_emf_enum_proc(), co_UserExcludeUpdateRgn(), CreateRectRgn(), DeleteRegion(), RdpClientUI::Display_SetClip(), draw_graphics(), Pane::draw_item(), DrawTextExWorker(), dump_region(), EDIT_BuildLineDefs_ML(), EDIT_EM_ReplaceSel(), EDIT_UpdateTextRegion(), EMFDC_ExtSelectClipRgn(), EMFDC_FillRgn(), EMFDC_FrameRgn(), EMFDC_InvertRgn(), emfdc_paint_invert_region(), EMFDC_PaintRgn(), EMFDRV_ExtSelectClipRgn(), EMFDRV_FillRgn(), EMFDRV_FrameRgn(), EMFDRV_InvertRgn(), EMFDRV_PaintInvertRgn(), EMFDRV_PaintRgn(), ExtSelectClipRgn(), FillRgn(), FrameRgn(), GB_Paint(), GDI32_GdipDrawDriverString(), GDI32_GdipDrawPath(), GDI32_GdipFillPath(), GDI32_GdipFillRegion(), GdiGetRgnAttr(), GdipCreateRegionHrgn(), GdipDrawImagePointsRect(), GdipGetRegionBounds(), GdipGetRegionHRgn(), GdipIsVisiblePathPoint(), GdipIsVisibleRegionPoint(), GdipIsVisibleRegionRect(), GdipPlayMetafileRecord(), GdipSetClipHrgn(), get_clip_hrgn(), get_path_hrgn(), get_region_hrgn(), get_region_scans_data(), GetClipRgn(), GetMetaRgn(), GetRegionData(), GetRgnBox(), Ghost_OnNCPaint(), GreCreateFrameRgn(), GreCreatePolyPolygonRgn(), InvertRgn(), LISTBOX_PaintItem(), MD_OnNCPaint(), metadc_create_region(), METADC_ExtSelectClipRgn(), METADC_FillRgn(), METADC_FrameRgn(), METADC_InvertRgn(), METADC_PaintRgn(), MF_Play_MetaCreateRegion(), MFDRV_CreateRegion(), MFDRV_ExtSelectClipRgn(), MFDRV_FillRgn(), MFDRV_FrameRgn(), MFDRV_InvertRgn(), MFDRV_PaintRgn(), MirrorRgn(), MirrorRgnByWidth(), MirrorRgnDC(), NtGdiCreateRoundRectRgn(), NtGdiExtSelectClipRgn(), NtGdiFillRgn(), NtGdiFrameRgn(), NtGdiInvertRgn(), NtGdiOffsetRgn(), NtGdiPolyPolyDraw(), NtGdiPtInRegion(), NtGdiRectInRegion(), NtGdiSetRectRgn(), nulldrv_SelectClipPath(), OB_Paint(), OffsetRgn(), PaintRgn(), PB_Paint(), PlayMetaFileRecord(), PtInRegion(), RectInRegion(), REGION_LockRgn(), rgn_rect_count(), SelectClipRgn(), set_control_clipping(), SetRectRgn(), SetSpecialDCState(), SetThemeRegion(), START_TEST(), STATIC_TryPaintFcn(), STATIC_WindowProc(), StaticWndProc_common(), test_clipping(), test_clipping_2(), test_dc_layout(), test_dc_visrgn(), test_DispatchMessage(), test_emf_clipping(), Test_ExcludeClipRect(), test_ExtCreateRegion(), Test_ExtCreateRegion_Transform(), test_fromhrgn(), test_Get_Release_DC(), Test_GetClipBox(), Test_GetClipRgn(), test_GetClipRgn(), test_GetCurrentObject(), Test_GetDCEx_Cached(), test_gethrgn(), test_GetRandomRgn(), Test_GetRandomRgn_Params(), test_handles_on_win64(), test_hdc_caching(), test_memory_dc_clipping(), test_mf_clipping(), Test_OffsetClipRgn(), test_paint_messages(), Test_Region(), test_region(), test_savedc_2(), Test_ScrollDC(), Test_ScrollWindowEx(), test_SetWindowRgn(), test_window_dc_clipping(), verify_region(), and WndProc().

◆ hrgn2