Apply clang-format across the whole tree
Run clang-format (the repo's .clang-format: LLVM base, 120 cols, tabs, Allman functions) over every source file so the tree is formatter-clean. Whitespace only -- no behavior change; full x64 + x86 suites pass. Also set SortIncludes: false in .clang-format. Windows include order is load-bearing (windows.h must precede tlhelp32.h / mmreg.h / xinput.h / dinput.h; winsock2.h must precede windows.h), and the default alphabetical sort reorders tlhelp32.h ahead of windows.h -- a build break. Leaving order alone keeps the manual, correct grouping.
This commit is contained in:
@@ -10,21 +10,16 @@
|
||||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
namespace coop::mock
|
||||
{
|
||||
namespace
|
||||
{
|
||||
namespace coop::mock {
|
||||
namespace {
|
||||
D3DCOLOR opaque(std::uint8_t r, std::uint8_t g, std::uint8_t b)
|
||||
{
|
||||
return D3DCOLOR_ARGB(255, r, g, b);
|
||||
}
|
||||
|
||||
class Dx9Backend : public RenderBackend
|
||||
{
|
||||
public:
|
||||
explicit Dx9Backend(bool ex) : ex_(ex)
|
||||
{
|
||||
}
|
||||
class Dx9Backend : public RenderBackend {
|
||||
public:
|
||||
explicit Dx9Backend(bool ex) : ex_(ex) {}
|
||||
|
||||
bool init(HWND hwnd, std::uint32_t width, std::uint32_t height) override
|
||||
{
|
||||
@@ -41,32 +36,24 @@ public:
|
||||
pp.Windowed = TRUE;
|
||||
pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE; // uncapped: the mock must be fast
|
||||
|
||||
if (ex_)
|
||||
{
|
||||
if (ex_) {
|
||||
ComPtr<IDirect3D9Ex> d3d;
|
||||
if (FAILED(Direct3DCreate9Ex(D3D_SDK_VERSION, d3d.GetAddressOf())))
|
||||
{
|
||||
if (FAILED(Direct3DCreate9Ex(D3D_SDK_VERSION, d3d.GetAddressOf()))) {
|
||||
return false;
|
||||
}
|
||||
ComPtr<IDirect3DDevice9Ex> dev;
|
||||
if (FAILED(d3d->CreateDeviceEx(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, nullptr,
|
||||
dev.GetAddressOf())))
|
||||
{
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, nullptr, dev.GetAddressOf()))) {
|
||||
return false;
|
||||
}
|
||||
dev_ = dev; // IDirect3DDevice9Ex derives from IDirect3DDevice9
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ComPtr<IDirect3D9> d3d(Direct3DCreate9(D3D_SDK_VERSION));
|
||||
if (!d3d)
|
||||
{
|
||||
if (!d3d) {
|
||||
return false;
|
||||
}
|
||||
if (FAILED(d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd,
|
||||
D3DCREATE_HARDWARE_VERTEXPROCESSING, &pp, dev_.GetAddressOf())))
|
||||
{
|
||||
if (FAILED(d3d->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hwnd, D3DCREATE_HARDWARE_VERTEXPROCESSING,
|
||||
&pp, dev_.GetAddressOf()))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -79,8 +66,7 @@ public:
|
||||
dev_->Clear(0, nullptr, D3DCLEAR_TARGET, opaque(p.bg_r, p.bg_g, p.bg_b), 1.0f, 0);
|
||||
|
||||
ComPtr<IDirect3DSurface9> back;
|
||||
if (SUCCEEDED(dev_->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, back.GetAddressOf())))
|
||||
{
|
||||
if (SUCCEEDED(dev_->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, back.GetAddressOf()))) {
|
||||
const LONG bx = static_cast<LONG>(p.bar_x);
|
||||
RECT bar = {bx, 0, bx + static_cast<LONG>(kBarWidth), static_cast<LONG>(height_)}; // moving vertical bar
|
||||
dev_->ColorFill(back.Get(), &bar, opaque(255, 255, 255));
|
||||
@@ -92,12 +78,9 @@ public:
|
||||
dev_->Present(nullptr, nullptr, nullptr, nullptr);
|
||||
}
|
||||
|
||||
[[nodiscard]] const char* name() const override
|
||||
{
|
||||
return ex_ ? "dx9ex" : "dx9";
|
||||
}
|
||||
[[nodiscard]] const char* name() const override { return ex_ ? "dx9ex" : "dx9"; }
|
||||
|
||||
private:
|
||||
private:
|
||||
bool ex_;
|
||||
std::uint32_t width_ = 0;
|
||||
std::uint32_t height_ = 0;
|
||||
|
||||
Reference in New Issue
Block a user