Avoid some -Wfloat-conversion warnings

This commit is contained in:
Paul Cornett
2022-02-13 18:11:55 -08:00
parent 511c537362
commit 3aad506c5b
24 changed files with 55 additions and 56 deletions

View File

@@ -1072,28 +1072,28 @@ void MyCanvas::DrawWithLogicalOps(wxDC& dc)
#if wxDRAWING_DC_SUPPORTS_ALPHA || wxUSE_GRAPHICS_CONTEXT #if wxDRAWING_DC_SUPPORTS_ALPHA || wxUSE_GRAPHICS_CONTEXT
void MyCanvas::DrawAlpha(wxDC& dc) void MyCanvas::DrawAlpha(wxDC& dc)
{ {
wxDouble margin = 20 ; const int margin = 20;
wxDouble width = 180 ; const int width = 180;
wxDouble radius = 30 ; wxDouble radius = 30 ;
dc.SetPen( wxPen( wxColour( 128, 0, 0 ), 12 )); dc.SetPen( wxPen( wxColour( 128, 0, 0 ), 12 ));
dc.SetBrush(*wxRED_BRUSH); dc.SetBrush(*wxRED_BRUSH);
wxRect r(margin,margin+width*0.66,width,width) ; wxRect r(margin, margin + width * 2 / 3, width, width);
dc.DrawRoundedRectangle( r.x, r.y, r.width, r.width, radius ) ; dc.DrawRoundedRectangle( r.x, r.y, r.width, r.width, radius ) ;
dc.SetPen( wxPen( wxColour( 0, 0, 128 ), 12)); dc.SetPen( wxPen( wxColour( 0, 0, 128 ), 12));
dc.SetBrush( wxColour(0, 0, 255, 192) ); dc.SetBrush( wxColour(0, 0, 255, 192) );
r.Offset( width * 0.8 , - width * 0.66 ) ; r.Offset(width * 4 / 5, -width * 2 / 3);
dc.DrawRoundedRectangle( r.x, r.y, r.width, r.width, radius ) ; dc.DrawRoundedRectangle( r.x, r.y, r.width, r.width, radius ) ;
dc.SetPen( wxPen( wxColour( 128, 128, 0 ), 12)); dc.SetPen( wxPen( wxColour( 128, 128, 0 ), 12));
dc.SetBrush( wxBrush( wxColour( 192, 192, 0, 192))); dc.SetBrush( wxBrush( wxColour( 192, 192, 0, 192)));
r.Offset( width * 0.8 , width *0.5 ) ; r.Offset(width * 4 / 5, width / 2);
dc.DrawRoundedRectangle( r.x, r.y, r.width, r.width, radius ) ; dc.DrawRoundedRectangle( r.x, r.y, r.width, r.width, radius ) ;

View File

@@ -2777,8 +2777,7 @@ void GridFrame::OnGridRender( wxCommandEvent& event )
if ( styleRender & wxGRID_DRAW_COLS_HEADER ) if ( styleRender & wxGRID_DRAW_COLS_HEADER )
sizeRender.y += grid->GetColLabelSize(); sizeRender.y += grid->GetColLabelSize();
sizeRender.x *= zoom; sizeRender *= zoom;
sizeRender.y *= zoom;
// delete any existing render frame and create new one // delete any existing render frame and create new one
wxWindow* win = FindWindowByName( "frameRender" ); wxWindow* win = FindWindowByName( "frameRender" );

View File

@@ -240,8 +240,8 @@ private:
dc.DrawBitmap dc.DrawBitmap
( (
m_bitmap, m_bitmap,
dc.DeviceToLogicalX((size.x - m_zoom*m_bitmap.GetWidth())/2), dc.DeviceToLogicalX((size.x - int(m_zoom * m_bitmap.GetWidth())) / 2),
dc.DeviceToLogicalY((size.y - m_zoom*m_bitmap.GetHeight())/2), dc.DeviceToLogicalY((size.y - int(m_zoom * m_bitmap.GetHeight())) / 2),
true /* use mask */ true /* use mask */
); );
} }

