chore: fix chromium-style errors in windows code
This commit is contained in:
parent
aa4ca406c8
commit
43c1a7778d
11 changed files with 56 additions and 47 deletions
|
@ -83,7 +83,7 @@ static HBITMAP StretchBitmap(HBITMAP bitmap, unsigned width, unsigned height) {
|
|||
if (GetDIBits(hdc_screen, bitmap, 0, 0, 0,
|
||||
reinterpret_cast<BITMAPINFO*>(&bmi), DIB_RGB_COLORS) &&
|
||||
bmi.biSizeImage > 0 && (bmi.biSizeImage % 4) == 0) {
|
||||
auto buf = reinterpret_cast<BYTE*>(
|
||||
auto* buf = reinterpret_cast<BYTE*>(
|
||||
_aligned_malloc(bmi.biSizeImage, sizeof(DWORD)));
|
||||
|
||||
if (buf) {
|
||||
|
@ -117,12 +117,12 @@ static HBITMAP StretchBitmap(HBITMAP bitmap, unsigned width, unsigned height) {
|
|||
bmi.biCompression = BI_RGB;
|
||||
|
||||
void* color_bits;
|
||||
auto color_bitmap =
|
||||
auto* color_bitmap =
|
||||
CreateDIBSection(NULL, reinterpret_cast<BITMAPINFO*>(&bmi),
|
||||
DIB_RGB_COLORS, &color_bits, NULL, 0);
|
||||
|
||||
void* alpha_bits;
|
||||
auto alpha_bitmap =
|
||||
auto* alpha_bitmap =
|
||||
CreateDIBSection(NULL, reinterpret_cast<BITMAPINFO*>(&bmi),
|
||||
DIB_RGB_COLORS, &alpha_bits, NULL, 0);
|
||||
|
||||
|
@ -148,9 +148,9 @@ static HBITMAP StretchBitmap(HBITMAP bitmap, unsigned width, unsigned height) {
|
|||
GdiFlush();
|
||||
|
||||
// apply the alpha channel
|
||||
auto dest = reinterpret_cast<BYTE*>(color_bits);
|
||||
auto src = reinterpret_cast<const BYTE*>(alpha_bits);
|
||||
auto end = src + (width * height * 4);
|
||||
auto* dest = reinterpret_cast<BYTE*>(color_bits);
|
||||
auto* src = reinterpret_cast<const BYTE*>(alpha_bits);
|
||||
auto* end = src + (width * height * 4);
|
||||
while (src != end) {
|
||||
dest[3] = src[0];
|
||||
dest += 4;
|
||||
|
@ -214,10 +214,10 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
|
|||
LPARAM lparam) {
|
||||
switch (message) {
|
||||
case WM_CREATE: {
|
||||
auto& cs = reinterpret_cast<const CREATESTRUCT*&>(lparam);
|
||||
auto data =
|
||||
auto*& cs = reinterpret_cast<const CREATESTRUCT*&>(lparam);
|
||||
auto* data =
|
||||
static_cast<shared_ptr<NotificationData>*>(cs->lpCreateParams);
|
||||
auto inst = new Toast(hwnd, data);
|
||||
auto* inst = new Toast(hwnd, data);
|
||||
SetWindowLongPtr(hwnd, 0, (LONG_PTR)inst);
|
||||
} break;
|
||||
|
||||
|
@ -236,7 +236,7 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
|
|||
return 0;
|
||||
|
||||
case WM_LBUTTONDOWN: {
|
||||
auto inst = Get(hwnd);
|
||||
auto* inst = Get(hwnd);
|
||||
|
||||
inst->Dismiss();
|
||||
|
||||
|
@ -249,7 +249,7 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
|
|||
return 0;
|
||||
|
||||
case WM_MOUSEMOVE: {
|
||||
auto inst = Get(hwnd);
|
||||
auto* inst = Get(hwnd);
|
||||
if (!inst->is_highlighted_) {
|
||||
inst->is_highlighted_ = true;
|
||||
|
||||
|
@ -269,7 +269,7 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
|
|||
return 0;
|
||||
|
||||
case WM_MOUSELEAVE: {
|
||||
auto inst = Get(hwnd);
|
||||
auto* inst = Get(hwnd);
|
||||
inst->is_highlighted_ = false;
|
||||
inst->is_close_hot_ = false;
|
||||
inst->UpdateContents();
|
||||
|
@ -283,7 +283,7 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
|
|||
return 0;
|
||||
|
||||
case WM_WINDOWPOSCHANGED: {
|
||||
auto& wp = reinterpret_cast<WINDOWPOS*&>(lparam);
|
||||
auto*& wp = reinterpret_cast<WINDOWPOS*&>(lparam);
|
||||
if (wp->flags & SWP_HIDEWINDOW) {
|
||||
if (!IsWindowVisible(hwnd))
|
||||
Get(hwnd)->is_highlighted_ = false;
|
||||
|
@ -357,7 +357,7 @@ void DesktopNotificationController::Toast::Draw() {
|
|||
|
||||
// Draw background
|
||||
{
|
||||
auto brush = CreateSolidBrush(back_color);
|
||||
auto* brush = CreateSolidBrush(back_color);
|
||||
|
||||
RECT rc = {0, 0, toast_size_.cx, toast_size_.cy};
|
||||
FillRect(hdc_, &rc, brush);
|
||||
|
@ -368,8 +368,8 @@ void DesktopNotificationController::Toast::Draw() {
|
|||
SetBkMode(hdc_, TRANSPARENT);
|
||||
|
||||
const auto close = L'\x2715';
|
||||
auto caption_font = data_->controller->GetCaptionFont();
|
||||
auto body_font = data_->controller->GetBodyFont();
|
||||
auto* caption_font = data_->controller->GetCaptionFont();
|
||||
auto* body_font = data_->controller->GetBodyFont();
|
||||
|
||||
TEXTMETRIC tm_cap;
|
||||
SelectFont(hdc_, caption_font);
|
||||
|
@ -520,7 +520,7 @@ void DesktopNotificationController::Toast::UpdateBufferSize() {
|
|||
if (new_size.cx != this->toast_size_.cx ||
|
||||
new_size.cy != this->toast_size_.cy) {
|
||||
HDC hdc_screen = GetDC(NULL);
|
||||
auto new_bitmap =
|
||||
auto* new_bitmap =
|
||||
CreateCompatibleBitmap(hdc_screen, new_size.cx, new_size.cy);
|
||||
ReleaseDC(NULL, hdc_screen);
|
||||
|
||||
|
@ -733,7 +733,7 @@ HDWP DesktopNotificationController::Toast::Animate(HDWP hdwp,
|
|||
// ULWI fails, which can happen when one of the dimensions is zero (e.g.
|
||||
// at the beginning of ease-in).
|
||||
|
||||
auto ulw_result = UpdateLayeredWindowIndirect(hwnd_, &ulw);
|
||||
UpdateLayeredWindowIndirect(hwnd_, &ulw);
|
||||
hdwp = DeferWindowPos(hdwp, hwnd_, HWND_TOPMOST, pt.x, pt.y, size.cx, size.cy,
|
||||
dwpFlags);
|
||||
return hdwp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue