https://git.reactos.org/?p=reactos.git;a=commitdiff;h=be40a0e29611fb45e4b31…
commit be40a0e29611fb45e4b314c81be373774808b1c4
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Sat Dec 28 22:30:21 2019 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Sat Dec 28 22:30:21 2019 +0900
[MSPAINT] Revert LoadDIBFromFile for workaround (#2186)
CORE-16566
---
base/applications/mspaint/CMakeLists.txt | 2 +-
base/applications/mspaint/dib.cpp | 14 +++++++-------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/base/applications/mspaint/CMakeLists.txt
b/base/applications/mspaint/CMakeLists.txt
index b59a2ee4193..b07e10d4ce0 100644
--- a/base/applications/mspaint/CMakeLists.txt
+++ b/base/applications/mspaint/CMakeLists.txt
@@ -34,6 +34,6 @@ add_rc_deps(rsrc.rc ${mspaint_rc_deps})
add_executable(mspaint ${SOURCE} rsrc.rc)
set_module_type(mspaint win32gui UNICODE)
target_link_libraries(mspaint uuid)
-add_importlibs(mspaint hhctrl comdlg32 shell32 user32 gdi32 gdiplus advapi32 comctl32
msvcrt kernel32 rpcrt4 shlwapi)
+add_importlibs(mspaint hhctrl comdlg32 shell32 user32 gdi32 advapi32 comctl32 msvcrt
kernel32 rpcrt4 shlwapi)
add_pch(mspaint precomp.h SOURCE)
add_cd_file(TARGET mspaint DESTINATION reactos/system32 FOR all)
diff --git a/base/applications/mspaint/dib.cpp b/base/applications/mspaint/dib.cpp
index 8dc5453f5b6..dbe9003d667 100644
--- a/base/applications/mspaint/dib.cpp
+++ b/base/applications/mspaint/dib.cpp
@@ -83,8 +83,9 @@ void ShowFileLoadError(LPCTSTR name)
void
LoadDIBFromFile(HBITMAP * hBitmap, LPCTSTR name, LPSYSTEMTIME time, int *size, int *hRes,
int *vRes)
{
- using namespace Gdiplus;
- Bitmap img(CStringW(name), FALSE); // always use WCHAR string
+ CImage img;
+ img.Load(name);
+ *hBitmap = img.Detach();
if (!hBitmap)
{
@@ -92,8 +93,6 @@ LoadDIBFromFile(HBITMAP * hBitmap, LPCTSTR name, LPSYSTEMTIME time, int
*size, i
return;
}
- img.GetHBITMAP(Color(255, 255, 255), hBitmap);
-
// update time and size
HANDLE hFile =
CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_FLAG_SEQUENTIAL_SCAN, NULL);
@@ -112,9 +111,10 @@ LoadDIBFromFile(HBITMAP * hBitmap, LPCTSTR name, LPSYSTEMTIME time,
int *size, i
if (size)
*size = GetFileSize(hFile, NULL);
- // update hRes and vRes
- *hRes = (int) (img.GetHorizontalResolution() * 1000 / 25.4);
- *vRes = (int) (img.GetVerticalResolution() * 1000 / 25.4);
+ HDC hScreenDC = GetDC(NULL);
+ *hRes = (int)(GetDeviceCaps(hScreenDC, LOGPIXELSX) * 1000 / 25.4);
+ *vRes = (int)(GetDeviceCaps(hScreenDC, LOGPIXELSY) * 1000 / 25.4);
+ ReleaseDC(NULL, hScreenDC);
CloseHandle(hFile);
}