View File

@@ -504,7 +504,7 @@ bool DXFRenderer::ParseEntities(wxInputStream& stream)
state = 2; state = 2;
else if (state > 0) else if (state > 0)
{ {
const double d=ToDouble(line2); const float d = float(ToDouble(line2));
if (line1 == "10") if (line1 == "10")
v[0].x = d; v[0].x = d;
@@ -670,7 +670,7 @@ void DXFRenderer::Render() const
{ {
DXFLine *line = (DXFLine *)p; DXFLine *line = (DXFLine *)p;
glBegin(GL_LINES); glBegin(GL_LINES);
glColor3f(c.Red()/255.0,c.Green()/255.0,c.Blue()/255.0); glColor3f(c.Red()/255.0f, c.Green()/255.0f, c.Blue()/255.0f);
glVertex3f(line->v0.x, line->v0.y, line->v0.z); glVertex3f(line->v0.x, line->v0.y, line->v0.z);
glVertex3f(line->v1.x, line->v1.y, line->v1.z); glVertex3f(line->v1.x, line->v1.y, line->v1.z);
glEnd(); glEnd();
@@ -679,7 +679,7 @@ void DXFRenderer::Render() const
{ {
DXFFace *face = (DXFFace *)p; DXFFace *face = (DXFFace *)p;
glBegin(GL_TRIANGLES); glBegin(GL_TRIANGLES);
glColor3f(c.Red()/255.0,c.Green()/255.0,c.Blue()/255.0); glColor3f(c.Red()/255.0f, c.Green()/255.0f, c.Blue()/255.0f);
glNormal3f(face->n.x, face->n.y, face->n.z); glNormal3f(face->n.x, face->n.y, face->n.z);
glVertex3f(face->v0.x, face->v0.y, face->v0.z); glVertex3f(face->v0.x, face->v0.y, face->v0.z);
glVertex3f(face->v1.x, face->v1.y, face->v1.z); glVertex3f(face->v1.x, face->v1.y, face->v1.z);

View File

@@ -383,7 +383,7 @@ private:
dc.DrawText(notImplementedText, x2, y); dc.DrawText(notImplementedText, x2, y);
else else
renderer.DrawChoice(this, dc, renderer.DrawChoice(this, dc,
wxRect(x2, y, width, 1.5*GetCharHeight()), m_flags); wxRect(x2, y, width, GetCharHeight() * 3 / 2), m_flags);
} }
int m_flags; int m_flags;

View File

@@ -952,7 +952,7 @@ MyFrame::MyFrame(const wxString& title, wxWindowID id, const wxPoint& pos,
} }
else else
{ {
int width = GetClientSize().GetWidth() * 0.8; int width = GetClientSize().GetWidth() * 4 / 5;
splitter->SplitVertically(m_richTextCtrl, styleListCtrl, width); splitter->SplitVertically(m_richTextCtrl, styleListCtrl, width);
splitter->SetSashGravity(0.8); splitter->SetSashGravity(0.8);
} }

View File

@@ -484,10 +484,10 @@ void MyPage::OnDraw(wxDC& dc)
double padding = (double)txtPad / sqrt(2.0); double padding = (double)txtPad / sqrt(2.0);
txtX = 150; txtX = 150;
txtY = 200; txtY = 200;
dc.DrawLine(txtX - padding, txtY, txtX + lenW, txtY - lenW); // top dc.DrawLine(txtX - int(padding), txtY, txtX + int(lenW), txtY - int(lenW)); // top
dc.DrawLine(txtX + lenW, txtY - lenW, txtX - padding + lenH + lenW, txtY + (lenH - lenW)); dc.DrawLine(txtX + int(lenW), txtY - int(lenW), txtX - int(padding + lenH + lenW), txtY + int(lenH - lenW));
dc.DrawLine(txtX - padding, txtY, txtX - padding + lenH, txtY + lenH); dc.DrawLine(txtX - int(padding), txtY, txtX - int(padding + lenH), txtY + int(lenH));
dc.DrawLine(txtX - padding + lenH, txtY + lenH, txtX - padding + lenH + lenW, txtY + (lenH - lenW)); // bottom dc.DrawLine(txtX - int(padding + lenH), txtY + int(lenH), txtX - int(padding + lenH + lenW), txtY + int(lenH - lenW)); // bottom
dc.DrawRotatedText(txtStr, txtX, txtY, 45); dc.DrawRotatedText(txtStr, txtX, txtY, 45);
break; break;
} }

View File

@@ -71,7 +71,7 @@ bool wxAffineMatrix2D::Invert()
{ {
const wxDouble det = m_11*m_22 - m_12*m_21; const wxDouble det = m_11*m_22 - m_12*m_21;
if ( !det ) if ( det == 0 )
return false; return false;
wxDouble ex = (m_21*m_ty - m_22*m_tx) / det; wxDouble ex = (m_21*m_ty - m_22*m_tx) / det;

View File

@@ -759,8 +759,8 @@ void wxGCDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
if ( !m_logicalFunctionSupported ) if ( !m_logicalFunctionSupported )
return; return;
wxCoord dx = x + w / 2.0; wxCoord dx = x + w / 2;
wxCoord dy = y + h / 2.0; wxCoord dy = y + h / 2;
wxDouble factor = ((wxDouble) w) / h; wxDouble factor = ((wxDouble) w) / h;
m_graphicContext->PushState(); m_graphicContext->PushState();
m_graphicContext->Translate(dx, dy); m_graphicContext->Translate(dx, dy);
@@ -1455,7 +1455,7 @@ wxRect wxGCDCImpl::MSWApplyGDIPlusTransform(const wxRect& r) const
m_graphicContext->GetTransform().TransformPoint(&x, &y); m_graphicContext->GetTransform().TransformPoint(&x, &y);
wxRect rect(r); wxRect rect(r);
rect.Offset(x, y); rect.Offset(int(x), int(y));
return rect; return rect;
} }

View File

@@ -704,7 +704,7 @@ wxImage wxImage::ResampleBox(int width, int height) const
// Calculate the average from the sum and number of averaged pixels // Calculate the average from the sum and number of averaged pixels
if (src_alpha) if (src_alpha)
{ {
if (sum_a) if (sum_a != 0)
{ {
dst_data[0] = (unsigned char)(sum_r / sum_a); dst_data[0] = (unsigned char)(sum_r / sum_a);
dst_data[1] = (unsigned char)(sum_g / sum_a); dst_data[1] = (unsigned char)(sum_g / sum_a);
@@ -1054,7 +1054,7 @@ wxImage wxImage::ResampleBicubic(int width, int height) const
// of double data type and are rounded here for accuracy // of double data type and are rounded here for accuracy
if ( src_alpha ) if ( src_alpha )
{ {
if ( sum_a ) if (sum_a != 0)
{ {
dst_data[0] = (unsigned char)(sum_r / sum_a + 0.5); dst_data[0] = (unsigned char)(sum_r / sum_a + 0.5);
dst_data[1] = (unsigned char)(sum_g / sum_a + 0.5); dst_data[1] = (unsigned char)(sum_g / sum_a + 0.5);

View File

@@ -1335,14 +1335,14 @@ void wxPostScriptDCImpl::DrawAnyText(const wxWX2MBbuf& textbuf, wxCoord textDesc
" dup stringwidth rlineto\n" " dup stringwidth rlineto\n"
" stroke\n" " stroke\n"
" grestore\n", " grestore\n",
-YLOG2DEVREL(textDescent - m_underlinePosition), -YLOG2DEVREL(textDescent - int(m_underlinePosition)),
m_underlineThickness ); m_underlineThickness );
buffer.Replace( ",", "." ); buffer.Replace( ",", "." );
PsPrint( buffer ); PsPrint( buffer );
} }
PsPrint( " show\n" ); // x y PsPrint( " show\n" ); // x y
// Advance to the beginning of th next line. // Advance to the beginning of th next line.
buffer.Printf( " %f add moveto\n", -YLOG2DEVREL(lineHeight) ); buffer.Printf( " %f add moveto\n", -YLOG2DEVREL(int(lineHeight)) );
buffer.Replace( ",", "." ); buffer.Replace( ",", "." );
PsPrint( buffer ); PsPrint( buffer );
// Execute above statements for all elements of the array // Execute above statements for all elements of the array

View File

@@ -1156,7 +1156,7 @@ wxCairoFontData::wxCairoFontData(wxGraphicsRenderer* renderer,
const wxColour& col) : const wxColour& col) :
wxGraphicsObjectRefData(renderer) wxGraphicsObjectRefData(renderer)
#ifdef __WXGTK__ #ifdef __WXGTK__
, m_wxfont(wxFontInfo(wxSize(sizeInPixels, sizeInPixels)) , m_wxfont(wxFontInfo(wxSize(int(sizeInPixels), int(sizeInPixels)))
.AllFlags(flags).FaceName(facename)) .AllFlags(flags).FaceName(facename))
#endif #endif
{ {
@@ -2506,7 +2506,7 @@ void wxCairoContext::Init(cairo_t *context)
// Factor" in Gnome Tweaks, "Force font DPI" in KDE System Settings or // Factor" in Gnome Tweaks, "Force font DPI" in KDE System Settings or
// GDK_DPI_SCALE environment variable). // GDK_DPI_SCALE environment variable).
GdkScreen* screen = gdk_screen_get_default(); GdkScreen* screen = gdk_screen_get_default();
m_fontScalingFactor = screen ? gdk_screen_get_resolution(screen) / 96.0 : 1.0; m_fontScalingFactor = screen ? float(gdk_screen_get_resolution(screen) / 96.0) : 1.0f;
#endif #endif
m_context = context; m_context = context;
@@ -3067,7 +3067,7 @@ bool wxCairoContext::SetCompositionMode(wxCompositionMode op)
void wxCairoContext::BeginLayer(wxDouble opacity) void wxCairoContext::BeginLayer(wxDouble opacity)
{ {
m_layerOpacities.push_back(opacity); m_layerOpacities.push_back(float(opacity));
cairo_push_group(m_context); cairo_push_group(m_context);
} }

View File

@@ -85,10 +85,10 @@ void wxGenericStaticBitmap::OnPaint(wxPaintEvent& WXUNUSED(event))
break; break;
} }
default:
wxFAIL_MSG("Unknown scale mode");
} }
wxASSERT_MSG(w, wxS("Unknown scale mode"));
wxDouble x = (drawSize.x - w) / 2; wxDouble x = (drawSize.x - w) / 2;
wxDouble y = (drawSize.y - h) / 2; wxDouble y = (drawSize.y - h) / 2;
#if wxUSE_GRAPHICS_CONTEXT #if wxUSE_GRAPHICS_CONTEXT

View File

@@ -4647,8 +4647,8 @@ gtk_dataview_motion_notify_callback( GtkWidget *WXUNUSED(widget),
GdkEventMotion *gdk_event, GdkEventMotion *gdk_event,
wxDataViewCtrl *dv ) wxDataViewCtrl *dv )
{ {
int x = gdk_event->x; int x = int(gdk_event->x);
int y = gdk_event->y; int y = int(gdk_event->y);
if (gdk_event->is_hint) if (gdk_event->is_hint)
{ {
#ifdef __WXGTK3__ #ifdef __WXGTK3__

View File

@@ -374,7 +374,7 @@ void wxSpinCtrlGTKBase::DoSetRange(double minVal, double maxVal)
wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );
// Negative values in the range are allowed only if base == 10 // Negative values in the range are allowed only if base == 10
if ( !wxSpinCtrlImpl::IsBaseCompatibleWithRange(minVal, maxVal, GetBase()) ) if ( !wxSpinCtrlImpl::IsBaseCompatibleWithRange(int(minVal), int(maxVal), GetBase()) )
{ {
return; return;
} }

View File

@@ -1980,7 +1980,7 @@ scroll_event(GtkWidget* widget, GdkEventScroll* gdk_event, wxWindow* win)
} }
} }
bool handled = false; bool handled = false;
if (delta_x) if (delta_x != 0)
{ {
event.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL; event.m_wheelAxis = wxMOUSE_WHEEL_HORIZONTAL;
event.m_wheelRotation = int(event.m_wheelDelta * delta_x); event.m_wheelRotation = int(event.m_wheelDelta * delta_x);
@@ -1991,7 +1991,7 @@ scroll_event(GtkWidget* widget, GdkEventScroll* gdk_event, wxWindow* win)
handled = true; handled = true;
} }
} }
if (delta_y) if (delta_y != 0)
{ {
event.m_wheelAxis = wxMOUSE_WHEEL_VERTICAL; event.m_wheelAxis = wxMOUSE_WHEEL_VERTICAL;
event.m_wheelRotation = int(event.m_wheelDelta * -delta_y); event.m_wheelRotation = int(event.m_wheelDelta * -delta_y);
@@ -3367,8 +3367,8 @@ wxEmitPressAndTapEvent(GdkEventTouch* gdk_event, wxWindow* win)
// Update touch point as the touch corresponding to "press" is moving // Update touch point as the touch corresponding to "press" is moving
if ( data->m_touchSequence == gdk_event->sequence ) if ( data->m_touchSequence == gdk_event->sequence )
{ {
data->m_lastTouchPoint.x = gdk_event->x; data->m_lastTouchPoint.x = int(gdk_event->x);
data->m_lastTouchPoint.y = gdk_event->y; data->m_lastTouchPoint.y = int(gdk_event->y);
} }
break; break;
@@ -3483,8 +3483,8 @@ touch_callback(GtkWidget* widget, GdkEventTouch* gdk_event, wxWindow* win)
if ( data->m_touchCount == 1 ) if ( data->m_touchCount == 1 )
{ {
data->m_lastTouchTime = gdk_event->time; data->m_lastTouchTime = gdk_event->time;
data->m_lastTouchPoint.x = gdk_event->x; data->m_lastTouchPoint.x = int(gdk_event->x);
data->m_lastTouchPoint.y = gdk_event->y; data->m_lastTouchPoint.y = int(gdk_event->y);
// Save the sequence which identifies touch corresponding to "press" // Save the sequence which identifies touch corresponding to "press"
data->m_touchSequence = gdk_event->sequence; data->m_touchSequence = gdk_event->sequence;

View File

@@ -2959,7 +2959,7 @@ void wxTextCtrl::MSWSetRichZoom()
// apply the new zoom ratio, Windows uses a default denominator of 100, so // apply the new zoom ratio, Windows uses a default denominator of 100, so
// do it here as well // do it here as well
num = 100 * ratio; num = UINT(100 * ratio);
denom = 100; denom = 100;
::SendMessage(GetHWND(), EM_SETZOOM, (WPARAM)num, (LPARAM)denom); ::SendMessage(GetHWND(), EM_SETZOOM, (WPARAM)num, (LPARAM)denom);
} }
@@ -3238,7 +3238,7 @@ bool wxTextCtrl::MSWSetCharFormat(const wxTextAttr& style, long start, long end)
wxFont font(style.GetFont()); wxFont font(style.GetFont());
LOGFONT lf = font.GetNativeFontInfo()->lf; LOGFONT lf = font.GetNativeFontInfo()->lf;
cf.yHeight = 20 * font.GetFractionalPointSize(); // 1 pt = 20 twips cf.yHeight = LONG(20 * font.GetFractionalPointSize()); // 1 pt = 20 twips
cf.bCharSet = lf.lfCharSet; cf.bCharSet = lf.lfCharSet;
cf.bPitchAndFamily = lf.lfPitchAndFamily; cf.bPitchAndFamily = lf.lfPitchAndFamily;
wxStrlcpy(cf.szFaceName, lf.lfFaceName, WXSIZEOF(cf.szFaceName)); wxStrlcpy(cf.szFaceName, lf.lfFaceName, WXSIZEOF(cf.szFaceName));

View File

@@ -1315,7 +1315,7 @@ OSStatus wxOSXRegionToRectsSetterCallback(
if (message == kHIShapeEnumerateRect) if (message == kHIShapeEnumerateRect)
{ {
RegionToRectsCallbackData *cb = (RegionToRectsCallbackData*) data ; RegionToRectsCallbackData *cb = (RegionToRectsCallbackData*) data ;
cb->m_rects[cb->m_current++] = wxRect( rect->origin.x , rect->origin.y , rect->size.width , rect->size.height ) ; cb->m_rects[cb->m_current++] = wxRect(int(rect->origin.x), int(rect->origin.y), int(rect->size.width), int(rect->size.height)) ;
} }
return noErr; return noErr;

View File

@@ -309,7 +309,7 @@ int wxBitmapRefData::GetWidth() const
if ( m_hBitmap ) if ( m_hBitmap )
return (int) CGBitmapContextGetWidth(m_hBitmap); return (int) CGBitmapContextGetWidth(m_hBitmap);
else else
return (int) wxOSXGetImageSize(m_nsImage).width * m_scaleFactor; return int(wxOSXGetImageSize(m_nsImage).width * m_scaleFactor);
} }
int wxBitmapRefData::GetHeight() const int wxBitmapRefData::GetHeight() const
@@ -319,7 +319,7 @@ int wxBitmapRefData::GetHeight() const
if ( m_hBitmap ) if ( m_hBitmap )
return (int) CGBitmapContextGetHeight(m_hBitmap); return (int) CGBitmapContextGetHeight(m_hBitmap);
else else
return (int) wxOSXGetImageSize(m_nsImage).height * m_scaleFactor; return int(wxOSXGetImageSize(m_nsImage).height * m_scaleFactor);
} }
int wxBitmapRefData::GetDepth() const int wxBitmapRefData::GetDepth() const
@@ -966,8 +966,8 @@ wxBitmap wxBitmap::GetSubBitmap(const wxRect &rect) const
if ( HasAlpha() ) if ( HasAlpha() )
ret.UseAlpha() ; ret.UseAlpha() ;
int destwidth = rect.width*scale ; int destwidth = int(rect.width * scale);
int destheight = rect.height*scale ; int destheight = int(rect.height * scale);
{ {
const unsigned char* sourcedata = static_cast<const unsigned char*>(GetBitmapData()->GetRawAccess()); const unsigned char* sourcedata = static_cast<const unsigned char*>(GetBitmapData()->GetRawAccess());

View File

@@ -200,9 +200,9 @@ void wxColour::GetRGBColor(RGBColor* col) const
{ {
wxCHECK_RET( IsOk(), "invalid colour" ); wxCHECK_RET( IsOk(), "invalid colour" );
col->red = M_COLDATA->Red() * 65535.0; col->red = static_cast<unsigned short>(M_COLDATA->Red() * 65535);
col->blue = M_COLDATA->Blue() * 65535.0; col->blue = static_cast<unsigned short>(M_COLDATA->Blue() * 65535);
col->green = M_COLDATA->Green() * 65535.0; col->green = static_cast<unsigned short>(M_COLDATA->Green() * 65535);
} }
#endif #endif

View File

@@ -341,7 +341,7 @@ wxArrayVideoModes wxDisplayImplMacOSX::GetModes(const wxVideoMode& mode) const
CGDisplayModeGetWidth(theValue), CGDisplayModeGetWidth(theValue),
CGDisplayModeGetHeight(theValue), CGDisplayModeGetHeight(theValue),
wxOSXCGDisplayModeGetBitsPerPixel(theValue), wxOSXCGDisplayModeGetBitsPerPixel(theValue),
CGDisplayModeGetRefreshRate(theValue)); int(CGDisplayModeGetRefreshRate(theValue)));
if (theMode.Matches( mode )) if (theMode.Matches( mode ))
resultModes.Add( theMode ); resultModes.Add( theMode );
@@ -358,7 +358,7 @@ wxVideoMode wxDisplayImplMacOSX::GetCurrentMode() const
CGDisplayModeGetWidth(theValue), CGDisplayModeGetWidth(theValue),
CGDisplayModeGetHeight(theValue), CGDisplayModeGetHeight(theValue),
wxOSXCGDisplayModeGetBitsPerPixel(theValue), wxOSXCGDisplayModeGetBitsPerPixel(theValue),
CGDisplayModeGetRefreshRate(theValue)); int(CGDisplayModeGetRefreshRate(theValue)));
} }
bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode ) bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode )
@@ -385,7 +385,7 @@ bool wxDisplayImplMacOSX::ChangeMode( const wxVideoMode& mode )
CGDisplayModeGetWidth(theValue), CGDisplayModeGetWidth(theValue),
CGDisplayModeGetHeight(theValue), CGDisplayModeGetHeight(theValue),
wxOSXCGDisplayModeGetBitsPerPixel(theValue), wxOSXCGDisplayModeGetBitsPerPixel(theValue),
CGDisplayModeGetRefreshRate(theValue)); int(CGDisplayModeGetRefreshRate(theValue)));
if ( theMode.GetWidth() == mode.GetWidth() && theMode.GetHeight() == mode.GetHeight() && if ( theMode.GetWidth() == mode.GetWidth() && theMode.GetHeight() == mode.GetHeight() &&
( mode.GetDepth() == 0 || theMode.GetDepth() == mode.GetDepth() ) && ( mode.GetDepth() == 0 || theMode.GetDepth() == mode.GetDepth() ) &&

View File

@@ -5101,7 +5101,7 @@ bool wxPropertyGrid::HandleMouseMove( int x, unsigned int y,
imageWidth = bmp.GetWidth(); imageWidth = bmp.GetWidth();
int hMax = m_lineHeight - wxPG_CUSTOM_IMAGE_SPACINGY - 1; int hMax = m_lineHeight - wxPG_CUSTOM_IMAGE_SPACINGY - 1;
if ( bmp.GetHeight() > hMax ) if ( bmp.GetHeight() > hMax )
imageWidth *= (double)hMax / bmp.GetHeight(); imageWidth = int(double(imageWidth) * hMax / bmp.GetHeight());
} }
if ( m_colHover == 0 ) if ( m_colHover == 0 )

View File

@@ -71,7 +71,7 @@ wxBitmap MakeResizedBitmap(const wxBitmap& original, wxSize size)
scale = 2.0; scale = 2.0;
wxImage img(original.ConvertToImage()); wxImage img(original.ConvertToImage());
img.Rescale(scale * size.GetWidth(), scale * size.GetHeight(), wxIMAGE_QUALITY_HIGH); img.Rescale(int(scale * size.GetWidth()), int(scale * size.GetHeight()), wxIMAGE_QUALITY_HIGH);
return wxBitmap(img, -1, scale); return wxBitmap(img, -1, scale);
} }

View File

@@ -700,7 +700,7 @@ bool wxRibbonPanel::Realize()
scale = 2.0; scale = 2.0;
wxImage img(m_minimised_icon.ConvertToImage()); wxImage img(m_minimised_icon.ConvertToImage());
img.Rescale(scale * bitmap_size.GetWidth(), scale * bitmap_size.GetHeight(), wxIMAGE_QUALITY_HIGH); img.Rescale(int(scale * bitmap_size.GetWidth()), int(scale * bitmap_size.GetHeight()), wxIMAGE_QUALITY_HIGH);
m_minimised_icon_resized = wxBitmap(img, -1, scale); m_minimised_icon_resized = wxBitmap(img, -1, scale);
} }
else else