diff options
Diffstat (limited to 'plugins/Clist_modern')
-rw-r--r-- | plugins/Clist_modern/src/modern_aniavatars.cpp | 6 | ||||
-rw-r--r-- | plugins/Clist_modern/src/modern_gdiplus.cpp | 34 |
2 files changed, 17 insertions, 23 deletions
diff --git a/plugins/Clist_modern/src/modern_aniavatars.cpp b/plugins/Clist_modern/src/modern_aniavatars.cpp index c3c3c4a912..bd2c81c38b 100644 --- a/plugins/Clist_modern/src/modern_aniavatars.cpp +++ b/plugins/Clist_modern/src/modern_aniavatars.cpp @@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define IMMEDIATE_DRAW (!s_bSeparateWindow)
-void GDIPlus_ExtractAnimatedGIF(TCHAR * szName, int width, int height, HBITMAP * pBmp, int ** pframesDelay, int * pframesCount, SIZE * sizeAvatar);
-BOOL GDIPlus_IsAnimatedGif(TCHAR * szName);
+void GDIPlus_ExtractAnimatedGIF(TCHAR *szName, int width, int height, HBITMAP &pBmp, int* &pframesDelay, int &pframesCount, SIZE &sizeAvatar);
+BOOL GDIPlus_IsAnimatedGif(TCHAR *szName);
/* Next is module */
#define ANIAVAWINDOWCLASS _T("MirandaModernAniAvatar")
@@ -356,7 +356,7 @@ static int _AniAva_LoadAvatarFromImage(TCHAR * szFileName, int width, int height // get image strip
HBITMAP hBitmap = NULL;
- GDIPlus_ExtractAnimatedGIF(szFileName, width, height, &hBitmap, &(paai->pFrameDelays), &(paai->nFrameCount), &(paai->FrameSize));
+ GDIPlus_ExtractAnimatedGIF(szFileName, width, height, hBitmap, paai->pFrameDelays, paai->nFrameCount, paai->FrameSize);
// copy image to temp DC
HDC hTempDC = CreateCompatibleDC(NULL);
diff --git a/plugins/Clist_modern/src/modern_gdiplus.cpp b/plugins/Clist_modern/src/modern_gdiplus.cpp index 2ec2359fc7..1ae96da1ab 100644 --- a/plugins/Clist_modern/src/modern_gdiplus.cpp +++ b/plugins/Clist_modern/src/modern_gdiplus.cpp @@ -168,16 +168,14 @@ BOOL GDIPlus_IsAnimatedGif(TCHAR * szName) return (BOOL)(nFrameCount > 1);
}
-void GDIPlus_ExtractAnimatedGIF(TCHAR * szName, int width, int height, HBITMAP * pBitmap, int ** pframesDelay, int * pframesCount, SIZE * pSizeAvatar)
+void GDIPlus_ExtractAnimatedGIF(TCHAR *szName, int width, int height, HBITMAP &pBitmap, int* &pframesDelay, int &pframesCount, SIZE &pSizeAvatar)
{
int nFrameCount = 0;
Bitmap image(szName);
PropertyItem * pPropertyItem;
- UINT count = 0;
-
- count = image.GetFrameDimensionsCount();
- GUID* pDimensionIDs = new GUID[count];
+ UINT count = image.GetFrameDimensionsCount();
+ GUID *pDimensionIDs = new GUID[count];
// Get the list of frame dimensions from the Image object.
image.GetFrameDimensionsList(pDimensionIDs, count);
@@ -212,18 +210,15 @@ void GDIPlus_ExtractAnimatedGIF(TCHAR * szName, int width, int height, HBITMAP * graphics.SetInterpolationMode(InterpolationModeHighQualityBicubic);
graphics.SetPixelOffsetMode(PixelOffsetModeHalf);
- int * delays = (int*)malloc(nFrameCount*sizeof(int));
+ int *delays = (int*)malloc(nFrameCount*sizeof(int));
memset(delays, 0, nFrameCount*sizeof(int));
- GUID pageGuid = FrameDimensionTime;
- /*
- The GDIPlus strange behavior: without next 2 lines it will draw first frame anti aliased, but next - not
- */
+ // The GDIPlus strange behavior: without next 2 lines it will draw first frame anti aliased, but next - not
+ GUID pageGuid = FrameDimensionTime;
if (nFrameCount > 1)
image.SelectActiveFrame(&pageGuid, 1);
- for (int i = 0; i < nFrameCount; i++)
- {
+ for (int i = 0; i < nFrameCount; i++) {
image.SelectActiveFrame(&pageGuid, i);
graphics.DrawImage(&image, Rect(i*clipWidth, 0, clipWidth, clipHeight), 0, 0, imWidth, imHeight, UnitPixel, &attr);
long lPause = ((long*)pPropertyItem->value)[i] * 10;
@@ -233,13 +228,12 @@ void GDIPlus_ExtractAnimatedGIF(TCHAR * szName, int width, int height, HBITMAP * DeleteDC(hdc);
free(pPropertyItem);
delete[] pDimensionIDs;
- if (pBitmap && pframesDelay && pframesCount && pSizeAvatar)
- {
- *pBitmap = hBitmap;
- *pframesDelay = delays;
- *pframesCount = nFrameCount;
- pSizeAvatar->cx = clipWidth;
- pSizeAvatar->cy = clipHeight;
- }
+
+ pBitmap = hBitmap;
+ pframesDelay = delays;
+ pframesCount = nFrameCount;
+ pSizeAvatar.cx = clipWidth;
+ pSizeAvatar.cy = clipHeight;
+
GdiFlush();
}
|