Fix harmless warning about implicit double to char conversion.

Round the double value before passing it to wxColour::Set() instead of relying
on the implicit conversion which is dangerous and correctly flagged as such by
g++.
This commit is contained in:
Vadim Zeitlin
2015-03-01 02:01:37 +01:00
parent 2f239930eb
commit 3bec79d71c

View File

@@ -36,6 +36,7 @@
#include "wx/textfile.h"
#include "wx/hashmap.h"
#include "wx/dynarray.h"
#include "wx/math.h"
#include "wx/richtext/richtextctrl.h"
#include "wx/richtext/richtextstyles.h"
@@ -709,7 +710,9 @@ bool wxRichTextObject::DrawBoxAttributes(wxDC& dc, wxRichTextBuffer* buffer, con
// Let's pretend our background is always white. Calculate a colour value
// from this and the opacity.
double p = attr.GetTextBoxAttr().GetShadow().GetOpacity().GetValue() / 100.0;
shadowColour.Set((1.0 - p)*255 + p*shadowColour.Red(), (1.0 - p)*255 + p*shadowColour.Green(), (1.0 - p)*255 + p*shadowColour.Blue());
shadowColour.Set(wxRound((1.0 - p)*255 + p*shadowColour.Red()),
wxRound((1.0 - p)*255 + p*shadowColour.Green()),
wxRound((1.0 - p)*255 + p*shadowColour.Blue()));
}
wxRect shadowRect = borderRect;
if (attr.GetTextBoxAttr().GetShadow().GetOffsetX().IsValid())