From 08a944d9f19e9c64741e7097785654ea1262ddc7 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Date: Sun, 29 Nov 2020 13:07:40 +0100 Subject: [PATCH] Fix random scaling on canvas Usualy happends on node tool, LPE, Text tool ... The problem is to this function we get the wrong CTX (Geom::Affine) sometimes seting it to scale 1 instead document scale This cause you need to zoom to refresh the draw. This is a evolution of my code done by Thomas Holder. As Nathan Lee help point this fixes this issues: Inkscape#1532 Inkscape#1251 And probably Inkscape #1469 And various issues on inbox --- src/display/drawing.cpp | 7 +++++++ src/display/drawing.h | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/display/drawing.cpp b/src/display/drawing.cpp index bf203c8985..d01fb8d0a2 100644 --- a/src/display/drawing.cpp +++ b/src/display/drawing.cpp @@ -14,6 +14,7 @@ #include #include "display/drawing.h" +#include "display/control/canvas-item-drawing.h" #include "nr-filter-gaussian.h" #include "nr-filter-types.h" @@ -161,6 +162,12 @@ Drawing::setGrayscaleMatrix(gdouble value_matrix[20]) { std::vector (value_matrix, value_matrix + 20) ); } +void +Drawing::update(Geom::IntRect const &area) +{ + update(area, _canvas_item_drawing ? _canvas_item_drawing->get_context() : UpdateContext()); +} + void Drawing::update(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags, unsigned reset) { diff --git a/src/display/drawing.h b/src/display/drawing.h index 2058f672b8..4c44e9ce28 100644 --- a/src/display/drawing.h +++ b/src/display/drawing.h @@ -74,7 +74,9 @@ public: void setGrayscaleMatrix(double value_matrix[20]); - void update(Geom::IntRect const &area = Geom::IntRect::infinite(), UpdateContext const &ctx = UpdateContext(), unsigned flags = DrawingItem::STATE_ALL, unsigned reset = 0); + void update(Geom::IntRect const &area = Geom::IntRect::infinite()); + void update(Geom::IntRect const &area, UpdateContext const &ctx, unsigned flags = DrawingItem::STATE_ALL, unsigned reset = 0); + void render(DrawingContext &dc, Geom::IntRect const &area, unsigned flags = 0, int antialiasing = -1); DrawingItem *pick(Geom::Point const &p, double delta, unsigned flags); -- GitLab