diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-01-07 20:43:56 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2019-01-07 20:43:56 +0000 |
| commit | 4735dc985c0f63431a921646bda94e961a5683b4 (patch) | |
| tree | 2746d8800d7414ea7276813855ffccd0ed86016b /src | |
| parent | Update/Completion of Croatian translation "hr.po" (diff) | |
| download | inkscape-4735dc985c0f63431a921646bda94e961a5683b4.tar.gz inkscape-4735dc985c0f63431a921646bda94e961a5683b4.zip | |
Fix bug 1810206: Crash if XRay mode enabled (assertion failed in SPCanvas::paintXRayBuffer) and other improvements to XRay
Diffstat (limited to 'src')
| -rw-r--r-- | src/desktop.cpp | 2 | ||||
| -rw-r--r-- | src/display/canvas-axonomgrid.cpp | 26 | ||||
| -rw-r--r-- | src/display/canvas-grid.cpp | 25 | ||||
| -rw-r--r-- | src/display/guideline.cpp | 17 | ||||
| -rw-r--r-- | src/display/sodipodi-ctrl.cpp | 5 | ||||
| -rw-r--r-- | src/display/sp-canvas.cpp | 127 | ||||
| -rw-r--r-- | src/display/sp-canvas.h | 1 |
7 files changed, 124 insertions, 79 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp index 2c47c5296..5ae70094b 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -780,8 +780,6 @@ Geom::Point SPDesktop::point() const return p; } - // Shouldn't happen - std::cerr << "SPDesktop::point(): point outside of canvas!" << std::endl; Geom::Point r0 = w2d(r.min()); Geom::Point r1 = w2d(r.max()); return (r0 + r1) / 2.0; diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index db894d711..3d66c0a5a 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -437,13 +437,27 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) //set correct coloring, depending preference (when zoomed out, always major coloring or minor coloring) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint32 _empcolor; + guint32 _color = color; bool preference = prefs->getBool("/options/grids/no_emphasize_when_zoomedout", false); if( scaled && preference ) { _empcolor = color; } else { _empcolor = empcolor; } - + bool xrayactive = prefs->getBool("/desktop/xrayactive", false); + if (xrayactive) { //this allow good looking on xray zones + guint32 bg = namedview->pagecolor; + _color = SP_RGBA32_F_COMPOSE( + CLAMP(((1 - SP_RGBA32_A_F(_color)) * SP_RGBA32_R_F(bg)) + (SP_RGBA32_A_F(_color) * SP_RGBA32_R_F(_color)), 0.0, 1.0), + CLAMP(((1 - SP_RGBA32_A_F(_color)) * SP_RGBA32_G_F(bg)) + (SP_RGBA32_A_F(_color) * SP_RGBA32_G_F(_color)), 0.0, 1.0), + CLAMP(((1 - SP_RGBA32_A_F(_color)) * SP_RGBA32_B_F(bg)) + (SP_RGBA32_A_F(_color) * SP_RGBA32_B_F(_color)), 0.0, 1.0), + 1.0); + _empcolor = SP_RGBA32_F_COMPOSE( + CLAMP(((1 - SP_RGBA32_A_F(_empcolor)) * SP_RGBA32_R_F(bg)) + (SP_RGBA32_A_F(_empcolor) * SP_RGBA32_R_F(_empcolor)), 0.0, 1.0), + CLAMP(((1 - SP_RGBA32_A_F(_empcolor)) * SP_RGBA32_G_F(bg)) + (SP_RGBA32_A_F(_empcolor) * SP_RGBA32_G_F(_empcolor)), 0.0, 1.0), + CLAMP(((1 - SP_RGBA32_A_F(_empcolor)) * SP_RGBA32_B_F(bg)) + (SP_RGBA32_A_F(_empcolor) * SP_RGBA32_B_F(_empcolor)), 0.0, 1.0), + 1.0); + } cairo_save(buf->ct); cairo_translate(buf->ct, -buf->rect.left(), -buf->rect.top()); cairo_set_line_width(buf->ct, 1.0); @@ -480,7 +494,7 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) } if (!scaled && (xlinenum % empspacing) != 0) { - sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, color); + sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _color); } else { sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _empcolor); } @@ -497,7 +511,7 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) gint const x1 = x0 + round( (y1 - y0) / tan_angle[X] ); if (!scaled && (xlinenum % empspacing) != 0) { - sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, color); + sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _color); } else { sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _empcolor); } @@ -512,7 +526,7 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) gint const x0 = round(x); if (!scaled && (ylinenum % empspacing) != 0) { - sp_grid_vline (buf, x0, buf->rect.top(), buf->rect.bottom() - 1, color); + sp_grid_vline (buf, x0, buf->rect.top(), buf->rect.bottom() - 1, _color); } else { sp_grid_vline (buf, x0, buf->rect.top(), buf->rect.bottom() - 1, _empcolor); } @@ -536,7 +550,7 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) } if (!scaled && (zlinenum % empspacing) != 0) { - sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, color); + sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _color); } else { sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _empcolor); } @@ -552,7 +566,7 @@ CanvasAxonomGrid::Render (SPCanvasBuf *buf) gint const x1 = x0 + round(buf->rect.height() / tan_angle[Z] ); if (!scaled && (zlinenum % empspacing) != 0) { - sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, color); + sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _color); } else { sp_caxonomgrid_drawline (buf, x0, y0, x1, y1, _empcolor); } diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 479bc6893..6cac26524 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -573,7 +573,7 @@ CanvasXYGrid::readRepr() } } } - + if ( (value = repr->attribute("color")) ) { color = (color & 0xff) | sp_svg_read_color(value, color); } @@ -581,7 +581,7 @@ CanvasXYGrid::readRepr() if ( (value = repr->attribute("empcolor")) ) { empcolor = (empcolor & 0xff) | sp_svg_read_color(value, empcolor); } - + if ( (value = repr->attribute("opacity")) ) { sp_nv_read_opacity(value, &color); } @@ -867,6 +867,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) // no_emphasize_when_zoomedout determines color (minor or major) when only major grid lines/dots shown. Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint32 _empcolor; + guint32 _color = color; bool no_emp_when_zoomed_out = prefs->getBool("/options/grids/no_emphasize_when_zoomedout", false); if( (scaled[Geom::X] || scaled[Geom::Y]) && no_emp_when_zoomed_out ) { _empcolor = color; @@ -874,6 +875,20 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) _empcolor = empcolor; } + bool xrayactive = prefs->getBool("/desktop/xrayactive", false); + if (xrayactive) { + guint32 bg = namedview->pagecolor; + _color = SP_RGBA32_F_COMPOSE( + CLAMP(((1 - SP_RGBA32_A_F(_color)) * SP_RGBA32_R_F(bg)) + (SP_RGBA32_A_F(_color) * SP_RGBA32_R_F(_color)), 0.0, 1.0), + CLAMP(((1 - SP_RGBA32_A_F(_color)) * SP_RGBA32_G_F(bg)) + (SP_RGBA32_A_F(_color) * SP_RGBA32_G_F(_color)), 0.0, 1.0), + CLAMP(((1 - SP_RGBA32_A_F(_color)) * SP_RGBA32_B_F(bg)) + (SP_RGBA32_A_F(_color) * SP_RGBA32_B_F(_color)), 0.0, 1.0), + 1.0); + _empcolor = SP_RGBA32_F_COMPOSE( + CLAMP(((1 - SP_RGBA32_A_F(_empcolor)) * SP_RGBA32_R_F(bg)) + (SP_RGBA32_A_F(_empcolor) * SP_RGBA32_R_F(_empcolor)), 0.0, 1.0), + CLAMP(((1 - SP_RGBA32_A_F(_empcolor)) * SP_RGBA32_G_F(bg)) + (SP_RGBA32_A_F(_empcolor) * SP_RGBA32_G_F(_empcolor)), 0.0, 1.0), + CLAMP(((1 - SP_RGBA32_A_F(_empcolor)) * SP_RGBA32_B_F(bg)) + (SP_RGBA32_A_F(_empcolor) * SP_RGBA32_B_F(_empcolor)), 0.0, 1.0), + 1.0); + } cairo_save(buf->ct); cairo_translate(buf->ct, -buf->rect.left(), -buf->rect.top()); cairo_set_line_width(buf->ct, 1.0); @@ -951,10 +966,10 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) _empdot = 0xff; _empdot += (_empcolor & 0xffffff00); - guint32 _colordot = (color & 0xff) << 2; + guint32 _colordot = (_color & 0xff) << 2; if (_colordot > 0xff) _colordot = 0xff; - _colordot += (color & 0xffffff00); + _colordot += (_color & 0xffffff00); // Dash pattern must use spacing from orthogonal direction. // Offset is to center dash on orthogonal lines. @@ -987,7 +1002,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) // Set color if (!scaled[dim] && (j % empspacing) != 0) { - ink_cairo_set_source_rgba32(buf->ct, color ); + ink_cairo_set_source_rgba32(buf->ct, _color ); } else { ink_cairo_set_source_rgba32(buf->ct, _empcolor ); } diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index bb0acf1dd..4f32de9c7 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -21,10 +21,12 @@ #include <2geom/line.h> #include "sp-canvas-util.h" +#include "inkscape.h" #include "guideline.h" #include "display/cairo-utils.h" #include "display/sp-canvas.h" #include "display/sodipodi-ctrl.h" +#include "object/sp-namedview.h" static void sp_guideline_destroy(SPCanvasItem *object); @@ -82,7 +84,20 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) cairo_save(buf->ct); cairo_translate(buf->ct, -buf->rect.left(), -buf->rect.top()); - ink_cairo_set_source_rgba32(buf->ct, gl->rgba); + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + bool xrayactive = prefs->getBool("/desktop/xrayactive", false); + SPDesktop * desktop = SP_ACTIVE_DESKTOP; + if (xrayactive && desktop) { + guint32 bg = desktop->getNamedView()->pagecolor; + guint32 _color = SP_RGBA32_F_COMPOSE( + CLAMP(((1 - SP_RGBA32_A_F(gl->rgba)) * SP_RGBA32_R_F(bg)) + (SP_RGBA32_A_F(gl->rgba) * SP_RGBA32_R_F(gl->rgba)), 0.0, 1.0), + CLAMP(((1 - SP_RGBA32_A_F(gl->rgba)) * SP_RGBA32_G_F(bg)) + (SP_RGBA32_A_F(gl->rgba) * SP_RGBA32_G_F(gl->rgba)), 0.0, 1.0), + CLAMP(((1 - SP_RGBA32_A_F(gl->rgba)) * SP_RGBA32_B_F(bg)) + (SP_RGBA32_A_F(gl->rgba) * SP_RGBA32_B_F(gl->rgba)), 0.0, 1.0), + 1.0); + ink_cairo_set_source_rgba32(buf->ct, _color); + } else { + ink_cairo_set_source_rgba32(buf->ct, gl->rgba); + } cairo_set_line_width(buf->ct, 1); cairo_set_line_cap(buf->ct, CAIRO_LINE_CAP_SQUARE); cairo_set_font_size(buf->ct, 10); diff --git a/src/display/sodipodi-ctrl.cpp b/src/display/sodipodi-ctrl.cpp index c267d6c84..e16b1f2ce 100644 --- a/src/display/sodipodi-ctrl.cpp +++ b/src/display/sodipodi-ctrl.cpp @@ -657,9 +657,14 @@ sp_ctrl_render (SPCanvasItem *item, SPCanvasBuf *buf) cairo_surface_t *cache = cairo_image_surface_create_for_data( reinterpret_cast<unsigned char*>(ctrl->cache), CAIRO_FORMAT_ARGB32, w, h, w*4); cairo_surface_set_device_scale(cache, buf->device_scale, buf->device_scale); + cairo_surface_mark_dirty(cache); + cairo_save(buf->ct); cairo_set_source_surface(buf->ct, cache, ctrl->box.left() - buf->rect.left(), ctrl->box.top() - buf->rect.top()); + cairo_rectangle(buf->ct, ctrl->box.left() - buf->rect.left(), ctrl->box.top() - buf->rect.top(), w/buf->device_scale, h/buf->device_scale); + cairo_clip(buf->ct); cairo_paint(buf->ct); + cairo_restore(buf->ct); cairo_surface_destroy(cache); } ctrl->shown = TRUE; diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index e7ac1ab9b..2bf7600c7 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -1033,6 +1033,7 @@ static void sp_canvas_init(SPCanvas *canvas) canvas->_split_dragging = false; canvas->_xray_radius = 100; canvas->_xray = false; + canvas->_xray_orig = Geom::Point(); canvas->_changecursor = 0; bool _is_dragging; @@ -1767,8 +1768,14 @@ int SPCanvas::handle_motion(GtkWidget *widget, GdkEventMotion *event) if (!canvas->_xray) { sp_reset_spliter(canvas); } + Geom::Point prev_orig = canvas->_xray_orig; + canvas->_xray_orig = desktop->point(); + canvas->_xray_orig *= desktop->current_zoom(); canvas->_xray = true; - canvas->addIdle(); + if (!Geom::are_near(prev_orig, canvas->_xray_orig)) { //to avoid redraw when outside + canvas->dirtyAll(); + canvas->addIdle(); + } status = 1; } else { canvas->_xray = false; @@ -1857,12 +1864,6 @@ void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect if (_root->visible) { SP_CANVAS_ITEM_GET_CLASS(_root)->render(_root, &buf); } - SPDesktop *desktop = SP_ACTIVE_DESKTOP; - if (desktop && _xray) { - cairo_set_source_rgba(buf.ct, 1, 1, 1, 0); - cairo_arc(buf.ct, _xray_radius, _xray_radius, _xray_radius, 0, 2 * M_PI); - cairo_paint(buf.ct); - } // cairo_surface_write_to_png( imgs, "debug2.png" ); // output to X @@ -1920,10 +1921,6 @@ void SPCanvas::paintXRayBuffer(Geom::IntRect const &paint_rect, Geom::IntRect co // Make sure the following code does not go outside of _backing_store's data // FIXME for device_scale. assert(cairo_image_surface_get_format(_backing_store) == CAIRO_FORMAT_ARGB32); - assert(paint_rect.left() - _x0 >= 0); - assert(paint_rect.top() - _y0 >= 0); - assert(paint_rect.right() - _x0 <= cairo_image_surface_get_width(_backing_store)); - assert(paint_rect.bottom() - _y0 <= cairo_image_surface_get_height(_backing_store)); cairo_surface_t *copy_backing = cairo_surface_create_similar_image(_backing_store, CAIRO_FORMAT_ARGB32, paint_rect.width(), paint_rect.height()); buf.ct = cairo_create(copy_backing); @@ -1935,11 +1932,12 @@ void SPCanvas::paintXRayBuffer(Geom::IntRect const &paint_rect, Geom::IntRect co cairo_arc(buf.ct, _xray_radius, _xray_radius, _xray_radius, 0, 2 * M_PI); cairo_clip(buf.ct); cairo_paint(buf.ct); + cairo_translate(buf.ct, -paint_rect.left(), -paint_rect.top()); cairo_set_source(buf.ct, _background); cairo_set_operator(buf.ct, CAIRO_OPERATOR_SOURCE); cairo_paint(buf.ct); - - // cairo_surface_write_to_png( copy_backing, "debug1.png" ); + cairo_translate(buf.ct, paint_rect.left(), paint_rect.top()); + // cairo_surface_write_to_png( copy_backing, "debug1.png" ); @@ -1951,9 +1949,6 @@ void SPCanvas::paintXRayBuffer(Geom::IntRect const &paint_rect, Geom::IntRect co cairo_clip(buf.ct); cairo_set_operator(buf.ct, CAIRO_OPERATOR_DEST_IN); cairo_paint(buf.ct); - // cairo_arc(buf.ct, _xray_orig[Geom::X], _xray_orig[Geom::Y], _xray_radius, 0, 2*M_PI); - // cairo_clip(buf.ct); - // cairo_paint(buf.ct); // cairo_surface_write_to_png( copy_backing, "debug2.png" ); // output to X @@ -1968,8 +1963,6 @@ void SPCanvas::paintXRayBuffer(Geom::IntRect const &paint_rect, Geom::IntRect co // cairo_surface_write_to_png( _backing_store, "debug3.png" ); cairo_surface_mark_dirty(_backing_store); // Mark the painted rectangle un-clean to remove old x-ray when mouse change position - markRect(paint_rect, 1); - gtk_widget_queue_draw_area(GTK_WIDGET(this), paint_rect.left() - _x0, paint_rect.top() - _y0, paint_rect.width(), paint_rect.height()); } @@ -2393,38 +2386,44 @@ int SPCanvas::paint() double split_x = 1; double split_y = 1; - if (desktop && desktop->splitMode()) { + Inkscape::RenderMode rm = Inkscape::RENDERMODE_NORMAL; + if (desktop) { split = desktop->splitMode(); arena = SP_CANVAS_ARENA(desktop->drawing); - auto window = desktop->getToplevel(); - auto dtw = static_cast<SPDesktopWidget *>(window->get_data("desktopwidget")); - bool hasrullers = prefs->getBool(desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state"); - int hruler_gap = hasrullers ? dtw->get_hruler_thickness() : 1; - int vruler_gap = hasrullers ? dtw->get_vruler_thickness() : 1; - - split_x = !_split_vertical ? 0 : _split_value; - split_y = _split_vertical ? 0 : _split_value; - - Geom::IntCoord coord1x = - allocation.x + (int((allocation.width) * split_x)) - (3 * canvas->_device_scale) - vruler_gap; - Geom::IntCoord coord1y = - allocation.y + (int((allocation.height) * split_y)) - (3 * canvas->_device_scale) - hruler_gap; - split_x = !_split_vertical ? 1 : _split_value; - split_y = _split_vertical ? 1 : _split_value; - Geom::IntCoord coord2x = - allocation.x + (int((allocation.width) * split_x)) + (3 * canvas->_device_scale) - vruler_gap; - Geom::IntCoord coord2y = - allocation.y + (int((allocation.height) * split_y)) + (3 * canvas->_device_scale) - hruler_gap; - _spliter = Geom::OptIntRect(coord1x, coord1y, coord2x, coord2y); - split_x = !_split_vertical ? 0 : _split_value; - split_y = _split_vertical ? 0 : _split_value; - coord1x = allocation.x + (int((allocation.width ) * split_x)) - vruler_gap; - coord1y = allocation.y + (int((allocation.height) * split_y)) - hruler_gap; - split_x = !_split_vertical ? 1 : _split_value; - split_y = _split_vertical ? 1 : _split_value; - coord2x = allocation.x + allocation.width; - coord2y = allocation.y + allocation.height; - _spliter_area = Geom::OptIntRect(coord1x, coord1y, coord2x, coord2y); + rm = arena->drawing.renderMode(); + if (split) { + auto window = desktop->getToplevel(); + auto dtw = static_cast<SPDesktopWidget *>(window->get_data("desktopwidget")); + bool hasrullers = prefs->getBool(desktop->is_fullscreen() ? "/fullscreen/rulers/state" : "/window/rulers/state"); + int hruler_gap = hasrullers ? dtw->get_hruler_thickness() : 1; + int vruler_gap = hasrullers ? dtw->get_vruler_thickness() : 1; + + split_x = !_split_vertical ? 0 : _split_value; + split_y = _split_vertical ? 0 : _split_value; + + Geom::IntCoord coord1x = + allocation.x + (int((allocation.width) * split_x)) - (3 * canvas->_device_scale) - vruler_gap; + Geom::IntCoord coord1y = + allocation.y + (int((allocation.height) * split_y)) - (3 * canvas->_device_scale) - hruler_gap; + split_x = !_split_vertical ? 1 : _split_value; + split_y = _split_vertical ? 1 : _split_value; + Geom::IntCoord coord2x = + allocation.x + (int((allocation.width) * split_x)) + (3 * canvas->_device_scale) - vruler_gap; + Geom::IntCoord coord2y = + allocation.y + (int((allocation.height) * split_y)) + (3 * canvas->_device_scale) - hruler_gap; + _spliter = Geom::OptIntRect(coord1x, coord1y, coord2x, coord2y); + split_x = !_split_vertical ? 0 : _split_value; + split_y = _split_vertical ? 0 : _split_value; + coord1x = allocation.x + (int((allocation.width ) * split_x)) - vruler_gap; + coord1y = allocation.y + (int((allocation.height) * split_y)) - hruler_gap; + split_x = !_split_vertical ? 1 : _split_value; + split_y = _split_vertical ? 1 : _split_value; + coord2x = allocation.x + allocation.width; + coord2y = allocation.y + allocation.height; + _spliter_area = Geom::OptIntRect(coord1x, coord1y, coord2x, coord2y); + } else { + sp_reset_spliter(canvas); + } } else { sp_reset_spliter(canvas); } @@ -2459,14 +2458,11 @@ int SPCanvas::paint() }; } - if (arena) { - Inkscape::RenderMode rm = arena->drawing.renderMode(); + if (split) { arena->drawing.setRenderMode(Inkscape::RENDERMODE_OUTLINE); bool exact = arena->drawing.getExact(); arena->drawing.setExact(false); int n_rects = cairo_region_num_rectangles(to_draw_outline); - // _split_value /= canvas->_split_vertical ? ((allocation.widt) * _split_value ) / allocation.height) - // : ((allocation.width) * _split_value ) / allocation.height); for (int i = 0; i < n_rects; ++i) { cairo_rectangle_int_t crect; cairo_region_get_rectangle(to_draw_outline, i, &crect); @@ -2483,19 +2479,20 @@ int SPCanvas::paint() arena->drawing.setRenderMode(rm); canvas->paintSpliter(); } else if (desktop && _xray) { - Geom::Point _xray_orig = desktop->point(); - _xray_orig *= desktop->current_zoom(); - arena = SP_CANVAS_ARENA(desktop->drawing); - Inkscape::RenderMode rm = arena->drawing.renderMode(); - arena->drawing.setRenderMode(Inkscape::RENDERMODE_OUTLINE); - bool exact = arena->drawing.getExact(); - arena->drawing.setExact(false); - Geom::IntRect canvas_rect = Geom::IntRect::from_xywh(_x0, _y0, allocation.width, allocation.height); - Geom::IntRect _xray_rect = Geom::IntRect::from_xywh(_xray_orig[0] - _xray_radius, _xray_orig[1] - _xray_radius, - (_xray_radius * 2), (_xray_radius * 2)); - paintXRayBuffer(_xray_rect, canvas_rect); - arena->drawing.setExact(exact); - arena->drawing.setRenderMode(rm); + if (rm != Inkscape::RENDERMODE_OUTLINE) { + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + prefs->setBool("/desktop/xrayactive", true); + arena->drawing.setRenderMode(Inkscape::RENDERMODE_OUTLINE); + bool exact = arena->drawing.getExact(); + arena->drawing.setExact(false); + Geom::IntRect canvas_rect = Geom::IntRect::from_xywh(_x0, _y0, allocation.width, allocation.height); + Geom::IntRect _xray_rect = Geom::IntRect::from_xywh(_xray_orig[0] - _xray_radius, _xray_orig[1] - _xray_radius, + (_xray_radius * 2), (_xray_radius * 2)); + paintXRayBuffer(_xray_rect, canvas_rect); + arena->drawing.setExact(exact); + arena->drawing.setRenderMode(rm); + prefs->setBool("/desktop/xrayactive", false); + } } // we've had a full unaborted redraw, reset the full redraw counter diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index 422d7eb9c..368a05838 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -187,6 +187,7 @@ public: Geom::OptIntRect _spliter_right; Geom::Point _spliter_control_pos; Geom::Point _spliter_in_control_pos; + Geom::Point _xray_orig; double _split_value; bool _split_vertical; bool _split_inverse; |
