From 3fc8c97d80a6797e60e6b203c9b4aa9d553df8a7 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 14 May 2018 13:57:03 +1000 Subject: Modernize Platform.h (2) - noexcept, const, constexpr. ColourDesired is an int instead of long for consistency over different platforms. Changes made to Point, PRectangle, and ColourDesired. RoundXYPosition removed. --- win32/PlatWin.cxx | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'win32') diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 43b27cf7b..4c57fd133 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -675,7 +675,7 @@ void SurfaceGDI::PenColour(ColourDesired fore) { pen = 0; penOld = 0; } - pen = ::CreatePen(0,1,fore.AsLong()); + pen = ::CreatePen(0,1,fore.AsInteger()); penOld = static_cast(::SelectObject(hdc, pen)); } @@ -687,8 +687,8 @@ void SurfaceGDI::BrushColor(ColourDesired back) { brushOld = 0; } // Only ever want pure, non-dithered brushes - const ColourDesired colourNearest = ColourDesired(::GetNearestColor(hdc, back.AsLong())); - brush = ::CreateSolidBrush(colourNearest.AsLong()); + const ColourDesired colourNearest = ColourDesired(::GetNearestColor(hdc, back.AsInteger())); + brush = ::CreateSolidBrush(colourNearest.AsInteger()); brushOld = SelectBrush(hdc, brush); } void SurfaceGDI::SetFont(Font &font_) { @@ -742,7 +742,7 @@ void SurfaceGDI::FillRectangle(PRectangle rc, ColourDesired back) { // Using ExtTextOut rather than a FillRect ensures that no dithering occurs. // There is no need to allocate a brush either. const RECT rcw = RectFromPRectangle(rc); - ::SetBkColor(hdc, back.AsLong()); + ::SetBkColor(hdc, back.AsInteger()); ::ExtTextOut(hdc, rcw.left, rcw.top, ETO_OPAQUE, &rcw, TEXT(""), 0, NULL); } @@ -930,15 +930,15 @@ void SurfaceGDI::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, co void SurfaceGDI::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back) { - ::SetTextColor(hdc, fore.AsLong()); - ::SetBkColor(hdc, back.AsLong()); + ::SetTextColor(hdc, fore.AsInteger()); + ::SetBkColor(hdc, back.AsInteger()); DrawTextCommon(rc, font_, ybase, s, len, ETO_OPAQUE); } void SurfaceGDI::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back) { - ::SetTextColor(hdc, fore.AsLong()); - ::SetBkColor(hdc, back.AsLong()); + ::SetTextColor(hdc, fore.AsInteger()); + ::SetBkColor(hdc, back.AsInteger()); DrawTextCommon(rc, font_, ybase, s, len, ETO_OPAQUE | ETO_CLIPPED); } @@ -947,7 +947,7 @@ void SurfaceGDI::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybas // Avoid drawing spaces in transparent mode for (int i=0; i> 8) / 255.0f; - col.b = (fore.AsLong() >> 16) / 255.0f; + col.r = (fore.AsInteger() & 0xff) / 255.0f; + col.g = ((fore.AsInteger() & 0xff00) >> 8) / 255.0f; + col.b = (fore.AsInteger() >> 16) / 255.0f; col.a = alpha / 255.0f; if (pBrush) { pBrush->SetColor(col); -- cgit v1.2.3