aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx7
-rw-r--r--src/Editor.h1
-rw-r--r--src/Indicator.cxx2
-rw-r--r--src/LineMarker.cxx12
-rw-r--r--src/LineMarker.h2
-rw-r--r--src/XPM.cxx5
-rw-r--r--src/XPM.h6
7 files changed, 23 insertions, 12 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 44226d11b..c3f1b984e 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -104,6 +104,7 @@ Editor::Editor() {
stylesValid = false;
technology = SC_TECHNOLOGY_DEFAULT;
+ scaleRGBAImage = 100;
printMagnification = 0;
printColourMode = SC_PRINT_NORMAL;
@@ -8159,9 +8160,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
sizeRGBAImage.y = wParam;
break;
+ case SCI_RGBAIMAGESETSCALE:
+ scaleRGBAImage = wParam;
+ break;
+
case SCI_MARKERDEFINERGBAIMAGE:
if (wParam <= MARKER_MAX) {
- vs.markers[wParam].SetRGBAImage(sizeRGBAImage, reinterpret_cast<unsigned char *>(lParam));
+ vs.markers[wParam].SetRGBAImage(sizeRGBAImage, scaleRGBAImage / 100.0, reinterpret_cast<unsigned char *>(lParam));
vs.CalcLargestMarkerHeight();
};
InvalidateStyleData();
diff --git a/src/Editor.h b/src/Editor.h
index 00e4ec3a6..0ae1f115f 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -133,6 +133,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
ViewStyle vs;
int technology;
Point sizeRGBAImage;
+ float scaleRGBAImage;
int printMagnification;
int printColourMode;
diff --git a/src/Indicator.cxx b/src/Indicator.cxx
index 9ea4024bb..bd17c3d1c 100644
--- a/src/Indicator.cxx
+++ b/src/Indicator.cxx
@@ -95,7 +95,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
rcBox.right = rc.right;
// Cap width at 4000 to avoid large allocations when mistakes made
int width = Platform::Minimum(rcBox.Width(), 4000);
- RGBAImage image(width, rcBox.Height(), 0);
+ RGBAImage image(width, rcBox.Height(), 1.0, 0);
// Draw horizontal lines top and bottom
for (int x=0; x<width; x++) {
for (int y=0; y<rcBox.Height(); y += rcBox.Height()-1) {
diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx
index 99e83265e..9b7f1cddc 100644
--- a/src/LineMarker.cxx
+++ b/src/LineMarker.cxx
@@ -32,9 +32,9 @@ void LineMarker::SetXPM(const char *const *linesForm) {
markType = SC_MARK_PIXMAP;
}
-void LineMarker::SetRGBAImage(Point sizeRGBAImage, const unsigned char *pixelsRGBAImage) {
+void LineMarker::SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage) {
delete image;
- image = new RGBAImage(sizeRGBAImage.x, sizeRGBAImage.y, pixelsRGBAImage);
+ image = new RGBAImage(sizeRGBAImage.x, sizeRGBAImage.y, scale, pixelsRGBAImage);
markType = SC_MARK_RGBAIMAGE;
}
@@ -99,10 +99,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
if ((markType == SC_MARK_RGBAIMAGE) && (image)) {
// Make rectangle just large enough to fit image centred on centre of rcWhole
PRectangle rcImage;
- rcImage.top = static_cast<int>(((rcWhole.top + rcWhole.bottom) - image->GetHeight()) / 2);
- rcImage.bottom = rcImage.top + image->GetHeight();
- rcImage.left = static_cast<int>(((rcWhole.left + rcWhole.right) - image->GetWidth()) / 2);
- rcImage.right = rcImage.left + image->GetWidth();
+ rcImage.top = static_cast<int>(((rcWhole.top + rcWhole.bottom) - image->GetScaledHeight()) / 2);
+ rcImage.bottom = rcImage.top + image->GetScaledHeight();
+ rcImage.left = static_cast<int>(((rcWhole.left + rcWhole.right) - image->GetScaledWidth()) / 2);
+ rcImage.right = rcImage.left + image->GetScaledWidth();
surface->DrawRGBAImage(rcImage, image->GetWidth(), image->GetHeight(), image->Pixels());
return;
}
diff --git a/src/LineMarker.h b/src/LineMarker.h
index 5c73a6217..e226ef5f5 100644
--- a/src/LineMarker.h
+++ b/src/LineMarker.h
@@ -66,7 +66,7 @@ public:
}
void SetXPM(const char *textForm);
void SetXPM(const char *const *linesForm);
- void SetRGBAImage(Point sizeRGBAImage, const unsigned char *pixelsRGBAImage);
+ void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage);
void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle);
};
diff --git a/src/XPM.cxx b/src/XPM.cxx
index db48ea227..7188c2465 100644
--- a/src/XPM.cxx
+++ b/src/XPM.cxx
@@ -319,8 +319,8 @@ int XPMSet::GetWidth() {
return (width > 0) ? width : 0;
}
-RGBAImage::RGBAImage(int width_, int height_, const unsigned char *pixels_) :
- height(height_), width(width_) {
+RGBAImage::RGBAImage(int width_, int height_, float scale_, const unsigned char *pixels_) :
+ height(height_), width(width_), scale(scale_) {
if (pixels_) {
pixelBytes.assign(pixels_, pixels_ + CountBytes());
} else {
@@ -331,6 +331,7 @@ RGBAImage::RGBAImage(int width_, int height_, const unsigned char *pixels_) :
RGBAImage::RGBAImage(const XPM &xpm) {
height = xpm.GetHeight();
width = xpm.GetWidth();
+ scale = 1;
pixelBytes.resize(CountBytes());
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
diff --git a/src/XPM.h b/src/XPM.h
index 77ab0806e..e047ca8ad 100644
--- a/src/XPM.h
+++ b/src/XPM.h
@@ -80,13 +80,17 @@ class RGBAImage {
RGBAImage &operator=(const RGBAImage &);
int height;
int width;
+ float scale;
std::vector<unsigned char> pixelBytes;
public:
- RGBAImage(int width_, int height_, const unsigned char *pixels_);
+ RGBAImage(int width_, int height_, float scale_, const unsigned char *pixels_);
RGBAImage(const XPM &xpm);
virtual ~RGBAImage();
int GetHeight() const { return height; }
int GetWidth() const { return width; }
+ float GetScale() const { return scale; }
+ float GetScaledHeight() const { return height / scale; }
+ float GetScaledWidth() const { return width / scale; }
int CountBytes() const;
const unsigned char *Pixels() const;
void SetPixel(int x, int y, ColourDesired colour, int alpha=0xff);