From fd36509e51c3129759a37e41ed0c00d3b239c5a5 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Tue, 9 Sep 2014 09:58:39 +0000 Subject: [PATCH] fixing implicit narrowing conversions, silencing ICC warnings, fixes #16542 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77562 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/graphicsd2d.cpp | 46 ++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/src/msw/graphicsd2d.cpp b/src/msw/graphicsd2d.cpp index 4fe97ebe7c..0777bcf627 100644 --- a/src/msw/graphicsd2d.cpp +++ b/src/msw/graphicsd2d.cpp @@ -1149,9 +1149,9 @@ void wxD2DPathData::AddCurveToPoint(wxDouble cx1, wxDouble cy1, wxDouble cx2, wx { EnsureFigureOpen(); D2D1_BEZIER_SEGMENT bezierSegment = { - {cx1, cy1}, - {cx2, cy2}, - {x, y}}; + { (FLOAT)cx1, (FLOAT)cy1 }, + { (FLOAT)cx2, (FLOAT)cy2 }, + { (FLOAT)x, (FLOAT)y } }; m_geometrySink->AddBezier(bezierSegment); m_currentPoint = D2D1::Point2F(x, y); @@ -1197,8 +1197,8 @@ void wxD2DPathData::AddArc(wxDouble x, wxDouble y, wxDouble r, wxDouble startAng D2D1_ARC_SIZE arcSize = angle > 180 ? D2D1_ARC_SIZE_LARGE : D2D1_ARC_SIZE_SMALL; D2D1_ARC_SEGMENT arcSegment = { - {end.m_x + x, end.m_y + y}, // end point - {r, r}, // size + { (FLOAT)(end.m_x + x), (FLOAT)(end.m_y + y) }, // end point + { (FLOAT)r, (FLOAT) r }, // size 0, // rotation sweepDirection, // sweep direction arcSize // arc size @@ -1223,7 +1223,7 @@ void wxD2DPathData::AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h) wxCOMPtr ellipseGeometry; wxCOMPtr newPathGeometry; - D2D1_ELLIPSE ellipse = { {x + w / 2, y + h / 2}, w / 2, h / 2 }; + D2D1_ELLIPSE ellipse = { { (FLOAT)(x + w / 2), (FLOAT)(y + h / 2) }, (FLOAT)(w / 2), (FLOAT)(h / 2) }; m_direct2dfactory->CreateEllipseGeometry(ellipse, &ellipseGeometry); @@ -1313,7 +1313,7 @@ struct wxPBGRAColor {} wxPBGRAColor(const wxColor& color) : - a(color.Alpha()), r(color.Red()), g(color.Green()), b(color.Blue()) + b(color.Blue()), g(color.Green()), r(color.Red()), a(color.Alpha()) {} bool IsBlack() const { return r == 0 && g == 0 && b == 0; } @@ -1427,6 +1427,8 @@ public: case wxBRUSHSTYLE_VERTICAL_HATCH: CopyPattern(buffer, VERTICAL_PATTERN); break; + default: + break; } return S_OK; @@ -1513,7 +1515,7 @@ public: // Retrieve the size of the bitmap UINT w, h; bitmap->GetSize(&w, &h); - WICRect lockSize = {0, 0, w, h}; + WICRect lockSize = {0, 0, (INT)w, (INT)h}; // Obtain a bitmap lock for exclusive write bitmap->Lock(&lockSize, WICBitmapLockWrite, &m_pixelLock); @@ -1765,8 +1767,8 @@ public: struct LinearGradientInfo { const wxRect direction; const wxGraphicsGradientStops stops; - LinearGradientInfo(wxDouble& x1, wxDouble& y1, wxDouble& x2, wxDouble& y2, const wxGraphicsGradientStops& stops) - : direction(x1, y1, x2, y2), stops(stops) {} + LinearGradientInfo(wxDouble& x1, wxDouble& y1, wxDouble& x2, wxDouble& y2, const wxGraphicsGradientStops& stops_) + : direction(x1, y1, x2, y2), stops(stops_) {} }; wxD2DLinearGradientBrushResourceHolder(wxDouble& x1, wxDouble& y1, wxDouble& x2, wxDouble& y2, const wxGraphicsGradientStops& stops) @@ -1797,8 +1799,8 @@ public: const wxDouble radius; const wxGraphicsGradientStops stops; - RadialGradientInfo(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, wxDouble r, const wxGraphicsGradientStops& stops) - : direction(x1, y1, x2, y2), radius(r), stops(stops) {} + RadialGradientInfo(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2, wxDouble r, const wxGraphicsGradientStops& stops_) + : direction(x1, y1, x2, y2), radius(r), stops(stops_) {} }; wxD2DRadialGradientBrushResourceHolder(wxDouble& x1, wxDouble& y1, wxDouble& x2, wxDouble& y2, wxDouble& r, const wxGraphicsGradientStops& stops) @@ -1924,6 +1926,8 @@ wxBrushStyle wxConvertPenStyleToBrushStyle(wxPenStyle penStyle) return wxBRUSHSTYLE_HORIZONTAL_HATCH; case wxPENSTYLE_VERTICAL_HATCH: return wxBRUSHSTYLE_VERTICAL_HATCH; + default: + break; } return wxBRUSHSTYLE_SOLID; @@ -2145,7 +2149,7 @@ wxCOMPtr wxD2DFontData::CreateTextLayout(const wxString& text MAX_HEIGHT, &textLayout); - DWRITE_TEXT_RANGE textRange = { 0, text.length() }; + DWRITE_TEXT_RANGE textRange = { 0, (UINT32) text.length() }; if (m_underlined) { @@ -2699,7 +2703,7 @@ public: wxD2DContext(wxGraphicsRenderer* renderer, ID2D1Factory* direct2dFactory, void* nativeContext); - ~wxD2DContext() wxOVERRIDE; + ~wxD2DContext(); void Clip(const wxRegion& region) wxOVERRIDE; @@ -3265,7 +3269,7 @@ void wxD2DContext::DrawRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h) EnsureInitialized(); AdjustRenderTargetSize(); - D2D1_RECT_F rect = {x, y, x + w, y + h}; + D2D1_RECT_F rect = { (FLOAT)x, (FLOAT)y, (FLOAT)(x + w), (FLOAT)(y + h) }; if (!m_brush.IsNull()) @@ -3293,9 +3297,9 @@ void wxD2DContext::DrawRoundedRectangle(wxDouble x, wxDouble y, wxDouble w, wxDo EnsureInitialized(); AdjustRenderTargetSize(); - D2D1_RECT_F rect = {x, y, x + w, y + h}; + D2D1_RECT_F rect = { (FLOAT)x, (FLOAT)y, (FLOAT)(x + w), (FLOAT)(y + h) }; - D2D1_ROUNDED_RECT roundedRect = {rect, radius, radius}; + D2D1_ROUNDED_RECT roundedRect = { rect, (FLOAT)radius, (FLOAT)radius }; if (!m_brush.IsNull()) { @@ -3323,9 +3327,9 @@ void wxD2DContext::DrawEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h) AdjustRenderTargetSize(); D2D1_ELLIPSE ellipse = { - {(x + w / 2), (y + h / 2)}, // center point - w / 2, // radius x - h / 2 // radius y + { (FLOAT)(x + w / 2), (FLOAT)(y + h / 2) }, // center point + (FLOAT)(w / 2), // radius x + (FLOAT)(h / 2) // radius y }; if (!m_brush.IsNull()) @@ -3584,7 +3588,7 @@ wxGraphicsPen wxD2DRenderer::CreatePen(const wxPen& pen) wxGraphicsBrush wxD2DRenderer::CreateBrush(const wxBrush& brush) { - if ( !brush.IsOk() || brush.GetStyle() == wxPENSTYLE_TRANSPARENT ) + if ( !brush.IsOk() || brush.GetStyle() == wxBRUSHSTYLE_TRANSPARENT ) { return wxNullGraphicsBrush; }