aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/XPM.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2011-07-21 16:33:42 +1000
committernyamatongwe <unknown>2011-07-21 16:33:42 +1000
commit09fd0473a17f58b3f744d99a3f57cca60bf2aaf1 (patch)
tree92e2dd7179464259e1425559213b0549b1e83cab /src/XPM.cxx
parentc20349a2e74c6b2e3e134052ca4a5b917c47e0ce (diff)
downloadscintilla-mirror-09fd0473a17f58b3f744d99a3f57cca60bf2aaf1.tar.gz
Added dotted box indicator.
Diffstat (limited to 'src/XPM.cxx')
-rw-r--r--src/XPM.cxx22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/XPM.cxx b/src/XPM.cxx
index 6c615dd94..f0277c65f 100644
--- a/src/XPM.cxx
+++ b/src/XPM.cxx
@@ -353,7 +353,11 @@ int XPMSet::GetWidth() {
RGBAImage::RGBAImage(int width_, int height_, const unsigned char *pixels_) :
height(height_), width(width_) {
- pixelBytes.assign(pixels_, pixels_ + CountBytes());
+ if (pixels_) {
+ pixelBytes.assign(pixels_, pixels_ + CountBytes());
+ } else {
+ pixelBytes.resize(CountBytes());
+ }
}
RGBAImage::RGBAImage(const XPM &xpm) {
@@ -365,12 +369,7 @@ RGBAImage::RGBAImage(const XPM &xpm) {
ColourDesired colour;
bool transparent = false;
xpm.PixelAt(x, y, colour, transparent);
- unsigned char *pixel = &pixelBytes[0] + (y*width+x) * 4;
- // RGBA
- pixel[0] = colour.GetRed();
- pixel[1] = colour.GetGreen();
- pixel[2] = colour.GetBlue();
- pixel[3] = transparent ? 0 : 255;
+ SetPixel(x, y, colour, transparent ? 0 : 255);
}
}
}
@@ -386,6 +385,15 @@ const unsigned char *RGBAImage::Pixels() const {
return &pixelBytes[0];
}
+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;
+}
+
RGBAImageSet::RGBAImageSet() : height(-1), width(-1){
}