summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGoraf <goraf@miranda-ng.org>2016-01-30 21:56:49 +0000
committerGoraf <goraf@miranda-ng.org>2016-01-30 21:56:49 +0000
commitc820fb6a8648b63e6d7d40b165ac047533dadfa3 (patch)
treee8bdc10a76a64b659ddae930561aa556faa687da
parent66d36547ef14644965d9a5afa46e4056716664b2 (diff)
BITMAPINFO initialization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16199 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/FingerprintNG/src/fingerprint.cpp5
-rw-r--r--plugins/FloatingContacts/src/bitmap_funcs.cpp2
-rw-r--r--plugins/MenuItemEx/src/images.cpp5
-rw-r--r--plugins/MyDetails/src/frame.cpp1
-rw-r--r--plugins/Popup/src/bitmap_funcs.cpp3
-rw-r--r--plugins/Popup/src/opt_skins.cpp2
-rw-r--r--plugins/SecureIM/src/images.cpp10
-rw-r--r--plugins/SplashScreen/src/bitmap_funcs.cpp2
-rw-r--r--plugins/TabSRMM/src/themes.cpp2
-rw-r--r--plugins/TipperYM/src/bitmap_func.cpp2
-rw-r--r--plugins/TrafficCounter/src/TrafficCounter.cpp2
-rw-r--r--src/mir_app/src/headerbar.cpp8
-rw-r--r--src/mir_app/src/iconheader.cpp2
-rw-r--r--src/mir_app/src/imgconv.cpp2
-rw-r--r--src/mir_app/src/options.cpp3
15 files changed, 22 insertions, 29 deletions
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;
diff --git a/src/mir_app/src/headerbar.cpp b/src/mir_app/src/headerbar.cpp
index 84ca93ef75..f372781bf6 100644
--- a/src/mir_app/src/headerbar.cpp
+++ b/src/mir_app/src/headerbar.cpp
@@ -130,7 +130,6 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit)
{
int iTopSpace = IsAeroMode() ? 0 : 3;
PAINTSTRUCT ps;
- HBITMAP hBmp, hOldBmp;
int titleLength = GetWindowTextLength(hwndDlg) + 1;
TCHAR *szTitle = (TCHAR *)mir_alloc(sizeof(TCHAR) * titleLength);
@@ -143,17 +142,16 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit)
HDC hdc = BeginPaint(hwndDlg, &ps);
HDC tempDC = CreateCompatibleDC(hdc);
- BITMAPINFO bmi;
+ BITMAPINFO bmi = { 0 };
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = mit->width;
bmi.bmiHeader.biHeight = -mit->height; // we need this for DrawThemeTextEx
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
- bmi.bmiColors[0].rgbRed = bmi.bmiColors[0].rgbGreen = bmi.bmiColors[0].rgbBlue = bmi.bmiColors[0].rgbReserved = 0;
- hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
+ HBITMAP hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, NULL, NULL, 0);
- hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
+ HBITMAP hOldBmp = (HBITMAP)SelectObject(tempDC, hBmp);
if (IsAeroMode()) {
RECT temprc = { 0, 0, mit->width, mit->width };
diff --git a/src/mir_app/src/iconheader.cpp b/src/mir_app/src/iconheader.cpp
index a6fcf2518e..be9b55a6b8 100644
--- a/src/mir_app/src/iconheader.cpp
+++ b/src/mir_app/src/iconheader.cpp
@@ -262,7 +262,7 @@ static LRESULT MIcoTab_OnPaint(HWND hwndDlg, MIcoTabCtrl *mit)
HDC hdc = BeginPaint(hwndDlg, &ps);
HDC tempDC = CreateCompatibleDC(hdc);
- BITMAPINFO bmi;
+ BITMAPINFO bmi = { 0 };
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = mit->width;
bmi.bmiHeader.biHeight = -mit->height; // we need this for DrawThemeTextEx
diff --git a/src/mir_app/src/imgconv.cpp b/src/mir_app/src/imgconv.cpp
index 3a5b130fdb..bf8344f9fe 100644
--- a/src/mir_app/src/imgconv.cpp
+++ b/src/mir_app/src/imgconv.cpp
@@ -28,7 +28,7 @@ typedef DWORD ARGB;
HBITMAP ConvertIconToBitmap(HIMAGELIST hIml, int iconId)
{
- BITMAPINFO bmi = {};
+ BITMAPINFO bmi = { 0 };
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biCompression = BI_RGB;
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp
index 3c8623c15c..86d9846aac 100644
--- a/src/mir_app/src/options.cpp
+++ b/src/mir_app/src/options.cpp
@@ -386,14 +386,13 @@ static void AeroPaintControl(HWND hwnd, HDC hdc, UINT msg, LPARAM lpFlags)
HDC tempDC = CreateCompatibleDC(hdc);
- BITMAPINFO bmi;
+ BITMAPINFO bmi = { 0 };
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = rc.right;
bmi.bmiHeader.biHeight = -rc.bottom;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
- bmi.bmiColors[0].rgbRed = bmi.bmiColors[0].rgbGreen = bmi.bmiColors[0].rgbBlue = bmi.bmiColors[0].rgbReserved = 0;
BYTE *pBits;
HBITMAP hBmp = CreateDIBSection(tempDC, &bmi, DIB_RGB_COLORS, (void **)&pBits, NULL, 0);