Commit r20366:20368 again.
[reactos.git] / reactos / lib / gdi32 / objects / bitmap.c
1 #include "precomp.h"
2
3 /*
4 * @implemented
5 */
6 HBITMAP STDCALL
7 CreateDIBSection(
8 HDC hDC,
9 CONST BITMAPINFO *BitmapInfo,
10 UINT Usage,
11 VOID **Bits,
12 HANDLE hSection,
13 DWORD dwOffset)
14 {
15 PBITMAPINFO pConvertedInfo;
16 UINT ConvertedInfoSize;
17 HBITMAP hBitmap = NULL;
18
19 pConvertedInfo = ConvertBitmapInfo(BitmapInfo, Usage,
20 &ConvertedInfoSize, FALSE);
21 if (pConvertedInfo)
22 {
23 hBitmap = NtGdiCreateDIBSection(hDC, hSection, dwOffset, pConvertedInfo, Usage, 0, 0, 0, Bits);
24 if (BitmapInfo != pConvertedInfo)
25 RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo);
26 }
27
28 return hBitmap;
29 }
30
31 /*
32 * @implemented
33 */
34 BOOL
35 STDCALL
36 BitBlt(HDC hdcDest, /* handle to destination DC */
37 int nXOriginDest, /* x-coord of destination upper-left corner */
38 int nYOriginDest, /* y-coord of destination upper-left corner */
39 int nWidthDest, /* width of destination rectangle */
40 int nHeightDest, /* height of destination rectangle */
41 HDC hdcSrc, /* handle to source DC */
42 int nXSrc, /* x-coordinate of source upper-left corner */
43 int nYSrc, /* y-coordinate of source upper-left corner */
44 DWORD dwRop) /* raster operation code */
45 {
46 return NtGdiBitBlt(hdcDest,
47 nXOriginDest,
48 nYOriginDest,
49 nWidthDest,
50 nHeightDest,
51 hdcSrc,
52 nXSrc,
53 nYSrc,
54 dwRop,
55 0,
56 0);
57 }
58
59 /*
60 * @implemented
61 */
62 BOOL STDCALL
63 StretchBlt(
64 HDC hdcDest, /* handle to destination DC */
65 int nXOriginDest, /* x-coord of destination upper-left corner */
66 int nYOriginDest, /* y-coord of destination upper-left corner */
67 int nWidthDest, /* width of destination rectangle */
68 int nHeightDest, /* height of destination rectangle */
69 HDC hdcSrc, /* handle to source DC */
70 int nXOriginSrc, /* x-coord of source upper-left corner */
71 int nYOriginSrc, /* y-coord of source upper-left corner */
72 int nWidthSrc, /* width of source rectangle */
73 int nHeightSrc, /* height of source rectangle */
74 DWORD dwRop) /* raster operation code */
75
76 {
77 if ((nWidthDest != nWidthSrc) || (nHeightDest != nHeightSrc))
78 {
79 return NtGdiStretchBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest,
80 nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc,
81 nWidthSrc, nHeightSrc, dwRop, 0);
82 }
83
84 return NtGdiBitBlt(hdcDest, nXOriginDest, nYOriginDest, nWidthDest,
85 nHeightDest, hdcSrc, nXOriginSrc, nYOriginSrc, dwRop, 0, 0);
86 }