Random UWP text bugfix. Some warning fixes.

This commit is contained in:
Henrik Rydgård 2024-06-05 12:08:10 +02:00
parent fa5ec667ef
commit 510cf1891b
2 changed files with 16 additions and 9 deletions

View File

@ -33,7 +33,9 @@ public:
Destroy();
}
if (factory == nullptr) return;
if (!factory) {
return;
}
HRESULT hr = factory->CreateTextFormat(
fname.c_str(),
@ -45,15 +47,20 @@ public:
L"",
&textFmt
);
if (FAILED(hr)) {
ERROR_LOG(G3D, "Failed creating font %s", fname.c_str());
}
}
void Destroy() {
textFmt->Release();
if (textFmt) {
textFmt->Release();
}
textFmt = nullptr;
}
IDWriteFactory4* factory = nullptr;
IDWriteFontCollection1* fontCollection = nullptr;
IDWriteTextFormat* textFmt = nullptr;
IDWriteFactory4 *factory = nullptr;
IDWriteFontCollection1 *fontCollection = nullptr;
IDWriteTextFormat *textFmt = nullptr;
std::wstring fname;
int height;
DWRITE_FONT_WEIGHT weight;
@ -61,8 +68,8 @@ public:
};
struct TextDrawerContext {
ID2D1Bitmap1* bitmap;
ID2D1Bitmap1* mirror_bmp;
ID2D1Bitmap1 *bitmap;
ID2D1Bitmap1 *mirror_bmp;
};
TextDrawerUWP::TextDrawerUWP(Draw::DrawContext *draw) : TextDrawer(draw), ctx_(nullptr) {

View File

@ -23,14 +23,14 @@ public:
if (at3pCtx_) {
codecOpen_ = true;
} else {
ERROR_LOG(ME, "Failed to open atrac3+ context! (channels=%d blockAlign=%d ed=%d)", channels, blockAlign, extraDataSize);
ERROR_LOG(ME, "Failed to open atrac3+ context! (channels=%d blockAlign=%d ed=%d)", channels, (int)blockAlign, (int)extraDataSize);
}
} else if (audioType_ == PSP_CODEC_AT3) {
at3Ctx_ = atrac3_alloc(channels, &blockAlign_, extraData, (int)extraDataSize);
if (at3Ctx_) {
codecOpen_ = true;
} else {
ERROR_LOG(ME, "Failed to open atrac3 context! !channels=%d blockAlign=%d ed=%d)", channels, blockAlign, extraDataSize);
ERROR_LOG(ME, "Failed to open atrac3 context! !channels=%d blockAlign=%d ed=%d)", channels, (int)blockAlign, (int)extraDataSize);
}
}
for (int i = 0; i < 2; i++) {