Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(10)

Delta Between Two Patch Sets: lily/page-breaking.cc

Issue 5626052: Gets vertical skylines from grob stencils (Closed)
Left Patch Set: Writes special cache functions to speed up code Created 13 years ago
Right Patch Set: Run astyle on c++ files Created 12 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 /* 1 /*
2 This file is part of LilyPond, the GNU music typesetter. 2 This file is part of LilyPond, the GNU music typesetter.
3 3
4 Copyright (C) 2006--2012 Joe Neeman <joeneeman@gmail.com> 4 Copyright (C) 2006--2012 Joe Neeman <joeneeman@gmail.com>
5 5
6 LilyPond is free software: you can redistribute it and/or modify 6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by 7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or 8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version. 9 (at your option) any later version.
10 10
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 497
498 Real 498 Real
499 Page_breaking::page_height (int page_num, bool last) const 499 Page_breaking::page_height (int page_num, bool last) const
500 { 500 {
501 // The caches allow us to store the page heights for any 501 // The caches allow us to store the page heights for any
502 // non-negative page numbers. We use a negative value in the 502 // non-negative page numbers. We use a negative value in the
503 // cache to signal that that position has not yet been initialized. 503 // cache to signal that that position has not yet been initialized.
504 // This means that we won't cache properly if page_num is negative or 504 // This means that we won't cache properly if page_num is negative or
505 // if calc_height returns a negative number. But that's likely to 505 // if calc_height returns a negative number. But that's likely to
506 // be rare, so it shouldn't affect performance. 506 // be rare, so it shouldn't affect performance.
507 vector<Real>& cache = last ? last_page_height_cache_ : page_height_cache_; 507 vector<Real> &cache = last ? last_page_height_cache_ : page_height_cache_;
508 if (page_num >= 0 && (int) cache.size () > page_num && cache[page_num] >= 0) 508 if (page_num >= 0 && (int) cache.size () > page_num && cache[page_num] >= 0)
509 return cache[page_num]; 509 return cache[page_num];
510 else 510 else
511 { 511 {
512 SCM mod = scm_c_resolve_module ("scm page"); 512 SCM mod = scm_c_resolve_module ("scm page");
513 SCM page = make_page (page_num, last); 513 SCM page = make_page (page_num, last);
514 SCM calc_height = scm_c_module_lookup (mod, "calc-printable-height"); 514 SCM calc_height = scm_c_module_lookup (mod, "calc-printable-height");
515 calc_height = scm_variable_ref (calc_height); 515 calc_height = scm_variable_ref (calc_height);
516 516
517 SCM height_scm = scm_apply_1 (calc_height, page, SCM_EOL); 517 SCM height_scm = scm_apply_1 (calc_height, page, SCM_EOL);
(...skipping 1149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 // FIXME: take into account the height of the footer 1667 // FIXME: take into account the height of the footer
1668 Real translate = min (line.shape_.begin_[DOWN], line.shape_.rest_[DOWN]); 1668 Real translate = min (line.shape_.begin_[DOWN], line.shape_.rest_[DOWN]);
1669 return max (0.0, max (padding, min_distance + translate)); 1669 return max (0.0, max (padding, min_distance + translate));
1670 } 1670 }
1671 1671
1672 int 1672 int
1673 Page_breaking::orphan_penalty () const 1673 Page_breaking::orphan_penalty () const
1674 { 1674 {
1675 return orphan_penalty_; 1675 return orphan_penalty_;
1676 } 1676 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b