aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2012-07-17 13:05:57 +1000
committernyamatongwe <devnull@localhost>2012-07-17 13:05:57 +1000
commit6593e51be481f91379970bc2fdda9cdc81fde251 (patch)
treed0c28fa9cff08e16c04f160999f02c0327d180fe
parentb4813cbdd4fe867c276b363e597b32f6a82a58dd (diff)
downloadscintilla-mirror-6593e51be481f91379970bc2fdda9cdc81fde251.tar.gz
Avoid loss of precision warnings from Borland.
-rw-r--r--src/XPM.cxx8
-rw-r--r--win32/PlatWin.cxx8
2 files changed, 8 insertions, 8 deletions
diff --git a/src/XPM.cxx b/src/XPM.cxx
index aeb94a9c6..db48ea227 100644
--- a/src/XPM.cxx
+++ b/src/XPM.cxx
@@ -356,10 +356,10 @@ const unsigned char *RGBAImage::Pixels() const {
void RGBAImage::SetPixel(int x, int y, ColourDesired colour, int alpha) {
unsigned char *pixel = &pixelBytes[0] + (y*width+x) * 4;
// RGBA
- pixel[0] = colour.GetRed();
- pixel[1] = colour.GetGreen();
- pixel[2] = colour.GetBlue();
- pixel[3] = alpha;
+ pixel[0] = static_cast<unsigned char>(colour.GetRed());
+ pixel[1] = static_cast<unsigned char>(colour.GetGreen());
+ pixel[2] = static_cast<unsigned char>(colour.GetBlue());
+ pixel[3] = static_cast<unsigned char>(alpha);
}
RGBAImageSet::RGBAImageSet() : height(-1), width(-1){
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index ffb129d49..507567bb8 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -848,10 +848,10 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig
unsigned char *pixel = image + (y*width+x) * 4;
unsigned char alpha = pixelsImage[3];
// Input is RGBA, output is BGRA with premultiplied alpha
- pixel[2] = (*pixelsImage++) * alpha / 255;
- pixel[1] = (*pixelsImage++) * alpha / 255;
- pixel[0] = (*pixelsImage++) * alpha / 255;
- pixel[3] = *pixelsImage++;
+ pixel[2] = static_cast<unsigned char>((*pixelsImage++) * alpha / 255);
+ pixel[1] = static_cast<unsigned char>((*pixelsImage++) * alpha / 255);
+ pixel[0] = static_cast<unsigned char>((*pixelsImage++) * alpha / 255);
+ pixel[3] = static_cast<unsigned char>(*pixelsImage++);
}
}