diff options
author | demi_alucard <demi_alucard@users.sourceforge.net> | 2012-06-10 20:34:30 +0400 |
---|---|---|
committer | demi_alucard <demi_alucard@users.sourceforge.net> | 2012-06-10 20:34:30 +0400 |
commit | 61e9b784914ff6f80bfccd6bc31dac39cf1d94d0 (patch) | |
tree | d2e66974ad88a292beaf8138ea959dc1ec9c9dc9 /src | |
parent | c092ee861a7b581859f38531612215fcb5d06044 (diff) |
Update for r5077.
The GIF image saving code wasn't supposed to be committed.
Fixed mixed line endings.
Removed pngdib and libpng entries from the Readme.txt.
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@5079 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src')
-rw-r--r-- | src/mpc-hc/MPCPngImage.cpp | 236 | ||||
-rw-r--r-- | src/mpc-hc/MPCPngImage.h | 64 | ||||
-rw-r--r-- | src/mpc-hc/MainFrm.cpp | 24 | ||||
-rw-r--r-- | src/mpc-hc/WebClientSocket.cpp | 3 |
4 files changed, 160 insertions, 167 deletions
diff --git a/src/mpc-hc/MPCPngImage.cpp b/src/mpc-hc/MPCPngImage.cpp index 4b59eaee9..42ce2fe74 100644 --- a/src/mpc-hc/MPCPngImage.cpp +++ b/src/mpc-hc/MPCPngImage.cpp @@ -1,118 +1,118 @@ -#include "stdafx.h" -#include "MPCPngImage.h" - - -////////////////////////////////////////////////////////////////////// -// CPngImage - -CImage* CMPCPngImage::m_pImage; - -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// - -CMPCPngImage::CMPCPngImage() -{ -} - -CMPCPngImage::~CMPCPngImage() -{ -} - -////////////////////////////////////////////////////////////////////// -// Operations -////////////////////////////////////////////////////////////////////// - -BOOL CMPCPngImage::Load(UINT uiResID, HINSTANCE hinstRes) -{ - return Load(MAKEINTRESOURCE(uiResID), hinstRes); -} - -BOOL CMPCPngImage::Load(LPCTSTR lpszResourceName, HINSTANCE hinstRes) -{ - if (hinstRes == NULL) - { - hinstRes = AfxFindResourceHandle(lpszResourceName, _T("PNG")); - } - - HRSRC hRsrc = ::FindResource(hinstRes, lpszResourceName, _T("PNG")); - if (hRsrc == NULL) - { - return FALSE; - } - - HGLOBAL hGlobal = LoadResource(hinstRes, hRsrc); - if (hGlobal == NULL) - { - return FALSE; - } - - LPVOID lpBuffer = ::LockResource(hGlobal); - if (lpBuffer == NULL) - { - FreeResource(hGlobal); - return FALSE; - } - - BOOL bRes = LoadFromBuffer((LPBYTE) lpBuffer, (UINT) ::SizeofResource(hinstRes, hRsrc)); - - UnlockResource(hGlobal); - FreeResource(hGlobal); - - return bRes; -} -//******************************************************************************* -BOOL CMPCPngImage::LoadFromFile(LPCTSTR lpszPath) -{ - BOOL bRes = FALSE; - - if (m_pImage == NULL) - { - m_pImage = new CImage; - ENSURE(m_pImage != NULL); - } - - if (m_pImage->Load(lpszPath) == S_OK) - { - bRes = Attach(m_pImage->Detach()); - } - - return bRes; -} -//******************************************************************************* -BOOL CMPCPngImage::LoadFromBuffer(LPBYTE lpBuffer, UINT uiSize) -{ - ASSERT(lpBuffer != NULL); - - HGLOBAL hRes = ::GlobalAlloc(GMEM_MOVEABLE, uiSize); - if (hRes == NULL) - { - return FALSE; - } - - IStream* pStream = NULL; - LPVOID lpResBuffer = ::GlobalLock(hRes); - ASSERT (lpResBuffer != NULL); - - memcpy(lpResBuffer, lpBuffer, uiSize); - - HRESULT hResult = ::CreateStreamOnHGlobal(hRes, FALSE, &pStream); - - if (hResult != S_OK) - { - return FALSE; - } - - if (m_pImage == NULL) - { - m_pImage = new CImage; - ENSURE(m_pImage != NULL); - } - - m_pImage->Load(pStream); - pStream->Release(); - - BOOL bRes = Attach(m_pImage->Detach()); - - return bRes; -} +#include "stdafx.h"
+#include "MPCPngImage.h"
+
+
+//////////////////////////////////////////////////////////////////////
+// CPngImage
+
+CImage* CMPCPngImage::m_pImage;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CMPCPngImage::CMPCPngImage()
+{
+}
+
+CMPCPngImage::~CMPCPngImage()
+{
+}
+
+//////////////////////////////////////////////////////////////////////
+// Operations
+//////////////////////////////////////////////////////////////////////
+
+BOOL CMPCPngImage::Load(UINT uiResID, HINSTANCE hinstRes)
+{
+ return Load(MAKEINTRESOURCE(uiResID), hinstRes);
+}
+
+BOOL CMPCPngImage::Load(LPCTSTR lpszResourceName, HINSTANCE hinstRes)
+{
+ if (hinstRes == NULL)
+ {
+ hinstRes = AfxFindResourceHandle(lpszResourceName, _T("PNG"));
+ }
+
+ HRSRC hRsrc = ::FindResource(hinstRes, lpszResourceName, _T("PNG"));
+ if (hRsrc == NULL)
+ {
+ return FALSE;
+ }
+
+ HGLOBAL hGlobal = LoadResource(hinstRes, hRsrc);
+ if (hGlobal == NULL)
+ {
+ return FALSE;
+ }
+
+ LPVOID lpBuffer = ::LockResource(hGlobal);
+ if (lpBuffer == NULL)
+ {
+ FreeResource(hGlobal);
+ return FALSE;
+ }
+
+ BOOL bRes = LoadFromBuffer((LPBYTE) lpBuffer, (UINT) ::SizeofResource(hinstRes, hRsrc));
+
+ UnlockResource(hGlobal);
+ FreeResource(hGlobal);
+
+ return bRes;
+}
+//*******************************************************************************
+BOOL CMPCPngImage::LoadFromFile(LPCTSTR lpszPath)
+{
+ BOOL bRes = FALSE;
+
+ if (m_pImage == NULL)
+ {
+ m_pImage = new CImage;
+ ENSURE(m_pImage != NULL);
+ }
+
+ if (m_pImage->Load(lpszPath) == S_OK)
+ {
+ bRes = Attach(m_pImage->Detach());
+ }
+
+ return bRes;
+}
+//*******************************************************************************
+BOOL CMPCPngImage::LoadFromBuffer(LPBYTE lpBuffer, UINT uiSize)
+{
+ ASSERT(lpBuffer != NULL);
+
+ HGLOBAL hRes = ::GlobalAlloc(GMEM_MOVEABLE, uiSize);
+ if (hRes == NULL)
+ {
+ return FALSE;
+ }
+
+ IStream* pStream = NULL;
+ LPVOID lpResBuffer = ::GlobalLock(hRes);
+ ASSERT (lpResBuffer != NULL);
+
+ memcpy(lpResBuffer, lpBuffer, uiSize);
+
+ HRESULT hResult = ::CreateStreamOnHGlobal(hRes, FALSE, &pStream);
+
+ if (hResult != S_OK)
+ {
+ return FALSE;
+ }
+
+ if (m_pImage == NULL)
+ {
+ m_pImage = new CImage;
+ ENSURE(m_pImage != NULL);
+ }
+
+ m_pImage->Load(pStream);
+ pStream->Release();
+
+ BOOL bRes = Attach(m_pImage->Detach());
+
+ return bRes;
+}
diff --git a/src/mpc-hc/MPCPngImage.h b/src/mpc-hc/MPCPngImage.h index a7f1f9bb0..be037074a 100644 --- a/src/mpc-hc/MPCPngImage.h +++ b/src/mpc-hc/MPCPngImage.h @@ -1,32 +1,32 @@ -#pragma once - -#include <atlimage.h> - -class CMPCPngImage : public CBitmap -{ - // Construction/Destruction -public: - CMPCPngImage(); - virtual ~CMPCPngImage(); - - // Attributes: -protected: - static ATL::CImage* m_pImage; - - // Operations: -public: - BOOL Load (UINT uiResID, HINSTANCE hinstRes = NULL); - BOOL Load (LPCTSTR lpszResourceName, HINSTANCE hinstRes = NULL); - - BOOL LoadFromFile (LPCTSTR lpszPath); - BOOL LoadFromBuffer (LPBYTE lpBuffer, UINT uiSize); - - static void __stdcall CleanUp () - { - if (m_pImage != NULL) - { - delete m_pImage; - m_pImage = NULL; - } - } -}; +#pragma once
+
+#include <atlimage.h>
+
+class CMPCPngImage : public CBitmap
+{
+ // Construction/Destruction
+public:
+ CMPCPngImage();
+ virtual ~CMPCPngImage();
+
+ // Attributes:
+protected:
+ static ATL::CImage* m_pImage;
+
+ // Operations:
+public:
+ BOOL Load (UINT uiResID, HINSTANCE hinstRes = NULL);
+ BOOL Load (LPCTSTR lpszResourceName, HINSTANCE hinstRes = NULL);
+
+ BOOL LoadFromFile (LPCTSTR lpszPath);
+ BOOL LoadFromBuffer (LPBYTE lpBuffer, UINT uiSize);
+
+ static void __stdcall CleanUp ()
+ {
+ if (m_pImage != NULL)
+ {
+ delete m_pImage;
+ m_pImage = NULL;
+ }
+ }
+};
diff --git a/src/mpc-hc/MainFrm.cpp b/src/mpc-hc/MainFrm.cpp index 8cedcf225..e91a82c5c 100644 --- a/src/mpc-hc/MainFrm.cpp +++ b/src/mpc-hc/MainFrm.cpp @@ -5144,16 +5144,14 @@ void CMainFrame::OnFileSaveImage() CFileDialog fd(FALSE, 0, (LPCTSTR)psrc,
OFN_EXPLORER|OFN_ENABLESIZING|OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST|OFN_NOCHANGEDIR,
- _T("BMP - Windows Bitmap (*.bmp)|*.bmp|GIF - GIF Image (*.gif)|*.gif|JPG - JPEG Image (*.jpg)|*.jpg|PNG - Portable Network Graphics (*.png)|*.png||"), GetModalParent(), 0);
+ _T("BMP - Windows Bitmap (*.bmp)|*.bmp|JPG - JPEG Image (*.jpg)|*.jpg|PNG - Portable Network Graphics (*.png)|*.png||"), GetModalParent(), 0);
if (s.strSnapShotExt == _T(".bmp")) {
fd.m_pOFN->nFilterIndex = 1;
- } else if (s.strSnapShotExt == _T(".gif")) {
- fd.m_pOFN->nFilterIndex = 2;
} else if (s.strSnapShotExt == _T(".jpg")) {
- fd.m_pOFN->nFilterIndex = 3;
+ fd.m_pOFN->nFilterIndex = 2;
} else if (s.strSnapShotExt == _T(".png")) {
- fd.m_pOFN->nFilterIndex = 4;
+ fd.m_pOFN->nFilterIndex = 3;
}
if (fd.DoModal() != IDOK) {
@@ -5163,11 +5161,9 @@ void CMainFrame::OnFileSaveImage() if (fd.m_pOFN->nFilterIndex == 1) {
s.strSnapShotExt = _T(".bmp");
} else if (fd.m_pOFN->nFilterIndex == 2) {
- s.strSnapShotExt = _T(".gif");
- } else if (fd.m_pOFN->nFilterIndex == 3) {
s.strSnapShotExt = _T(".jpg");
} else {
- fd.m_pOFN->nFilterIndex = 4;
+ fd.m_pOFN->nFilterIndex = 3;
s.strSnapShotExt = _T(".png");
}
@@ -5232,16 +5228,14 @@ void CMainFrame::OnFileSaveThumbnails() CSaveThumbnailsDialog fd(
s.iThumbRows, s.iThumbCols, s.iThumbWidth,
0, (LPCTSTR)psrc,
- _T("BMP - Windows Bitmap (*.bmp)|*.bmp|GIF - GIF Image (*.gif)|*.gif|JPG - JPEG Image (*.jpg)|*.jpg|PNG - Portable Network Graphics (*.png)|*.png||"), GetModalParent());
+ _T("BMP - Windows Bitmap (*.bmp)|*.bmp|JPG - JPEG Image (*.jpg)|*.jpg|PNG - Portable Network Graphics (*.png)|*.png||"), GetModalParent());
if (s.strSnapShotExt == _T(".bmp")) {
fd.m_pOFN->nFilterIndex = 1;
- } else if (s.strSnapShotExt == _T(".gif")) {
- fd.m_pOFN->nFilterIndex = 2;
} else if (s.strSnapShotExt == _T(".jpg")) {
- fd.m_pOFN->nFilterIndex = 3;
+ fd.m_pOFN->nFilterIndex = 2;
} else if (s.strSnapShotExt == _T(".png")) {
- fd.m_pOFN->nFilterIndex = 4;
+ fd.m_pOFN->nFilterIndex = 3;
}
if (fd.DoModal() != IDOK) {
@@ -5251,11 +5245,9 @@ void CMainFrame::OnFileSaveThumbnails() if (fd.m_pOFN->nFilterIndex == 1) {
s.strSnapShotExt = _T(".bmp");
} else if (fd.m_pOFN->nFilterIndex == 2) {
- s.strSnapShotExt = _T(".gif");
- } else if (fd.m_pOFN->nFilterIndex == 3) {
s.strSnapShotExt = _T(".jpg");
} else {
- fd.m_pOFN->nFilterIndex = 4;
+ fd.m_pOFN->nFilterIndex = 3;
s.strSnapShotExt = _T(".png");
}
diff --git a/src/mpc-hc/WebClientSocket.cpp b/src/mpc-hc/WebClientSocket.cpp index 2ec8bced4..f13c6f78f 100644 --- a/src/mpc-hc/WebClientSocket.cpp +++ b/src/mpc-hc/WebClientSocket.cpp @@ -881,7 +881,8 @@ bool CWebClientSocket::OnSnapShotJpeg(CStringA& hdr, CStringA& body, CStringA& m }
}
- return fRet;
}
+ return fRet;
+}
bool CWebClientSocket::OnConvRes(CStringA& hdr, CStringA& body, CStringA& mime)
{
|