Cleanup types for CreateDIBSection
This commit is contained in:
@@ -24,7 +24,6 @@ typedef struct _PH_NF_BITMAP
|
||||
{
|
||||
BOOLEAN Initialized;
|
||||
HDC Hdc;
|
||||
BITMAPINFOHEADER Header;
|
||||
HBITMAP Bitmap;
|
||||
PVOID Bits;
|
||||
LONG Width;
|
||||
|
||||
@@ -1278,18 +1278,19 @@ VOID PhNfpBeginBitmap2(
|
||||
if (!Context->Initialized)
|
||||
{
|
||||
HDC screenHdc;
|
||||
BITMAPINFO bitmapInfo;
|
||||
|
||||
memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bitmapInfo.bmiHeader.biWidth = Context->Width;
|
||||
bitmapInfo.bmiHeader.biHeight = Context->Height;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
|
||||
screenHdc = GetDC(NULL);
|
||||
Context->Hdc = CreateCompatibleDC(screenHdc);
|
||||
|
||||
memset(&Context->Header, 0, sizeof(BITMAPINFOHEADER));
|
||||
Context->Header.biSize = sizeof(BITMAPINFOHEADER);
|
||||
Context->Header.biWidth = Context->Width;
|
||||
Context->Header.biHeight = Context->Height;
|
||||
Context->Header.biPlanes = 1;
|
||||
Context->Header.biBitCount = 32;
|
||||
Context->Bitmap = CreateDIBSection(screenHdc, (PBITMAPINFO)&Context->Header, DIB_RGB_COLORS, &Context->Bits, NULL, 0);
|
||||
|
||||
Context->Bitmap = CreateDIBSection(screenHdc, &bitmapInfo, DIB_RGB_COLORS, &Context->Bits, NULL, 0);
|
||||
ReleaseDC(NULL, screenHdc);
|
||||
|
||||
Context->TaskbarDpi = dpiValue;
|
||||
|
||||
+13
-16
@@ -721,7 +721,7 @@ static VOID PhpNeedGraphContext(
|
||||
_In_ ULONG Height
|
||||
)
|
||||
{
|
||||
BITMAPINFOHEADER header;
|
||||
BITMAPINFO bitmapInfo;
|
||||
|
||||
// If we already have a graph context and it's the right size, then return immediately.
|
||||
if (GraphContextWidth == Width && GraphContextHeight == Height)
|
||||
@@ -731,10 +731,8 @@ static VOID PhpNeedGraphContext(
|
||||
{
|
||||
// The original bitmap must be selected back into the context, otherwise
|
||||
// the bitmap can't be deleted. (wj32)
|
||||
if (GraphOldBitmap)
|
||||
SelectBitmap(GraphContext, GraphOldBitmap);
|
||||
if (GraphBitmap)
|
||||
DeleteBitmap(GraphBitmap);
|
||||
SelectBitmap(GraphContext, GraphOldBitmap);
|
||||
DeleteBitmap(GraphBitmap);
|
||||
DeleteDC(GraphContext);
|
||||
|
||||
GraphContext = NULL;
|
||||
@@ -742,21 +740,20 @@ static VOID PhpNeedGraphContext(
|
||||
GraphBits = NULL;
|
||||
}
|
||||
|
||||
GraphContext = CreateCompatibleDC(hdc);
|
||||
GraphContextWidth = Width;
|
||||
GraphContextHeight = Height;
|
||||
|
||||
memset(&header, 0, sizeof(BITMAPINFOHEADER));
|
||||
header.biSize = sizeof(BITMAPINFOHEADER);
|
||||
header.biWidth = Width;
|
||||
header.biHeight = Height;
|
||||
header.biPlanes = 1;
|
||||
header.biBitCount = 32;
|
||||
memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bitmapInfo.bmiHeader.biWidth = Width;
|
||||
bitmapInfo.bmiHeader.biHeight = Height;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
|
||||
if (GraphBitmap = CreateDIBSection(hdc, (BITMAPINFO*)&header, DIB_RGB_COLORS, &GraphBits, NULL, 0))
|
||||
{
|
||||
GraphOldBitmap = SelectBitmap(GraphContext, GraphBitmap);
|
||||
}
|
||||
GraphContext = CreateCompatibleDC(hdc);
|
||||
GraphBitmap = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, &GraphBits, NULL, 0);
|
||||
GraphOldBitmap = SelectBitmap(GraphContext, GraphBitmap);
|
||||
}
|
||||
|
||||
_Success_(return)
|
||||
|
||||
+13
-25
@@ -888,9 +888,8 @@ HBITMAP PhLoadPngImageFromResource(
|
||||
UINT frameCount = 0;
|
||||
ULONG resourceLength = 0;
|
||||
WICInProcPointer resourceBuffer = NULL;
|
||||
HDC screenHdc = NULL;
|
||||
HDC bufferDc = NULL;
|
||||
BITMAPINFO bitmapInfo = { 0 };
|
||||
HDC screenHdc;
|
||||
BITMAPINFO bitmapInfo;
|
||||
HBITMAP bitmapHandle = NULL;
|
||||
PVOID bitmapBuffer = NULL;
|
||||
IWICStream* wicStream = NULL;
|
||||
@@ -972,16 +971,17 @@ HBITMAP PhLoadPngImageFromResource(
|
||||
IWICBitmapFrameDecode_Release(wicFrame);
|
||||
}
|
||||
|
||||
memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bitmapInfo.bmiHeader.biWidth = rect.Width;
|
||||
bitmapInfo.bmiHeader.biHeight = -((LONG)rect.Height);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
screenHdc = GetDC(NULL);
|
||||
bufferDc = CreateCompatibleDC(screenHdc);
|
||||
bitmapHandle = CreateDIBSection(screenHdc, (BITMAPINFO*)&bitmapInfo, DIB_RGB_COLORS, &bitmapBuffer, NULL, 0);
|
||||
bitmapHandle = CreateDIBSection(screenHdc, &bitmapInfo, DIB_RGB_COLORS, &bitmapBuffer, NULL, 0);
|
||||
ReleaseDC(NULL, screenHdc);
|
||||
|
||||
// Check if it's the same rect as the requested size.
|
||||
//if (width != rect.Width || height != rect.Height)
|
||||
@@ -999,12 +999,6 @@ CleanupExit:
|
||||
if (wicScaler)
|
||||
IWICBitmapScaler_Release(wicScaler);
|
||||
|
||||
if (bufferDc)
|
||||
DeleteDC(bufferDc);
|
||||
|
||||
if (screenHdc)
|
||||
ReleaseDC(NULL, screenHdc);
|
||||
|
||||
if (wicBitmapSource)
|
||||
IWICBitmapSource_Release(wicBitmapSource);
|
||||
|
||||
@@ -1033,9 +1027,8 @@ HBITMAP PhLoadPngImageFromFile(
|
||||
{
|
||||
BOOLEAN success = FALSE;
|
||||
UINT frameCount = 0;
|
||||
HDC screenHdc = NULL;
|
||||
HDC bufferDc = NULL;
|
||||
BITMAPINFO bitmapInfo = { 0 };
|
||||
HDC screenHdc;
|
||||
BITMAPINFO bitmapInfo;
|
||||
HBITMAP bitmapHandle = NULL;
|
||||
PVOID bitmapBuffer = NULL;
|
||||
IWICBitmapSource* wicBitmapSource = NULL;
|
||||
@@ -1100,16 +1093,17 @@ HBITMAP PhLoadPngImageFromFile(
|
||||
IWICBitmapFrameDecode_Release(wicFrame);
|
||||
}
|
||||
|
||||
memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bitmapInfo.bmiHeader.biWidth = rect.Width;
|
||||
bitmapInfo.bmiHeader.biHeight = -((LONG)rect.Height);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
screenHdc = GetDC(NULL);
|
||||
bufferDc = CreateCompatibleDC(screenHdc);
|
||||
bitmapHandle = CreateDIBSection(screenHdc, &bitmapInfo, DIB_RGB_COLORS, &bitmapBuffer, NULL, 0);
|
||||
ReleaseDC(NULL, screenHdc);
|
||||
|
||||
// Check if it's the same rect as the requested size.
|
||||
//if (width != rect.Width || height != rect.Height)
|
||||
@@ -1127,12 +1121,6 @@ CleanupExit:
|
||||
if (wicScaler)
|
||||
IWICBitmapScaler_Release(wicScaler);
|
||||
|
||||
if (bufferDc)
|
||||
DeleteDC(bufferDc);
|
||||
|
||||
if (screenHdc)
|
||||
ReleaseDC(NULL, screenHdc);
|
||||
|
||||
if (wicBitmapSource)
|
||||
IWICBitmapSource_Release(wicBitmapSource);
|
||||
|
||||
|
||||
+22
-24
@@ -766,7 +766,7 @@ static VOID PhpCreateBufferedContext(
|
||||
)
|
||||
{
|
||||
HDC hdc;
|
||||
BITMAPINFOHEADER header;
|
||||
BITMAPINFO bitmapInfo;
|
||||
|
||||
PhpDeleteBufferedContext(Context);
|
||||
|
||||
@@ -775,20 +775,19 @@ static VOID PhpCreateBufferedContext(
|
||||
if (!(Context->BufferedContextRect.right && Context->BufferedContextRect.bottom))
|
||||
return;
|
||||
|
||||
memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bitmapInfo.bmiHeader.biWidth = Context->BufferedContextRect.right;
|
||||
bitmapInfo.bmiHeader.biHeight = Context->BufferedContextRect.bottom;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
|
||||
hdc = GetDC(Context->Handle);
|
||||
Context->BufferedContext = CreateCompatibleDC(hdc);
|
||||
|
||||
memset(&header, 0, sizeof(BITMAPINFOHEADER));
|
||||
header.biSize = sizeof(BITMAPINFOHEADER);
|
||||
header.biWidth = Context->BufferedContextRect.right;
|
||||
header.biHeight = Context->BufferedContextRect.bottom;
|
||||
header.biPlanes = 1;
|
||||
header.biBitCount = 32;
|
||||
|
||||
Context->BufferedBitmap = CreateDIBSection(hdc, (BITMAPINFO *)&header, DIB_RGB_COLORS, &Context->BufferedBits, NULL, 0);
|
||||
|
||||
ReleaseDC(Context->Handle, hdc);
|
||||
Context->BufferedBitmap = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, &Context->BufferedBits, NULL, 0);
|
||||
Context->BufferedOldBitmap = SelectBitmap(Context->BufferedContext, Context->BufferedBitmap);
|
||||
ReleaseDC(Context->Handle, hdc);
|
||||
}
|
||||
|
||||
static VOID PhpDeleteFadeOutContext(
|
||||
@@ -812,7 +811,7 @@ static VOID PhpCreateFadeOutContext(
|
||||
)
|
||||
{
|
||||
HDC hdc;
|
||||
BITMAPINFOHEADER header;
|
||||
BITMAPINFO bitmapInfo;
|
||||
ULONG i;
|
||||
ULONG j;
|
||||
ULONG height;
|
||||
@@ -827,20 +826,19 @@ static VOID PhpCreateFadeOutContext(
|
||||
GetClientRect(Context->Handle, &Context->FadeOutContextRect);
|
||||
Context->FadeOutContextRect.right = Context->Options.FadeOutWidth;
|
||||
|
||||
memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bitmapInfo.bmiHeader.biWidth = Context->BufferedContextRect.right;
|
||||
bitmapInfo.bmiHeader.biHeight = Context->BufferedContextRect.bottom;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
|
||||
hdc = GetDC(Context->Handle);
|
||||
Context->FadeOutContext = CreateCompatibleDC(hdc);
|
||||
|
||||
memset(&header, 0, sizeof(BITMAPINFOHEADER));
|
||||
header.biSize = sizeof(BITMAPINFOHEADER);
|
||||
header.biWidth = Context->FadeOutContextRect.right;
|
||||
header.biHeight = Context->FadeOutContextRect.bottom;
|
||||
header.biPlanes = 1;
|
||||
header.biBitCount = 32;
|
||||
|
||||
Context->FadeOutBitmap = CreateDIBSection(hdc, (BITMAPINFO *)&header, DIB_RGB_COLORS, &Context->FadeOutBits, NULL, 0);
|
||||
|
||||
ReleaseDC(Context->Handle, hdc);
|
||||
Context->FadeOutBitmap = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, &Context->FadeOutBits, NULL, 0);
|
||||
Context->FadeOutOldBitmap = SelectBitmap(Context->FadeOutContext, Context->FadeOutBitmap);
|
||||
ReleaseDC(Context->Handle, hdc);
|
||||
|
||||
if (!Context->FadeOutBits)
|
||||
return;
|
||||
|
||||
+17
-6
@@ -1,3 +1,15 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Winsider Seminars & Solutions, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of System Informer.
|
||||
*
|
||||
* Authors:
|
||||
*
|
||||
* wj32 2010-2016
|
||||
* dmex 2016-2022
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ph.h>
|
||||
#include <uxtheme.h>
|
||||
#include <guisup.h>
|
||||
@@ -8,7 +20,7 @@ static HBITMAP PhpCreateBitmap32(
|
||||
_In_ HDC hdc,
|
||||
_In_ ULONG Width,
|
||||
_In_ ULONG Height,
|
||||
_Outptr_opt_ PVOID *Bits
|
||||
_Out_ PVOID *Bits
|
||||
)
|
||||
{
|
||||
BITMAPINFO bitmapInfo;
|
||||
@@ -17,7 +29,6 @@ static HBITMAP PhpCreateBitmap32(
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
bitmapInfo.bmiHeader.biWidth = Width;
|
||||
bitmapInfo.bmiHeader.biHeight = Height;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
@@ -68,12 +79,11 @@ static VOID PhpConvertToPArgb32(
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
bitmapInfo.bmiHeader.biWidth = Width;
|
||||
bitmapInfo.bmiHeader.biHeight = Height;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
|
||||
bits = PhAllocate(Width * sizeof(ULONG) * Height);
|
||||
bits = PhAllocate(Width * sizeof(RGBQUAD) * Height);
|
||||
|
||||
if (GetDIBits(hdc, Bitmap, 0, Height, bits, &bitmapInfo, DIB_RGB_COLORS) == Height)
|
||||
{
|
||||
@@ -130,10 +140,10 @@ static VOID PhpConvertToPArgb32IfNeeded(
|
||||
if (iconInfo.hbmMask)
|
||||
{
|
||||
PhpConvertToPArgb32(hdc, argb, iconInfo.hbmMask, Width, Height, rowWidth);
|
||||
DeleteBitmap(iconInfo.hbmMask);
|
||||
}
|
||||
|
||||
DeleteBitmap(iconInfo.hbmColor);
|
||||
DeleteBitmap(iconInfo.hbmMask);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,6 +158,7 @@ HBITMAP PhIconToBitmap(
|
||||
HBITMAP bitmap;
|
||||
RECT iconRectangle;
|
||||
HDC screenHdc;
|
||||
PVOID bits;
|
||||
HDC hdc;
|
||||
HBITMAP oldBitmap;
|
||||
BLENDFUNCTION blendFunction = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
|
||||
@@ -162,7 +173,7 @@ HBITMAP PhIconToBitmap(
|
||||
|
||||
screenHdc = GetDC(NULL);
|
||||
hdc = CreateCompatibleDC(screenHdc);
|
||||
bitmap = PhpCreateBitmap32(screenHdc, Width, Height, NULL);
|
||||
bitmap = PhpCreateBitmap32(screenHdc, Width, Height, &bits);
|
||||
ReleaseDC(NULL, screenHdc);
|
||||
oldBitmap = SelectBitmap(hdc, bitmap);
|
||||
|
||||
|
||||
+19
-24
@@ -5215,10 +5215,8 @@ VOID PhTnpPaint(
|
||||
if (Context->ThemeSupport)
|
||||
{
|
||||
HDC tempDc;
|
||||
BITMAPINFOHEADER header;
|
||||
HBITMAP bitmap;
|
||||
HBITMAP oldBitmap;
|
||||
PVOID bits;
|
||||
RECT tempRect;
|
||||
BLENDFUNCTION blendFunction;
|
||||
|
||||
@@ -5228,15 +5226,16 @@ VOID PhTnpPaint(
|
||||
|
||||
if (tempDc = CreateCompatibleDC(hdc))
|
||||
{
|
||||
memset(&header, 0, sizeof(BITMAPINFOHEADER));
|
||||
header.biSize = sizeof(BITMAPINFOHEADER);
|
||||
header.biWidth = 1;
|
||||
header.biHeight = 1;
|
||||
header.biPlanes = 1;
|
||||
header.biBitCount = 24;
|
||||
bitmap = CreateDIBSection(tempDc, (BITMAPINFO *)&header, DIB_RGB_COLORS, &bits, NULL, 0);
|
||||
//BITMAPINFO bitmapInfo;
|
||||
//memset(&bitmapInfo, 0, sizeof(BITMAPINFOHEADER));
|
||||
//bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
//bitmapInfo.bmiHeader.biWidth = 1;
|
||||
//bitmapInfo.bmiHeader.biHeight = 1;
|
||||
//bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
//bitmapInfo.bmiHeader.biBitCount = 24;
|
||||
//bitmap = CreateDIBSection(tempDc, &bitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
|
||||
if (bitmap)
|
||||
if (bitmap = CreateCompatibleBitmap(hdc, 1, 1))
|
||||
{
|
||||
// Draw the outline of the selection rectangle.
|
||||
//FrameRect(hdc, &rowRect, GetSysColorBrush(COLOR_HIGHLIGHT));
|
||||
@@ -5993,32 +5992,28 @@ VOID PhTnpDrawSelectionRectangle(
|
||||
if (Context->SelectionRectangleAlpha)
|
||||
{
|
||||
HDC tempDc;
|
||||
BITMAPINFOHEADER header;
|
||||
HBITMAP bitmap;
|
||||
HBITMAP oldBitmap;
|
||||
PVOID bits;
|
||||
RECT tempRect;
|
||||
BLENDFUNCTION blendFunction;
|
||||
|
||||
tempDc = CreateCompatibleDC(hdc);
|
||||
|
||||
if (tempDc)
|
||||
if (tempDc = CreateCompatibleDC(hdc))
|
||||
{
|
||||
memset(&header, 0, sizeof(BITMAPINFOHEADER));
|
||||
header.biSize = sizeof(BITMAPINFOHEADER);
|
||||
header.biWidth = 1;
|
||||
header.biHeight = 1;
|
||||
header.biPlanes = 1;
|
||||
header.biBitCount = 24;
|
||||
bitmap = CreateDIBSection(tempDc, (BITMAPINFO *)&header, DIB_RGB_COLORS, &bits, NULL, 0);
|
||||
//BITMAPINFO bitmapInfo;
|
||||
//memset(&bitmapInfo, 0, sizeof(BITMAPINFOHEADER));
|
||||
//bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
//bitmapInfo.bmiHeader.biWidth = 1;
|
||||
//bitmapInfo.bmiHeader.biHeight = 1;
|
||||
//bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
//bitmapInfo.bmiHeader.biBitCount = 24;
|
||||
//bitmap = CreateDIBSection(tempDc, &bitmapInfo, DIB_RGB_COLORS, NULL, NULL, 0);
|
||||
|
||||
if (bitmap)
|
||||
if (bitmap = CreateCompatibleBitmap(hdc, 1, 1))
|
||||
{
|
||||
// Draw the outline of the selection rectangle.
|
||||
FrameRect(hdc, &rect, GetSysColorBrush(COLOR_HIGHLIGHT));
|
||||
|
||||
// Fill in the selection rectangle.
|
||||
|
||||
oldBitmap = SelectBitmap(tempDc, bitmap);
|
||||
tempRect.left = 0;
|
||||
tempRect.top = 0;
|
||||
|
||||
@@ -155,7 +155,6 @@ typedef struct _PH_NF_BITMAP
|
||||
{
|
||||
BOOLEAN Initialized;
|
||||
HDC Hdc;
|
||||
BITMAPINFOHEADER Header;
|
||||
HBITMAP Bitmap;
|
||||
PVOID Bits;
|
||||
LONG Width;
|
||||
@@ -216,18 +215,19 @@ static VOID PhBeginBitmap2(
|
||||
if (!Context->Initialized)
|
||||
{
|
||||
HDC screenHdc;
|
||||
BITMAPINFO bitmapInfo;
|
||||
|
||||
memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bitmapInfo.bmiHeader.biWidth = Context->Width;
|
||||
bitmapInfo.bmiHeader.biHeight = Context->Height;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
|
||||
screenHdc = GetDC(NULL);
|
||||
Context->Hdc = CreateCompatibleDC(screenHdc);
|
||||
|
||||
memset(&Context->Header, 0, sizeof(BITMAPINFOHEADER));
|
||||
Context->Header.biSize = sizeof(BITMAPINFOHEADER);
|
||||
Context->Header.biWidth = Context->Width;
|
||||
Context->Header.biHeight = Context->Height;
|
||||
Context->Header.biPlanes = 1;
|
||||
Context->Header.biBitCount = 32;
|
||||
Context->Bitmap = CreateDIBSection(screenHdc, (PBITMAPINFO)&Context->Header, DIB_RGB_COLORS, &Context->Bits, NULL, 0);
|
||||
|
||||
Context->Bitmap = CreateDIBSection(screenHdc, &bitmapInfo, DIB_RGB_COLORS, &Context->Bits, NULL, 0);
|
||||
ReleaseDC(NULL, screenHdc);
|
||||
|
||||
Context->TaskbarDpi = dpiValue;
|
||||
|
||||
@@ -233,12 +233,13 @@ HBITMAP PhLoadPngImageFromResource(
|
||||
IWICBitmapFrameDecode_Release(wicFrame);
|
||||
}
|
||||
|
||||
memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
|
||||
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
bitmapInfo.bmiHeader.biWidth = rect.Width;
|
||||
bitmapInfo.bmiHeader.biHeight = -((LONG)rect.Height);
|
||||
bitmapInfo.bmiHeader.biPlanes = 1;
|
||||
bitmapInfo.bmiHeader.biBitCount = 32;
|
||||
bitmapInfo.bmiHeader.biCompression = BI_RGB;
|
||||
|
||||
screenHdc = GetDC(NULL);
|
||||
bufferDc = CreateCompatibleDC(screenHdc);
|
||||
|
||||
Reference in New Issue
Block a user