lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fix GC issue in skyline rotations (issue 344960043 by address@hidden


From: dak
Subject: Re: Fix GC issue in skyline rotations (issue 344960043 by address@hidden)
Date: Sat, 16 Jun 2018 06:30:38 -0700

Reviewers: Be-3,

Message:
On 2018/06/16 12:33:50, Be-3 wrote:
First of all: thanks for taking care of this issue!
But the resulting skylines don't quite work as expected yet (see
attached image
in the issue tracker). Seems to be a problem with the centre of
rotation
co-ordinates.

Greetings,
Torsten

I assumed that the center coordinates of Stencil::rotate are, well, the
center coordinates.  They aren't.  They are some sort of relative
contraption focused around the bounding box.  Unlikely I'll get this
fixed today but I'll probably try on the train.

Description:
Fix GC issue in skyline rotations

This was issue 5341 initially and is a fix for a problem introduced
during issue 5319.  The problem basically is that a rotated Stencil is
created and its stencil expression is getting stored on the heap
without retaining any pointer to it in areas scanned during garbage
collections.

This fix is a minimal one that merely avoids creating a stencil and
instead simulates the effect on the transform matrix to be expected
from using a rotated stencil.

Please review this at https://codereview.appspot.com/344960043/

Affected files (+6, -6 lines):
  M lily/stencil-integral.cc


Index: lily/stencil-integral.cc
diff --git a/lily/stencil-integral.cc b/lily/stencil-integral.cc
index bc2bc2b41d363166d77b5bca97d67090f1bbb9b4..33fbea6797844a3440e0f013ab0433ad05a88d40 100644
--- a/lily/stencil-integral.cc
+++ b/lily/stencil-integral.cc
@@ -1128,12 +1128,12 @@ Stencil::skylines_from_stencil (SCM sten, Real pad, SCM rot, Axis a)
       Real angle = robust_scm2double (scm_car (rot), 0.0);
       Real x = robust_scm2double (scm_cadr (rot), 0.0);
       Real y = robust_scm2double (scm_caddr (rot), 0.0);
-      /* pass over a rotated copy of the stencil */
-      Stencil *q = unsmob<Stencil> (s->smobbed_copy ());
-      q->rotate_degrees (angle, Offset (x, y));
-      data = stencil_traverser
-               (make_transform_matrix (1.0, 0.0, 0.0, 1.0, 0.0, 0.0),
-                q->expr ());
+ PangoMatrix trans = make_transform_matrix (1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
+      pango_matrix_translate (&trans, x, y);
+      pango_matrix_rotate (&trans, -angle);
+      pango_matrix_translate (&trans, -x, -y);
+
+      data = stencil_traverser (trans, s->expr ());
     }

   vector<Box> boxes;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]