summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp2
-rw-r--r--src/display/cairo-utils.cpp17
-rw-r--r--src/display/cairo-utils.h2
-rw-r--r--src/display/sp-canvas.cpp5
-rw-r--r--src/display/sp-canvas.h2
5 files changed, 20 insertions, 8 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index ea6ef1bc3..3f40e7e75 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -1874,7 +1874,7 @@ static void _namedview_modified (SPObject *obj, guint flags, SPDesktop *desktop)
if (flags & SP_OBJECT_MODIFIED_FLAG) {
if (nv->pagecheckerboard) {
- desktop->canvas->setBackgroundCheckerboard();
+ desktop->canvas->setBackgroundCheckerboard(nv->pagecolor);
} else {
desktop->canvas->setBackgroundColor(nv->pagecolor);
}
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp
index 6dd343298..0a1dbd3d6 100644
--- a/src/display/cairo-utils.cpp
+++ b/src/display/cairo-utils.cpp
@@ -1280,18 +1280,29 @@ int ink_cairo_surface_linear_to_srgb(cairo_surface_t *surface)
}
cairo_pattern_t *
-ink_cairo_pattern_create_checkerboard()
+ink_cairo_pattern_create_checkerboard(guint32 rgba)
{
int const w = 6;
int const h = 6;
+ double r = SP_RGBA32_R_F(rgba);
+ double g = SP_RGBA32_G_F(rgba);
+ double b = SP_RGBA32_B_F(rgba);
+
+ float hsl[3];
+ SPColor::rgb_to_hsl_floatv(hsl, r, g, b);
+ hsl[2] += hsl[2] < 0.08 ? 0.08 : -0.08; // 0.08 = 0.77-0.69, the original checkerboard colors.
+
+ float rgb2[3];
+ SPColor::hsl_to_rgb_floatv(rgb2, hsl[0], hsl[1], hsl[2]);
+
cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 2*w, 2*h);
cairo_t *ct = cairo_create(s);
cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE);
- cairo_set_source_rgb(ct, 0.77, 0.77, 0.77);
+ cairo_set_source_rgb(ct, r, g, b);
cairo_paint(ct);
- cairo_set_source_rgb(ct, 0.69, 0.69, 0.69);
+ cairo_set_source_rgb(ct, rgb2[0], rgb2[1], rgb2[2]);
cairo_rectangle(ct, 0, 0, w, h);
cairo_rectangle(ct, w, h, w, h);
cairo_fill(ct);
diff --git a/src/display/cairo-utils.h b/src/display/cairo-utils.h
index 61f236593..fbcee5413 100644
--- a/src/display/cairo-utils.h
+++ b/src/display/cairo-utils.h
@@ -173,7 +173,7 @@ double srgb_to_linear( const double c );
int ink_cairo_surface_srgb_to_linear(cairo_surface_t *surface);
int ink_cairo_surface_linear_to_srgb(cairo_surface_t *surface);
-cairo_pattern_t *ink_cairo_pattern_create_checkerboard();
+cairo_pattern_t *ink_cairo_pattern_create_checkerboard(guint32 rgba = 0xC4C4C4FF);
GdkPixbuf *ink_pixbuf_create_from_cairo_surface(cairo_surface_t *s);
void convert_pixels_pixbuf_to_argb32(guchar *data, int w, int h, int rs);
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index 8d10ccb33..8e3851dd7 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -2728,12 +2728,13 @@ void SPCanvas::setBackgroundColor(guint32 rgba) {
addIdle();
}
-void SPCanvas::setBackgroundCheckerboard() {
+void SPCanvas::setBackgroundCheckerboard(guint32 rgba)
+{
if (_background_is_checkerboard) return;
if (_background) {
cairo_pattern_destroy(_background);
}
- _background = ink_cairo_pattern_create_checkerboard();
+ _background = ink_cairo_pattern_create_checkerboard(rgba);
_background_is_checkerboard = true;
dirtyAll();
addIdle();
diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h
index 368a05838..9b782e8a4 100644
--- a/src/display/sp-canvas.h
+++ b/src/display/sp-canvas.h
@@ -91,7 +91,7 @@ struct SPCanvas {
SPCanvasGroup *getRoot();
void setBackgroundColor(guint32 rgba);
- void setBackgroundCheckerboard();
+ void setBackgroundCheckerboard(guint32 rgba = 0xC4C4C4FF);
/// Returns new canvas as widget.
static GtkWidget *createAA();