From c820fb6a8648b63e6d7d40b165ac047533dadfa3 Mon Sep 17 00:00:00 2001 From: Goraf Date: Sat, 30 Jan 2016 21:56:49 +0000 Subject: BITMAPINFO initialization git-svn-id: http://svn.miranda-ng.org/main/trunk@16199 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FingerprintNG/src/fingerprint.cpp | 5 ++--- plugins/FloatingContacts/src/bitmap_funcs.cpp | 2 +- plugins/MenuItemEx/src/images.cpp | 5 ++--- plugins/MyDetails/src/frame.cpp | 1 + plugins/Popup/src/bitmap_funcs.cpp | 3 +-- plugins/Popup/src/opt_skins.cpp | 2 +- plugins/SecureIM/src/images.cpp | 10 ++++------ plugins/SplashScreen/src/bitmap_funcs.cpp | 2 +- plugins/TabSRMM/src/themes.cpp | 2 +- plugins/TipperYM/src/bitmap_func.cpp | 2 +- plugins/TrafficCounter/src/TrafficCounter.cpp | 2 +- 11 files changed, 16 insertions(+), 20 deletions(-) (limited to 'plugins') diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 6d9fb1deed..6fd60942de 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -438,18 +438,17 @@ HBITMAP __inline CreateBitmap32(int cx, int cy) */ HBITMAP __fastcall CreateBitmap32Point(int cx, int cy, LPVOID* bits) { - BITMAPINFO bmpi = { 0 }; LPVOID ptPixels = NULL; - HBITMAP DirectBitmap; if (cx < 0 || cy < 0) return NULL; + BITMAPINFO bmpi = { 0 }; bmpi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmpi.bmiHeader.biWidth = cx; bmpi.bmiHeader.biHeight = cy; bmpi.bmiHeader.biPlanes = 1; bmpi.bmiHeader.biBitCount = 32; - DirectBitmap = CreateDIBSection(NULL, &bmpi, DIB_RGB_COLORS, &ptPixels, NULL, 0); + HBITMAP DirectBitmap = CreateDIBSection(NULL, &bmpi, DIB_RGB_COLORS, &ptPixels, NULL, 0); GdiFlush(); if (ptPixels) memset(ptPixels, 0, cx * cy * 4); diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp index eaccf7c358..ab3eca3c02 100644 --- a/plugins/FloatingContacts/src/bitmap_funcs.cpp +++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp @@ -983,7 +983,7 @@ void MyBitmap::allocate(int w, int h) width = w; height = h; - BITMAPINFO bi; + BITMAPINFO bi = { 0 }; bi.bmiHeader.biSize = sizeof(bi.bmiHeader); bi.bmiHeader.biWidth = w; diff --git a/plugins/MenuItemEx/src/images.cpp b/plugins/MenuItemEx/src/images.cpp index a6753392fb..d197226eb8 100644 --- a/plugins/MenuItemEx/src/images.cpp +++ b/plugins/MenuItemEx/src/images.cpp @@ -114,9 +114,7 @@ void CorrectBitmap32Alpha(HBITMAP hBitmap, BOOL force) HBITMAP CopyBitmapTo32(HBITMAP hBitmap) { - BITMAPINFO RGB32BitsBITMAPINFO; BYTE * ptPixels; - HBITMAP hDirectBitmap; BITMAP bmp; DWORD dwLen; @@ -130,6 +128,7 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) return NULL; // Create bitmap + BITMAPINFO RGB32BitsBITMAPINFO; memset(&RGB32BitsBITMAPINFO, 0, sizeof(BITMAPINFO)); RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); RGB32BitsBITMAPINFO.bmiHeader.biWidth = bmp.bmWidth; @@ -137,7 +136,7 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1; RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32; - hDirectBitmap = CreateDIBSection(NULL, + HBITMAP hDirectBitmap = CreateDIBSection(NULL, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index fd169273bf..199523aaa3 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -1003,6 +1003,7 @@ HBITMAP CreateBitmap32(int cx, int cy) DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); + return DirectBitmap; } diff --git a/plugins/Popup/src/bitmap_funcs.cpp b/plugins/Popup/src/bitmap_funcs.cpp index f28dba8f28..a4f87e9c28 100644 --- a/plugins/Popup/src/bitmap_funcs.cpp +++ b/plugins/Popup/src/bitmap_funcs.cpp @@ -767,14 +767,13 @@ void MyBitmap::allocate(int w, int h) DeleteDC(dcBmp); } - BITMAPINFO bi; + BITMAPINFO bi = { 0 }; bi.bmiHeader.biSize = sizeof(bi.bmiHeader); bi.bmiHeader.biWidth = w; bi.bmiHeader.biHeight = -h; bi.bmiHeader.biPlanes = 1; bi.bmiHeader.biBitCount = 32; bi.bmiHeader.biCompression = BI_RGB; - bi.bmiColors[0].rgbRed = bi.bmiColors[0].rgbGreen = bi.bmiColors[0].rgbBlue = bi.bmiColors[0].rgbReserved = 0; hBmp = (HBITMAP)CreateDIBSection(0, &bi, DIB_RGB_COLORS, (void **)&bits, 0, 0); dcBmp = CreateCompatibleDC(0); diff --git a/plugins/Popup/src/opt_skins.cpp b/plugins/Popup/src/opt_skins.cpp index 1fd334b1e7..70284a3f37 100644 --- a/plugins/Popup/src/opt_skins.cpp +++ b/plugins/Popup/src/opt_skins.cpp @@ -94,7 +94,7 @@ static void updatePreviewImage(HWND hwndBox) static void DrawPreview(HWND hwnd, HDC hdc) { - BITMAPINFO bi; + BITMAPINFO bi = { 0 }; bi.bmiHeader.biSize = sizeof(bi.bmiHeader); bi.bmiHeader.biWidth = 8; bi.bmiHeader.biHeight = -8; diff --git a/plugins/SecureIM/src/images.cpp b/plugins/SecureIM/src/images.cpp index ce00b9fa68..ea171fd482 100644 --- a/plugins/SecureIM/src/images.cpp +++ b/plugins/SecureIM/src/images.cpp @@ -96,9 +96,7 @@ void CorrectBitmap32Alpha(HBITMAP hBitmap, BOOL force) HBITMAP CopyBitmapTo32(HBITMAP hBitmap) { - BITMAPINFO RGB32BitsBITMAPINFO; BYTE * ptPixels; - HBITMAP hDirectBitmap; BITMAP bmp; DWORD dwLen; @@ -112,6 +110,7 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) return NULL; // Create bitmap + BITMAPINFO RGB32BitsBITMAPINFO; memset(&RGB32BitsBITMAPINFO, 0, sizeof(BITMAPINFO)); RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); RGB32BitsBITMAPINFO.bmiHeader.biWidth = bmp.bmWidth; @@ -119,7 +118,7 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1; RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32; - hDirectBitmap = CreateDIBSection(NULL, + HBITMAP hDirectBitmap = CreateDIBSection(NULL, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, @@ -159,10 +158,9 @@ HBITMAP CopyBitmapTo32(HBITMAP hBitmap) HBITMAP CreateBitmap32(int cx, int cy) { - BITMAPINFO RGB32BitsBITMAPINFO; UINT * ptPixels; - HBITMAP DirectBitmap; + BITMAPINFO RGB32BitsBITMAPINFO; memset(&RGB32BitsBITMAPINFO, 0, sizeof(BITMAPINFO)); RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); RGB32BitsBITMAPINFO.bmiHeader.biWidth = cx;//bm.bmWidth; @@ -170,7 +168,7 @@ HBITMAP CreateBitmap32(int cx, int cy) RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1; RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32; - DirectBitmap = CreateDIBSection(NULL, + HBITMAP DirectBitmap = CreateDIBSection(NULL, (BITMAPINFO *)&RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, diff --git a/plugins/SplashScreen/src/bitmap_funcs.cpp b/plugins/SplashScreen/src/bitmap_funcs.cpp index 46e8ee86c7..e90ec277d1 100644 --- a/plugins/SplashScreen/src/bitmap_funcs.cpp +++ b/plugins/SplashScreen/src/bitmap_funcs.cpp @@ -166,7 +166,7 @@ void MyBitmap::allocate(int w, int h) width = w; height = h; - BITMAPINFO bi; + BITMAPINFO bi = { 0 }; bi.bmiHeader.biSize = sizeof(bi.bmiHeader); bi.bmiHeader.biWidth = w; diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index d31f4aa743..aea865c799 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -2154,7 +2154,7 @@ HBITMAP CSkin::CreateAeroCompatibleBitmap(const RECT &rc, HDC dc) dib.bmiHeader.biBitCount = 32; dib.bmiHeader.biCompression = BI_RGB; - return(CreateDIBSection(dc, &dib, DIB_RGB_COLORS, NULL, NULL, 0)); + return CreateDIBSection(dc, &dib, DIB_RGB_COLORS, NULL, NULL, 0); } ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/TipperYM/src/bitmap_func.cpp b/plugins/TipperYM/src/bitmap_func.cpp index 0483556753..cdd1a71bb0 100644 --- a/plugins/TipperYM/src/bitmap_func.cpp +++ b/plugins/TipperYM/src/bitmap_func.cpp @@ -358,7 +358,7 @@ void CreateSkinBitmap(int iWidth, int iHeight, bool bServiceTip) skin.iHeight = iHeight; skin.bNeedLayerUpdate = false; - BITMAPINFO bi; + BITMAPINFO bi = { 0 }; bi.bmiHeader.biSize = sizeof(bi.bmiHeader); bi.bmiHeader.biWidth = skin.iWidth; bi.bmiHeader.biHeight = -skin.iHeight; diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index a43c952594..7baa587c9c 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -411,7 +411,6 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) HBRUSH b, t; HDC hdc; HBITMAP hbmp, oldbmp; - BITMAPINFO RGB32BitsBITMAPINFO = { 0 }; BLENDFUNCTION aga = { AC_SRC_OVER, 0, 0xFF, AC_SRC_ALPHA }; DWORD SummarySession, SummaryTotal; @@ -426,6 +425,7 @@ int PaintTrafficCounterWindow(HWND hwnd, HDC hDC) // Свой контекст устройства. hdc = CreateCompatibleDC(hDC); // + BITMAPINFO RGB32BitsBITMAPINFO = { 0 }; RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); RGB32BitsBITMAPINFO.bmiHeader.biWidth = width; RGB32BitsBITMAPINFO.bmiHeader.biHeight = height; -- cgit v1.2.3