From f845a58768d96282b307b1482ec5545374ae9995 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Tue, 19 Jul 2005 10:37:52 +0000 Subject: [PATCH] (internal_print): only call glyph-name-procedure if style != default. 3 % speed increase (wtk2-fugue1). --- ChangeLog | 5 ++++ ...graver.cc => default-bar-line-engraver.cc} | 0 lily/fingering-engraver.cc | 18 +++++-------- lily/key-engraver.cc | 8 +----- lily/note-head.cc | 12 ++++----- lily/rest-engraver.cc | 25 ++++++++----------- lily/separating-line-group-engraver.cc | 6 +++-- lily/slash-repeat-engraver.cc | 7 +----- 8 files changed, 33 insertions(+), 48 deletions(-) rename lily/{timing-engraver.cc => default-bar-line-engraver.cc} (100%) diff --git a/ChangeLog b/ChangeLog index ea146f8047..7cd9ac0720 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2005-07-19 Han-Wen Nienhuys + * lily/*-engraver.cc (various): remove double use of + PRECOMPUTED_VIRTUAL function: only use + start_translation_timestep() and stop_translation_timestep(), not + both. + * lily/break-substitution.cc (fast_substitute_grob_array): do fast_substitute_grob_array for all unordered grob_arrays. (substitute_grob): return Grob *. Saves packing/unpacking SCMs. diff --git a/lily/timing-engraver.cc b/lily/default-bar-line-engraver.cc similarity index 100% rename from lily/timing-engraver.cc rename to lily/default-bar-line-engraver.cc diff --git a/lily/fingering-engraver.cc b/lily/fingering-engraver.cc index c2db873a77..245202faa1 100644 --- a/lily/fingering-engraver.cc +++ b/lily/fingering-engraver.cc @@ -16,7 +16,7 @@ class Fingering_engraver : public Engraver { - Link_array reqs_; + Link_array events_; Link_array fingerings_; public: @@ -24,7 +24,6 @@ public: protected: virtual bool try_music (Music *m); PRECOMPUTED_VIRTUAL void stop_translation_timestep (); - PRECOMPUTED_VIRTUAL void start_translation_timestep (); PRECOMPUTED_VIRTUAL void process_music (); virtual void acknowledge_grob (Grob_info); @@ -37,7 +36,7 @@ Fingering_engraver::try_music (Music *m) { if (m->is_mus_type ("fingering-event")) { - reqs_.push (m); + events_.push (m); return true; } return false; @@ -68,10 +67,10 @@ Fingering_engraver::acknowledge_grob (Grob_info inf) void Fingering_engraver::process_music () { - for (int i = reqs_.size (); i--;) + for (int i = events_.size (); i--;) { - SCM dir = reqs_[i]->get_property ("direction"); - make_script (to_dir (dir), reqs_[i], i); + SCM dir = events_[i]->get_property ("direction"); + make_script (to_dir (dir), events_[i], i); } } @@ -131,12 +130,7 @@ Fingering_engraver::stop_translation_timestep () return; fingerings_.clear (); -} - -void -Fingering_engraver::start_translation_timestep () -{ - reqs_.clear (); + events_.clear (); } Fingering_engraver::Fingering_engraver () diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index 2ccdef5ec1..c1a973f4a0 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -38,7 +38,6 @@ protected: virtual void finalize (); virtual bool try_music (Music *ev); PRECOMPUTED_VIRTUAL void stop_translation_timestep (); - PRECOMPUTED_VIRTUAL void start_translation_timestep (); PRECOMPUTED_VIRTUAL void process_music (); virtual void acknowledge_grob (Grob_info); }; @@ -134,6 +133,7 @@ Key_engraver::stop_translation_timestep () item_ = 0; context ()->set_property ("lastKeySignature", get_property ("keySignature")); cancellation_ = 0; + key_ev_ = 0; } void @@ -164,12 +164,6 @@ Key_engraver::read_ev (Music const *r) r->get_property ("tonic")); } -void -Key_engraver::start_translation_timestep () -{ - key_ev_ = 0; -} - void Key_engraver::initialize () { diff --git a/lily/note-head.cc b/lily/note-head.cc index a106fd2ab0..b2e451e54c 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -39,13 +39,13 @@ internal_print (Grob *me, String *font_char) } SCM log = scm_int2num (Note_head::get_balltype (me)); - SCM proc = me->get_property ("glyph-name-procedure"); - String suffix = to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2)); - if (style != ly_symbol2scm ("default") - && ly_is_procedure (proc)) - suffix = ly_scm2string (scm_call_2 (proc, log, style)); - + if (style != ly_symbol2scm ("default")) + { + SCM proc = me->get_property ("glyph-name-procedure"); + if (ly_is_procedure (proc)) + suffix = ly_scm2string (scm_call_2 (proc, log, style)); + } Font_metric *fm = Font_interface::get_default_font (me); String idx = "noteheads.s" + suffix; diff --git a/lily/rest-engraver.cc b/lily/rest-engraver.cc index e276d303c8..2a90b776ce 100644 --- a/lily/rest-engraver.cc +++ b/lily/rest-engraver.cc @@ -18,12 +18,11 @@ class Rest_engraver : public Engraver { - Music *rest_req_; + Music *rest_event_; Item *dot_; Grob *rest_; protected: virtual bool try_music (Music *); - PRECOMPUTED_VIRTUAL void stop_translation_timestep (); PRECOMPUTED_VIRTUAL void start_translation_timestep (); PRECOMPUTED_VIRTUAL void process_music (); @@ -36,7 +35,7 @@ public: */ Rest_engraver::Rest_engraver () { - rest_req_ = 0; + rest_event_ = 0; rest_ = 0; dot_ = 0; } @@ -44,29 +43,25 @@ Rest_engraver::Rest_engraver () void Rest_engraver::start_translation_timestep () { - rest_req_ = 0; -} - -void -Rest_engraver::stop_translation_timestep () -{ + rest_event_ = 0; rest_ = 0; dot_ = 0; } + void Rest_engraver::process_music () { - if (rest_req_ && !rest_) + if (rest_event_ && !rest_) { - rest_ = make_item ("Rest", rest_req_->self_scm ()); + rest_ = make_item ("Rest", rest_event_->self_scm ()); - int durlog = unsmob_duration (rest_req_->get_property ("duration"))->duration_log (); + int durlog = unsmob_duration (rest_event_->get_property ("duration"))->duration_log (); rest_->set_property ("duration-log", scm_int2num (durlog)); - int dots = unsmob_duration (rest_req_->get_property ("duration"))->dot_count (); + int dots = unsmob_duration (rest_event_->get_property ("duration"))->dot_count (); if (dots) { @@ -77,7 +72,7 @@ Rest_engraver::process_music () dot_->set_property ("dot-count", scm_int2num (dots)); } - Pitch *p = unsmob_pitch (rest_req_->get_property ("pitch")); + Pitch *p = unsmob_pitch (rest_event_->get_property ("pitch")); /* This is ridiculous -- rests don't have pitch, but we act as if @@ -100,7 +95,7 @@ Rest_engraver::try_music (Music *m) { if (m->is_mus_type ("rest-event")) { - rest_req_ = m; + rest_event_ = m; return true; } return false; diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index b8b36943f3..415f3aa3f5 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -181,8 +181,10 @@ void Separating_line_group_engraver::start_translation_timestep () { if (break_item_) - context ()->unset_property (ly_symbol2scm ("breakableSeparationItem")); - break_item_ = 0; + { + context ()->unset_property (ly_symbol2scm ("breakableSeparationItem")); + break_item_ = 0; + } } void diff --git a/lily/slash-repeat-engraver.cc b/lily/slash-repeat-engraver.cc index 74d1f52b9f..42f622699e 100644 --- a/lily/slash-repeat-engraver.cc +++ b/lily/slash-repeat-engraver.cc @@ -46,7 +46,6 @@ protected: Item *double_percent_; protected: virtual bool try_music (Music *); - PRECOMPUTED_VIRTUAL void stop_translation_timestep (); PRECOMPUTED_VIRTUAL void start_translation_timestep (); PRECOMPUTED_VIRTUAL void process_music (); }; @@ -111,14 +110,10 @@ Slash_repeat_engraver::start_translation_timestep () { repeat_ = 0; } -} - -void -Slash_repeat_engraver::stop_translation_timestep () -{ beat_slash_ = 0; } + #include "translator.icc" ADD_TRANSLATOR (Slash_repeat_engraver, -- 2.39.2