| 1720 | } |
| 1721 | |
| 1722 | tl::PixelBuffer |
| 1723 | LayoutViewBase::icon_for_layer (const LayerPropertiesConstIterator &iter, unsigned int w, unsigned int h, double dpr, unsigned int di_off, bool no_state) |
| 1724 | { |
| 1725 | if (dpr < 0.0) { |
| 1726 | dpr = canvas () ? canvas ()->dpr () : 1.0; |
| 1727 | } |
| 1728 | |
| 1729 | double gamma = canvas () ? canvas ()->gamma () : 2.0; |
| 1730 | double dpr_drawing = canvas () ? 1.0 / canvas ()->resolution () : 1.0; |
| 1731 | unsigned int oversampling = canvas () ? canvas ()->oversampling () : 1; |
| 1732 | |
| 1733 | h = std::max ((unsigned int) 16, h) * oversampling * dpr + 0.5; |
| 1734 | w = std::max ((unsigned int) 16, w) * oversampling * dpr + 0.5; |
| 1735 | |
| 1736 | tl::color_t def_color = 0x808080; |
| 1737 | tl::color_t fill_color = iter->has_fill_color (true) ? iter->eff_fill_color (true) : def_color; |
| 1738 | tl::color_t frame_color = iter->has_frame_color (true) ? iter->eff_frame_color (true) : def_color; |
| 1739 | |
| 1740 | tl::PixelBuffer image (w, h); |
| 1741 | image.set_transparent (true); |
| 1742 | image.fill (background_color ().rgb ()); |
| 1743 | |
| 1744 | // upper scanline is a dummy one |
| 1745 | tl::color_t *sl0 = (uint32_t *) image.scan_line (0); |
| 1746 | for (size_t i = 0; i < w; ++i) { |
| 1747 | *sl0++ = 0; |
| 1748 | } |
| 1749 | |
| 1750 | lay::Bitmap fill (w, h, 1.0, 1.0); |
| 1751 | lay::Bitmap frame (w, h, 1.0, 1.0); |
| 1752 | lay::Bitmap text (w, h, 1.0, 1.0); |
| 1753 | lay::Bitmap vertex (w, h, 1.0, 1.0); |
| 1754 | |
| 1755 | unsigned int wp = w - 1; |
| 1756 | |
| 1757 | if (! no_state && ! iter->visible (true)) { |
| 1758 | |
| 1759 | wp = w / 4; |
| 1760 | |
| 1761 | // Show the arrow if it is invisible also locally. |
| 1762 | if (! iter->visible (false)) { |
| 1763 | |
| 1764 | unsigned int aw = h / 4; |
| 1765 | unsigned int ap = w / 2 - 1; |
| 1766 | for (unsigned int i = 0; i <= aw; ++i) { |
| 1767 | text.fill (h / 2 - 1 - i, ap, ap + aw - i + 1); |
| 1768 | text.fill (h / 2 - 1 + i, ap, ap + aw - i + 1); |
| 1769 | } |
| 1770 | |
| 1771 | } |
| 1772 | |
| 1773 | } |
| 1774 | |
| 1775 | if (! no_state && no_stipples ()) { |
| 1776 | // Show a partial stipple pattern only for "no stipple" mode |
| 1777 | for (unsigned int i = 1; i < h - 2; ++i) { |
| 1778 | fill.fill (i, w - 1 - w / 4, w); |
| 1779 | } |
nothing calls this directly
no test coverage detected