Author: bfreisen
Date: Fri Aug 18 17:01:01 2017
New Revision: 75615
URL:
http://svn.reactos.org/svn/reactos?rev=75615&view=rev
Log:
[MSPAINT] Use Gdiplus::Bitmap in place of ATL::CImage to load pictures -- this un-breaks
loading a picture's resolution from file
Modified:
trunk/reactos/base/applications/mspaint/CMakeLists.txt
trunk/reactos/base/applications/mspaint/dib.cpp
Modified: trunk/reactos/base/applications/mspaint/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/CMakeLists.txt [iso-8859-1] Fri Aug 18
17:01:01 2017
@@ -34,6 +34,6 @@
add_executable(mspaint ${SOURCE} rsrc.rc)
set_module_type(mspaint win32gui UNICODE)
target_link_libraries(mspaint atlnew uuid)
-add_importlibs(mspaint hhctrl comdlg32 shell32 user32 gdi32 advapi32 comctl32 msvcrt
kernel32 rpcrt4 shlwapi)
+add_importlibs(mspaint hhctrl comdlg32 shell32 user32 gdi32 gdiplus advapi32 comctl32
msvcrt kernel32 rpcrt4 shlwapi)
add_pch(mspaint precomp.h SOURCE)
add_cd_file(TARGET mspaint DESTINATION reactos/system32 FOR all)
Modified: trunk/reactos/base/applications/mspaint/dib.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mspaint/…
==============================================================================
--- trunk/reactos/base/applications/mspaint/dib.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mspaint/dib.cpp [iso-8859-1] Fri Aug 18 17:01:01 2017
@@ -83,8 +83,8 @@
void
LoadDIBFromFile(HBITMAP * hBitmap, LPCTSTR name, LPSYSTEMTIME time, int *size, int *hRes,
int *vRes)
{
- CImage img;
- img.Load(name); // TODO: error handling
+ using namespace Gdiplus;
+ Bitmap img(CStringW(name), FALSE); // always use WCHAR string
if (!hBitmap)
{
@@ -92,7 +92,7 @@
return;
}
- *hBitmap = img.Detach();
+ img.GetHBITMAP(Color(255, 255, 255), hBitmap);
// update time and size
HANDLE hFile =
@@ -112,7 +112,9 @@
if (size)
*size = GetFileSize(hFile, NULL);
- // TODO: update hRes and vRes
+ // update hRes and vRes
+ *hRes = (int) (img.GetHorizontalResolution() * 1000 / 25.4);
+ *vRes = (int) (img.GetVerticalResolution() * 1000 / 25.4);
CloseHandle(hFile);
}