| 431 | } |
| 432 | |
| 433 | static void create_precursor_bitmaps (const std::vector<lay::ViewOp> &view_ops_in, const std::vector <unsigned int> &vo_map, const std::vector<lay::Bitmap *> &pbitmaps_in, const std::vector<unsigned int> &bm_map, const lay::LineStyles &ls, unsigned int width, unsigned int height, std::map<unsigned int, lay::Bitmap> &precursors, tl::Mutex *mutex) |
| 434 | { |
| 435 | tl_assert (bm_map.size () == vo_map.size ()); |
| 436 | |
| 437 | // Styled lines with width > 1 are not rendered directly, but through an intermediate step. |
| 438 | // We prepare the necessary precursor bitmaps now |
| 439 | for (unsigned int i = 0; i < vo_map.size (); ++i) { |
| 440 | |
| 441 | unsigned int vo_index = vo_map [i]; |
| 442 | unsigned int bm_index = bm_map [i]; |
| 443 | |
| 444 | const ViewOp &op = view_ops_in [vo_index]; |
| 445 | if (op.width () > 1 && ls.style (op.line_style_index ()).width () > 0) { |
| 446 | |
| 447 | // lock bitmaps against change by the redraw thread |
| 448 | if (mutex) { |
| 449 | mutex->lock (); |
| 450 | } |
| 451 | |
| 452 | lay::Bitmap &bp = precursors.insert (std::make_pair (bm_index, lay::Bitmap (width, height, 1.0, 1.0))).first->second; |
| 453 | const LineStyleInfo &ls_info = ls.style (op.line_style_index ()).scaled (op.width ()); |
| 454 | |
| 455 | for (unsigned int y = 0; y < height; y++) { |
| 456 | render_scanline_std_edge (ls_info.pattern (), ls_info.pattern_stride (), pbitmaps_in [bm_index], y, width, height, bp.scanline (y)); |
| 457 | } |
| 458 | |
| 459 | if (mutex) { |
| 460 | mutex->unlock (); |
| 461 | } |
| 462 | |
| 463 | } |
| 464 | |
| 465 | } |
| 466 | } |
| 467 | |
| 468 | void |
| 469 | bitmaps_to_image (const std::vector<lay::ViewOp> &view_ops_in, |
no test coverage detected